[Haskell-cafe] Functor instance for FunPB

MarLinn monkleyon at gmail.com
Sat May 6 19:04:40 UTC 2017


On 2017-05-06 20:38, David Kraeutmann wrote:
> The only lawful instance I can think of is:
> instance Functor (FunPB a) where
>    fmap f (FunPB g) = FunPB $ \k -> let (a,b) = g k in (a, fmap f b)
>
> which is fairly straightforward IMO.
And because it's closer to the original style:

	fmap f = FunPB .((.)((<$>).(<$>)$f)). runFunPB

Now it's STARRING INTO YOU SOUL. And it's also so much easier to read.



More information about the Haskell-Cafe mailing list