Rank-2 polymorphism and pattern matching

Jim Apple jbapple+ghc-users at gmail.com
Sat Dec 29 02:59:19 EST 2007

The following won't compile for me

isnull :: (forall a . [a]) -> Bool
isnull ([] :: forall b . [b]) = True

   Couldn't match expected type `forall b. [b]'
           against inferred type `[a]'
    In the pattern: []

Wrapping it in a constructor doesn't help, though I can define a "null":

data NullList = NullList (forall a . [a])
null = NullList []

isnull2 :: NullList -> Bool
isnull2 (NullList []) = True



More information about the Glasgow-haskell-users mailing list