
On Thu, Mar 1, 2012 at 1:20 PM, Twan van Laarhoven
On 01/03/12 09:31, Bas van Dijk wrote:
class Functor f where type FunctorConstraint f :: * -> Constraint type FunctorConstraint f = Empty
fmap :: (FunctorConstraint f b) => (a -> b) -> f a -> f b
class Empty a instance Empty a
Do you really need this Empty class?
Depends on what you want. You do need it if you want to be able to use 'FunctorConstraint f' itself as a type of kind * -> Constraint, for example to say type FunctorWithoutConstraint f = (Functor f, FunctorConstraint f ~ Empty).
That seems inconvenient. I had hoped you would be able to write something like
type FunctorConstraint f :: * -> Constraint type FunctorConstraint f a = ()
See this thread: http://www.mail-archive.com/glasgow-haskell-users@haskell.org/msg20792.html