instance Applicative Data.Map

Henning Thielemann lemming at henning-thielemann.de
Wed Nov 14 23:37:41 CET 2012


On Wed, 14 Nov 2012, Tyson Whitehead wrote:

> On November 14, 2012 15:28:06 Henning Thielemann wrote:
>> Yes, that would work. It is only annoying that for liftA3 I do not need
>> 'pure', at all. Thus we may note in the record that Data.Map is an example
>> where <*> and liftAn make sense (for n>0) but 'pure' (i.e. Pointed) cannot
>> be defined.
>
> Sorry for jumping in in the middle without have really followed the
> conversation, but, assuming you want to define (<*>) without pure, would you
> also happen to want to define join without return?
>
> That is, is it also sensibly a non-Pointed Monad?

TMap implements Applicative and Monad instances corresponding to the 
Reader monad. That is, join m ! k == m!k!k. This would not work with a 
plain Data.Map, since (m!k!k) may not exist.



More information about the Libraries mailing list