[Haskell-cafe] Rank N type tutorial?

David House dmhouse at gmail.com
Fri Oct 27 18:45:30 EDT 2006


On 27/10/06, David House <dmhouse at gmail.com> wrote:
> heteroList' = [MkT' 5, MkT' (), MkT' True]
> main = mapM_ print heteroList'
>
> {- prints:
> 5
> ()
> True
> -}

Sorry, the definition of main is a bit off. It should read:

main = mapM_ (\(MkT' x) -> print x) heteroList'

Of course you have to unpack the MkT' first (or define a Show instance
for T', noting that you can't derive anything on existentials).

-- 
-David House, dmhouse at gmail.com


More information about the Haskell-Cafe mailing list