[Haskell-cafe] Fun with type functions
conrad at metadecks.org
Fri Dec 5 00:41:31 EST 2008
2008/11/27 Simon Peyton-Jones <simonpj at microsoft.com>:
> can you tell us about the most persuasive, fun application
> you've encountered, for type families or functional dependencies?
I certainly had fun with the Instant Insanity puzzle, in Monad.Reader issue 8:
That was using functional dependencies. Then Pepe Iborra pasted a
version of Instant Insanity with type families: http://hpaste.org/2689
Looking back at this, Manuel left the following comment:
-- There is unfortunately, no simple way to print the normalised type.
-- In fact, GHC goes to great length to show types with as little
-- normalisation as possible to users. (Especially for error messages,
-- that usually makes them much easier to understand.) However, with
-- type families, I think we really ought to have a ghci command to
-- specifically request a normalised type. I'll put that on my
-- TODO list!
-- For the moment, you can of course try forcing normalisation by
-- triggering type errors; eg
-- > :t solution :: Int
(Does ghci now have a command for printing normalised types?)
There are also links to haskell-cafe discussion and some other
implementations (in C++ templates and D) to, um, compare:
More information about the Haskell-Cafe