Updating/understanding code from implicit configurations paper

Shachaf Ben-Kiki shachaf at gmail.com
Sat Jan 19 00:54:02 CET 2013


On Fri, Jan 18, 2013 at 3:32 PM, Eric M. Pashman <eric.pashman at gmail.com> wrote:
>
>     normalize :: (Modular s a, Integral a) => a -> M s a
>     normalize x = (M (mod x (modulus (undefined :: s)))) :: M s a
>

If you want your type variables to be scoped, you have to annotate
them explicitly:

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

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

    Shachaf



More information about the Glasgow-haskell-users mailing list