inferred type doesn't type-check (using type families)
Simon Peyton-Jones
simonpj at microsoft.com
Wed Nov 4 03:29:26 EST 2009
| I think (untested) that in this particular case you can get around the
| problem using scoped type variables:
|
| > g :: forall a. Num a => T a -> T a
| > g x = f x (42 :: a)
|
| In fact, this seems to be the general pattern for fixing problems like
| this with type families: add extra "witness" arguments which GHC can
| use to unify type variables that are "hidden" inside type family
| applications.
But in this case all you've done is to make g have an ambiguous type.
I've drafted a FAQ about this at
http://haskell.org/haskellwiki/GHC/Type_families#Frequently_asked_questions
Please, everyone, edit and extend.
Simon
More information about the Glasgow-haskell-users
mailing list