John Meacham wrote:

every single parameter type class whole parameter is of kind * class Foo a where

automatically declares a data type defined as

data Foo = exists a . Foo a => Foo_ a (where Foo_ is some internal, non user accessable name)

and an instance

instance Foo Foo where
method (Foo_ x) = method x ...

I don't much like this, it seems like unnecessary sugar to me. My first preference would be not to do this at all.

My second preference would be to do this a bit more generally:

every type class
class Foo a b c where

automatically declares a data type defined as

data Foo t = exists a b c . Foo a b c => Foo_ (t a b c)
(where Foo_ is some internal, non user accessable name)

every single parameter type class whole parameter is of kind *
declares an instance

instance Foo (Foo Identity) where
         method (Foo_ x) = method x
         ...

It's still pretty ugly. I don't like special-casing classes that happen to have a particular kind signature.

--
Ashley Yakeley

_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime

Reply via email to