Interfaces - the Golden Path of Haskell?

Wvv vitea3v at
Fri Jul 5 00:37:41 CEST 2013

We already could write and compile next code:

{-# LANGUAGE PolyKinds, FlexibleContexts, TypeFamilies #-}

{-# LANGUAGE FlexibleInstances, UndecidableInstances #-}

class Monoid (a :: k) where
type Pr a :: *
mempty :: PA a
mappend :: Pr a -> Pr a -> Pr a

instance Monoid [b] where
type Pr [b] = [b]
mempty = []
mappend = (++)

instance (Monad m, MonadPlus m) => Monoid ( m :: * -> * ) where
type Pr m = m Int -- Unfortunally, we can't write now type Pr m = forall b. m b

--Illegal polymorphic or qualified type: forall b. m b
mempty = mzero
mappend = mplus

This code is already valid.

But we can't use any written instance at all, the ambiguity problem.


  29 / 06 / 2013 17:39:25 user Ben Franksen [via Haskell]
  (ml-node+s1045720n5732210h49 at wrote:

  This is a kind error. The m in Monoid has kind *, while the one in Monad has
  kind * -> *.

  I suggest you (try to) rewrite your proposal to eliminate these kind errors
  before any further elaboration.

  Ben Franksen
  () ascii ribbon campaign - against html e-mail
  /\ - against proprietary attachm€nts

  Haskell-prime mailing list
  [hidden email]


  If you reply to this email, your message will be added to the discussion
  To unsubscribe from Interfaces - the Golden Path of Haskell?, click here.

View this message in context:
Sent from the Haskell - Haskell-prime mailing list archive at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Haskell-prime mailing list