Monad instance for Monoid e => (,) e

Dan Burton danburton.email at gmail.com
Thu Jul 25 16:46:09 CEST 2013


-0.1

It's... obscure to make the instance this way.

(a,b) >>= (,) a' -- wat

Not very harmful, but obscure. (Cute trick for golfing?) I would suggest
using the writer monad instead, which is the same thing, but newtyped for
sanity (and tuple flipped).

-- Dan Burton


On Thu, Jul 25, 2013 at 5:18 AM, Jake McArthur <jake.mcarthur at gmail.com>wrote:

> There was a proposal to add it, but it went stale. I favor adding it.
> On Jul 25, 2013 7:47 AM, "Henning Thielemann" <
> lemming at henning-thielemann.de> wrote:
>
>>
>> On Thu, 25 Jul 2013, Nathan van Doorn wrote:
>>
>>  This is a relatively simple instance, so I was surprised that I couldn't
>>> find it in base.
>>> My proposal is to add the instance to Control.Monad.Instances,
>>> undeprecating the module.
>>>
>>
>> Wasn't it already added? Nonetheless, I strongly suggest to use
>> Control.Monad.Trans.Writer instead. To me, using a pair as a monad looks
>> like an error not like a feature.
>>
>> ______________________________**_________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/**mailman/listinfo/libraries<http://www.haskell.org/mailman/listinfo/libraries>
>>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130725/708cc416/attachment.htm>


More information about the Libraries mailing list