[Haskell-cafe] Monad.Reader 8: Haskell, the new C++

Manuel M T Chakravarty chak at cse.unsw.edu.au
Thu Sep 13 21:05:34 EDT 2007

Pepe Iborra wrote,
>> For a taste, see Instant Insanity transliterated in this functional 
>> language:
>> http://hpaste.org/2689
> I thought I'd better paste here the code for Instant Insanity with Type 
> Families. Otherwise it will vanish in a short time.
> I took the opportunity to clean it up a bit.


> Although AT are not a supported feature, the code works in a 6.8.1 
> snapshot.
> But note that you cannot actually see the solution, as there is no way 
> to ask
> GHCi to display the normalized types.

Just to complete transferring the discussion from the ephemeral 
hpaste to the mailing list.  My response to the lack of being able 
to display normalised types was that GHC actually goes to 
considerable trouble to preserve the original (non-normalised types) 
for error messages and other output, as this usually makes these 
messages easier to understand (eg, you usually rather like String 
than [Char] in an error message).

However, to debug your type-level programs (or to abuse the type 
checker as an evaluator) this is clearly inconvenient.  So, the plan 
is to add a ghci command that given a type will print its normal 
form.  On hpaste, Pepe also suggested a flag to instruct the 
compiler to generally print normalised instead of unnormalised 
types.  However, I think a form of eval for types on the command 
line is the most direct way of experimenting with type families and 
debugging type-level programs.


PS: And, no, you won't be able to set breakpoints in type-level

More information about the Haskell-Cafe mailing list