[Haskell-cafe] An interesting monad: "Prompt"

Ryan Ingram ryani.spam at gmail.com
Sun Dec 30 04:28:15 EST 2007


Currently, yes; I was experimenting with type families.  But it's pretty
simple to get it to compile on 6.6.1:
- remove the {-# LANGUAGE #-} pragma and replace with {-# OPTIONS_GHC
-fglasgow-exts -fallow-undecidable-instances #-}

- change the class declaration for MonadPrompter from
> class Monad m => MonadPrompter m where
>    type PromptType m :: * -> *
>    prompt :: PromptType m a -> m a

to

> class Monad m => MonadPrompter p m | m -> p where
>    prompt :: p a -> m a

- change all the instance declarations from something like this:

> instance MonadPrompter (XXX) where
>    type PromptType (XXX) = YYY
>    prompt = ...

to something like this:

> instance MonadPrompter YYY (XXX) where
>    prompt = ...

& you're done.

  -- ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071230/0cc113e6/attachment.htm


More information about the Haskell-Cafe mailing list