[Haskell-cafe] kinds question

David Roundy droundy at abridgegame.org
Thu Dec 22 16:09:46 EST 2005

Hello all,

I have a question about how to create the right kind to declare lists to be
a class.  I have a class Foo

class Foo f where
  foo :: f a -> Foo

and I want to define that a list of Foos is also a Foo, but can't see how
to do it.  I imagine something like

instance Foo f => Foo [f] where
  foo xs = map foo xs

but of course [f] isn't a valid type.

I can define

newtype LL f a = LL [f a]
instance Foo f => Foo (LL f) where
  foo (LL xs) = LL (map foo xs)

but then I haven't defined anything regarding an actual list.

When I try

type LL f a = [f a]
instance Foo f => Foo (LL f) where
  foo xs = map foo xs

I am informed that LL should have two arguments.

Any suggestions? Am I overlooking something obvious?
David Roundy

More information about the Haskell-Cafe mailing list