Cabal package macros| Shayne Fletcher
Testing a new stack resolver| Shayne Fletcher
Annotations in GHC| Shayne Fletcher
arith-cxx-tagless-final| Shayne Fletcher
Configuring Cabal build flags| Shayne Fletcher
Two things in Rust| Shayne Fletcher
When a user installs a program like HLint via Cabal, there's a good chance they'll pay a cost of building ghc-lib-parser. The build time for ghc-lib-parser is proportional to the number of modules that it contains, the less there are the faster it builds. The fewer there are, the better the user experience installing HLint.| Shayne Fletcher
There are places in the Haskell grammar where it's not known apriori whether it's an expression a command or a pattern that is being parsed. This used to be handled by picking a parse (e.g. as an expression say) and if that choice later turned out to be wrong, "rejigging it" (transform the constructed parse tree to its analog in the pattern language). The problem with that approach is that it meant having conflated sub-languages meaning, for example, HsExpr had to have pattern related constru...| Shayne Fletcher
In GHC, Haskell operator occurrences get classified into one of four categories. For example, the occurrence of ⊕ in a ⊕ b is "loose infix", in a⊕b is "tight infix", in a ⊕b is "prefix" and in a⊕ b, "suffix"| Shayne Fletcher
In the Trees that Grow paper, it is explained that GHC has a single data type HsSyn that crosses several compiler phases; a second data type TH.Syntax for Template Haskell and that other Haskell libraries e.g. haskell-src-exts defnining yet others. Ideally, HsSyn would be reused in Template Haskell and these third-party libraries and motivates the flexibilities offered by the TTG (Trees That Grow) techniques.| Shayne Fletcher
Having "solved" a bunch of these divide & conquer problems, I'm the first to admit to having being lulled into a false sense of security. At first glance, the problem of this post seemed deceptively simple and consequently I struggled with it, sort of "hand-waving", not really engaging my brain and getting more and more frustrated how the dang thing wouldn't yield to my experience! I think the moral of the story is math doesn't care about your previous successes and so don't let your past pr...| Shayne Fletcher
By far the easiest way I know of to get a build of GHC is via the tools 'stack' and 'hadrian'*. The procedures below set out commands that I know first hand work** with machines provisioned by the CI systems Azure, Travis and Appveyor.| Shayne Fletcher
My last post on parsing in the presence of dynamic pragmas left us with this outline for calling the GHC parser.| Shayne Fletcher
This post about Handling GHC parse errors shows that using qualified in postpostive position is a syntax error unless the ImportQualifiedPost language extension is enabled. In that post, it is explained that the program| Shayne Fletcher
Did you know, a POk parse result from the GHC parser doesn't necessarily mean the parse was OK? This blog explains what's up with that. The source code below is from this example in the ghc-lib repo.| Shayne Fletcher
On behalf of Digital Asset I am excited to share with you the latest release of ghc-lib.| Shayne Fletcher
Ever had one of those days?| Shayne Fletcher
This note summarizes the essential mechanics of adding a new language extension to GHC. The example code will illustrate adding a Foo extension.| Shayne Fletcher
Bucket sort assumes input generated by a random process that distributes elements uniformly over the interval [0, 1).| Shayne Fletcher
This article assumes familiarity with Dijkstra's shortest path algorithm. For a refresher, see [1]. The code assumes open Core is in effect and is online here.| Shayne Fletcher
OCaml migrate parse tree| Shayne Fletcher
The "towers of Hanoi" problem is stated like this. There are three| Shayne Fletcher
According to the lexical conventions of OCaml, characters different from \ and " can be enclosed in single quotes and appear in strings. The special characters \ and " are represented in these contexts by their escape sequences. The | Shayne Fletcher
The Unix tree utility produces a pretty rendering of a filesystem. Implementing an algorithm to produce output like tree is a little harder than one might expect! This short example program illustrates one way of doing it.| Shayne Fletcher
Transpose If we are to represent a row of a matrix as a list of numbers, then a matrix can naturally be re...| blog.shaynefletcher.org
"Hooked" on programming| blog.shaynefletcher.org
Implementing type-classes as OCaml modules Modular type classes We revisit the idea of type-classe...| blog.shaynefletcher.org
Haskell type-classes in OCaml and C++ This article examines the emulation of Haskell like type-classes...| blog.shaynefletcher.org