Koen writes:

  Consider the following datatype declaration:

    data Eq a => Foo a = Foo a

  It introduces a new constructor function with the type:

    Foo :: Eq a => a -> Foo a

  So far so good. This is what we expect.

  It also introduces a new pattern, which will result in the following
  typing:

    unFoo :: Eq a => Foo a -> a
    unFoo (Foo a) = a

  Why?? I require the context at _construction_ time, not at _destruction_
  time! Actually, when I unpack (Foo a), I _know_ there must be a dictionary
  (Eq a) somewhere! Because I required that at construction time!

This very issue is under discussion right now in the Standard Haskell
committee. See 

        http://www.cs.chalmers.se/~rjmh/Haskell/Messages/Display.cgi?id=302

John Hughes



Reply via email to