[Haskell-beginners] Monad instances and type synonyms
Brent Yorgey
byorgey at seas.upenn.edu
Tue Apr 16 15:57:18 CEST 2013
On Mon, Apr 15, 2013 at 09:51:11PM -0800, Christopher Howard wrote:
> On 04/14/2013 04:09 AM, Brent Yorgey wrote:
> > On Sat, Apr 13, 2013 at 05:03:57PM -0800, Christopher Howard wrote:
> >
> > Sorry, what you're trying to do is simply not possible. Type synonyms
> > must always be fully applied. So if you want to make Adjustment an
> > instance of Monad then you have to make it a newtype.
> >
> > However... Adjustment already *is* an instance of Monad! (In
> > particular ((->) e) is an instance for any type e.) So there's no
> > need for you to redeclare an instance yourself. These days I think
> > you just have to import Control.Monad to bring the instance in scope.
> >
> > -Brent
> >
>
> Thank you everyone for your patience. I believe what you say about it
> already being an instance of Monad, but I don't seem to have convinced
> the compiler:
What version of GHC do you have? Try 'import Control.Monad.Instances'
in place of 'Control.Monad'. The instances have moved but I don't
remember when.
-Brent
More information about the Beginners
mailing list