[Haskell-cafe] same function's type accepted in top level, but rejected in where clause
Ömer Sinan Ağacan
omeragacan at gmail.com
Fri Jul 5 23:03:24 CEST 2013
> If you add the pragma ScopedTypeVariables to your file, it works the
> way you would assume. However you will have to change the toplevel
> signature to iterateListF :: forall a. (a -> a) -> a -> Fix (ListF a)
> in order to make it work (added the forall a.).
Thanks, that worked.
As far as I understand, the problem is because in this definition:
where
f :: a -> ListF a a
f a = ConsF a (fn a)
There's an implicit quantifier in type of `f`, like this: `f :: forall
a. a -> ListF a a`. When I add `ScopedTypeVariables` and `forall a.
...` in top level definition, it's like all `a`s in scope of top level
definition are same, except when explicitly defined as `forall a.
...`.
Is my intuition correct?
---
Ömer Sinan Ağacan
http://osa1.net
More information about the Haskell-Cafe
mailing list