
18 Mar
2011
18 Mar
'11
11:13 a.m.
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-extens...