[Haskell-cafe] Applicative but not Monad

Tom Davie tom.davie at gmail.com
Fri Oct 30 12:39:58 EDT 2009


Of note, there is a sensible monad instance for zip lists which I *think*
agrees with the Applicative one, I don't know why they're not monads:

instance Monad (ZipList a) where
  return = Ziplist . return
  join (ZipList []) = ZipList []
  join (ZipList (a:as)) = zlHead a `zlCons` join (map zlTail as)

I'll provide an alternative though, Const a is an applicative, but not a
monad.

Bob

On Fri, Oct 30, 2009 at 5:25 PM, Eugene Kirpichov <ekirpichov at gmail.com>wrote:

> Yes. ZipList.
> http://en.wikibooks.org/wiki/Haskell/Applicative_Functors
>
> 2009/10/30 Yusaku Hashimoto <nonowarn at gmail.com>:
> > Hello cafe,
> > Do you know any data-type which is Applicative but not Monad?
> >
> > Cheers,
> > -~nwn
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
>
>
>
> --
> Eugene Kirpichov
> Web IR developer, market.yandex.ru
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091030/742c85ab/attachment.html


More information about the Haskell-Cafe mailing list