instance Applicative Data.Map
jake.mcarthur at gmail.com
Thu Nov 15 13:45:22 CET 2012
On Wed, Nov 14, 2012 at 5:37 PM, Henning Thielemann <
lemming at henning-thielemann.de> wrote:
> On Wed, 14 Nov 2012, Tyson Whitehead wrote:
>> 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.
If (m ! k) exists but (m ! k ! k) does not, that just means (join m ! k)
does not exist.
join = Map.mapMaybeWithKey Map.lookup
This is the semantics we would get with ReaderT k Maybe and, if it existed,
TMapT k Maybe.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries