Re: [Haskell-cafe] same function's type accepted in top level, but rejected in where clause

2013-07-08 Thread Chaddaï Fouché
On Fri, Jul 5, 2013 at 11:03 PM, Ömer Sinan Ağacan omeraga...@gmail.comwrote: 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

Re: [Haskell-cafe] same function's type accepted in top level, but rejected in where clause

2013-07-08 Thread Mateusz Kowalczyk
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/07/13 19:50, Chaddaï Fouché wrote: On Fri, Jul 5, 2013 at 11:03 PM, Ömer Sinan A?acan omeraga...@gmail.comwrote: There's an implicit quantifier in type of `f`, like this: `f :: forall a. a - ListF a a`. When I add `ScopedTypeVariables` and

[Haskell-cafe] same function's type accepted in top level, but rejected in where clause

2013-07-05 Thread Ömer Sinan Ağacan
Hi all, I came across an interesting type checker error, a function is accepted in top level, but rejected by type checker when moved to `where ...` clause. I moved required code to a new module for demonstration purposes: module Bug where fix :: (a - a) - a fix f = let x = f x in

Re: [Haskell-cafe] same function's type accepted in top level, but rejected in where clause

2013-07-05 Thread David McBride
If you remove the type signature from f in the where clause it will work. The reason is because the type signature listed there, the a is a different a than in the top level signature. If you change it from a to x, it says it should be the a that you can't seem to specify. If you add the pragma

Re: [Haskell-cafe] same function's type accepted in top level, but rejected in where clause

2013-07-05 Thread Ömer Sinan Ağacan
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