Changes in scoped type variable behavior?

David Menendez dave at zednenem.com
Fri Jan 23 19:25:20 EST 2009


2009/1/23 Austin Seipp <mad.one at gmail.com>:
>
> The code is attached to this message; the problem is in the normalize
> function:
>
>> normalize :: (Modular s a, Integral a) => a -> M s a
>> normalize a = M (mod a (modulus (u :: s)))

"s" isn't scoped over the definition of "normalize" in this
definition. You need an explicit "forall".

normalize :: forall s a. (Modular s a, Integral a) => a -> M s a
normalize a = M (mod a (modulus (u::s)))

See section 8.8.6 of the GHC manual.

<http://www.haskell.org/ghc/docs/latest/html/users_guide/other-type-extensions.html#scoped-type-variables>


-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Glasgow-haskell-users mailing list