[Haskell-cafe] C++ Haskell interpreter with GADTs + Type Families + Rank-n types

Benjamin Redelings benjamin.redelings at gmail.com
Sat Jan 21 05:17:27 UTC 2023

On 1/20/23 4:34 AM, Henning Thielemann wrote:
> On Thu, 19 Jan 2023, Benjamin Redelings wrote:
>> I don't want to oversell this, but in case anyone is interested, I've 
>> been working on a Haskell interpreter that is written in C++.  This 
>> isn't intended to compete with GHC.  It doesn't generate machine 
>> code, and it is not fast.
> How does it compare to Hugs? Ok, Hugs does not support type families, 
> only functional dependencies.

I think this uses a different approach to solving constraints than Hugs.

1. Unifying types a and b results in recording a "wanted" constraint (a 
~ n).  You can manually write constraints like (a ~ F b).

2. Wanted constraints are deferred -- they are handled later in the 

3. Typechecking now makes heavy use of nested "implication constraints":

     exists a b c. givens => wanteds

4. Defaulting is postponed until the whole program has been analyzed by 
the typechecker.

5. Error messages likewise postpone until after defaulting. Basically 
you look at wanted constraints, including looking into nested 
implication constraints, and complain about any constraints that remain.

Much of this is described in the OutsideIn(X) paper:


I don't think this was around when Hugs was active.

More information about the Haskell-Cafe mailing list