
27 Jul
2007
27 Jul
'07
5:31 a.m.
On Jul26, apfelmus wrote:
Yes, the types of the patterns don't unify. But each one is a specialization of the argument type. Note that the type signature is
bar :: (forall a . ViewInt a => a) -> String
which is very different from
bar :: forall a . ViewInt a => a -> String
Without the extension, we would write bar as follows
bar :: (forall a . ViewInt a => a) -> String bar x = let xNat = x :: Nat in case xNat of Zero -> ... _ -> let xListBool = x :: [Bool] in case xListBool of True:xs -> ...
In other words, we can specialize the polymorphic argument to each pattern type and each equation may match successfully.
Oh, I understand what you're saying now. Thanks for clarifying! -Dan