サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
iPhone 16
chrisdone.com
UPDATE 2021-01-02: I have since written a GHC compiler plugin to implement an alternative ?-based syntax for early return. I prefer that one than use of Try.do, because it doesn’t require any type magic or special instances, and the ? is more readable. UPDATE: I’ve added a follow-up post to this here, where I address some criticisms of this post. The first half of this post is here. Please read th
At the beginning of this decade (2010), a few of us Haskellers were exploring how best to do client-side web programming. We didn’t want to write JavaScript. There’s a surprising number of techniques we tried to avoid doing so. There was work coming from academia and industry. Here’s a history of my own experience in this problem space. In 2008, Joel Bjornson and Niklas Broberg published HJScript,
In this post we’re going to look at parsing XML in Haskell, how it compares with an efficient C parser, and steps you can take in Haskell to build a fast library from the ground up. We’re going to get fairly detailed and get our hands dirty. A new kid on the block A few weeks ago Neil Mitchell posted a blog post about a new XML library that he’d written. The parser is written in C, and the API is
UPDATE 2020-08-03: I no longer stand by the content in this post. I think the overall sentiment is marginally accurate; however, the details in the post are incorrect (as many have pointed out over the years). As has been pointed out, remove-if-not’s start/count parameters behave differently and cannot easily be separated out of the function, a design trade-off that I appreciate. As has been noted
There was an online discussion about iteration times in Haskell and whether and why they are slow. For me, it’s not slow. I do all my Haskell development using a REPL. Here are some tips I wrote up in that discussion. Prepare for GHCi use The first thing you want to do before writing anything for your project is make sure you can load your code in the REPL; GHCi. Sometimes you have special configu
Here I’d like to announce and explain the motivations behind my path package. Motivation It was after working on a number of projects at FP Complete that use file paths in various ways. We used the system-filepath package, which was supposed to solve many path problems by being an opaque path type. It occurred to me that the same kind of bugs kept cropping up: Expected a path to be absolute but it
and thought, “Shenanigans! Why not just have this?” Me too! I only learned of this solution relatively recently, and I know experienced Haskellers who also only understood this recently or still don’t. Hence this quick write up. Here’s the thought process. We’re writing a trivial pretty printer and we’re using Writer. We write things like:
How Haskellers are seen The type system and separated IO is an awkward, restricting space suit: Spending most of their time gazing longingly at the next abstraction to yoink from mathematics: Looking at anything outside the Haskell language and the type system: Using unsafePerformIO: How Haskellers see themselves No, it’s not a space suit. It’s Iron Man’s suit! The suit enables him to do impressiv
Happy new year, everyone. It’s a new year and time for new resolutions. Let’s talk about time. Specifically, measuring it in Haskell. A wrong solution How do you measure how long something takes in Haskell? Here’s a naive attempt: import Control.Exception import Data.Time main = do start <- getCurrentTime evaluate (sum [1 .. 1000000]) end <- getCurrentTime print (diffUTCTime end start) Inaccurate
I’m not big on custom templating languages, for reasons I’ll write about another time. I prefer EDSLs. I preferred the xhtml package back when that was what everybody used. It looked like this: header << thetitle << "Page title" thediv noHtml ! [theclass "logo"] << "…" thediv noHtml ! [identifier "login"] Pretty line-noisy to read, write and hard to edit in a reasonable manner. Later, blaze-html b
shell-conduit: Write shell scripts in Haskell with Conduit As part of my series of write-about-personal-projects, my latest obsession is writing shell scripts with Michael Snoyman’s Conduit. Here is my package, shell-conduit. It’s still in the experimental phase, but I don’t forsee any changes now for a while. Bash is evil I hate writing scripts in Bash. Until now, it was the easiest way to just w
Data.Typeable and Data.Data are rather mysterious. Starting out as a Haskell newbie you see them once in a while and wonder what use they are. Their Haddock pages are pretty opaque and scary in places. Here’s a quick rundown I thought I’d write to get people up to speed nice and quick so that they can start using it.1 It’s really rather beautiful as a way to do generic programming in Haskell. The
One odd thing about the Haskell community is that we don’t use debuggers. We don’t even use stack traces. I think for several reasons: Haskell code goes wrong less often. Due to that, people are content with once in a while sticking in printf statements. Lazy evaluation is known to make debugging tricky. Haskell has no decent editor support for debugging. It’s at least my experience that when my H
Attempto Controlled English is a formally defined unambiguous language which is a subset of the English language. It’s pretty sweet. I’ve known about it for some time, but I never fiddled with it because the standard implementation setup is rather elaborate. I wanted a nice, simple package in Haskell which would define a parser and a printer only, much like haskell-src-exts does. That way I can us
In 2001, Edsger W. Dijkstra wrote a letter to the Budget Council of The University of Texas. A PDF is available here, I’ve typed it up so that everyone can read it. Sadly, the curriculum was changed to Java. Relatedly, the algorithmic language Scheme was replaced by Python in MIT’s The Structure and Interpretation of Computer Programs version 6.01. To the members of the Budget Council I write to y
For about 2 months I’ve been working on and off on an Emacs package called structured-haskell-mode.1 A full explanation and demo of the features is available on the Github page. In summary, it is a mode that offers paredit-mode2 abilities for Haskell code. I’ve been keeping it to myself in a private Github repo, hoping to finish fleshing out the feature set3 and smooth over stability issues. In th
Hulk is an working-and-work-in-progress IRC server. Github repo. Motivation Last Wednesday night I whipped up a simple IRC server in Haskell in about four hours. We have been long time sick of the poor quality of the Skype Linux implementation, which was, on the dev team, our main point of communication. We agreed something like IRC would be good, so I thought it would be easy in Haskell to make s
A tiny language called Z “The main idea seems clever, but also too clever” — reddit A tiny, strict, impure, curried, dynamically typed (although that may change), partially applied language with rather peculiar syntax. Markdown’s insight First, I want you to recall Markdown. You've seen it even if you haven't ever written any. And you'll know that there's a particular feature in the Markdown synta
IntroductionFay is a small programming language which has the following properties:A strict syntactic and semantic subset of HaskellStatically typedLazyPure by defaultCompiles to JavaScriptHas fundamental data types (Double, String, etc.) based upon what JS can supportHas a trivial foreign function interface to JavaScriptBecause Fay is intended to be small and simple, it relies on GHC, the Haskell
HJ: Haskell-to-JavaScript Work in Progress This project aims to provide a compiler (specifically a code generator) for a subset Haskell to JavaScript. The outputted code should be small, a fairly good correspondance to the Haskell version, i.e. reasonably intelligible, and it should compress well with one of the major JavaScript compressors. It should at least be reasonably performant. Why write a
Ji, a little library for controlling a web browser from Haskell As of recent I have only been creating a lot of new projects, not working one existing ones or finishing half done ones off.1So here’s yet another little project that is to test the concept of controlling the web browser’s DOM from Haskell as a means to write user applications.It doesn’t use websockets as websockets aren’t well suppor
Last week I took a crack at testing the JavaScript compilation backend supported by UHC. There don’t seem to be any instructions1, that I have been able to find, on working with the JS backend. But it’s more or less straight-forward to figure out.As far as I understand quite a lot of what’s working now is thanks to Atze Dijkstra and Jurriën Stutterheim,2 so cheers to those!Build and Install UHCI u
I’ve been using HaskellDB in production for about two years. I decided that I’d write a proper, up-to-date description, or tutorial, about what it is, how it works, what it can do, and my experience using it in projects.1What is HaskellDB?HaskellDB is a database interface library for Haskell which featuresexplicit declaration of schema of entities and fields,an EDSL2—a Query monad—for making queri
IntroductionI am currently working on, and using, an Emacs package called haskell-emacs. It is intended as an eventual general replacement for haskell-mode1. It won’t be released officially for a while. I will describe my motivations and development process, the current features (with screenshots!) of this package, and the features intended for the future. Development ProcessThe reason for creatin
I am personally sick of working with Haskell’s syntax.tl;dr: Scroll right to the bottom to read what Lisk is. Most of this post is complaining about Haskell’s syntax. I like Haskell’s syntaxI came to Haskell in early 2008. I wrote my first Haskell program and I didn’t like the look of what I had produced. I also didn’t like typing it. Compared to Scheme and Common Lisp, my previous languages of ch
Make your own Try Haskel!You can now run Try Haskell! as a simple HTML file locally, or on your own domain, if you like! All you need is an internet connection.Grab the source with git (or download a .zip or .tar.gz of the latest version):$ git clone git://github.com/chrisdone/tryhaskell.git Get writing interactive tutorials! Please let me know how you get on. Evaluate Haskell code anywhereYou can
このページを最初にブックマークしてみませんか?
『Chris Done's Homepage』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く