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

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

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

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to