proposal #2461: add Traversable generalizations of
mapAccumL?and mapAccumR
David Menendez
dave at zednenem.com
Sun Jul 27 23:05:38 EDT 2008
On Fri, Jul 25, 2008 at 10:12 AM, Michael Karcher
<usenet at mkarcher.dialup.fu-berlin.de> wrote:
> David Menendez <dave at zednenem.com> wrote:
>> Incidentally, is there a Backward applicative functor transfomer
>> defined anywhere?
>>
>> newtype Backward f a = Backward { runBackward :: f a } deriving Functor
>>
>> instance Applicative f => Applicative (Backward f) where
>> pure = Backward . pure
>> (Backward f) <*> (Backward a) = Backward (f <**> a)
>
> My intuitive typechecker doesn't accept that. And GHCi 6.8.2 seems to agree
> (I had to enable GeneralizedNewtypeDeriving for obvious reasons).
[..]
> Did I misunderstand something?
That's a typo on my part. I should have written "Backward (a <**> f)".
--
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
More information about the Libraries
mailing list