[Haskell-cafe] order of arguments matters

Roel van Dijk vandijk.roel at gmail.com
Fri Mar 18 12:13:47 CET 2011

I checked out the GHC documentation on the GADTs extension [1]:

"The key point about GADTs is that pattern matching causes type

So in
  tr2 (Tree Int) (Node _ (t:_)) = Node 1 [t]
the 'a' in 'Type a' is refined to 'Type (Tree a)'.

But in
  tr1 (Node _ (t:_)) (Tree Int) = Node 1 [t]
you want to "generalise" the type 'Tree a' to 'Type (Tree a)', which
is not possible.

1 - http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/data-type-extensions.html#gadt

More information about the Haskell-Cafe mailing list