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.

Thanks!

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.

Manuel

PS: And, no, you won't be able to set breakpoints in type-level
    programs...
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to