On Thu, Dec 10, 2015 at 10:16 PM, Simon Peter Nicholls <simon@mintsource.org> wrote:
Does `m a :-> m b` make sense for the latest releases of fclabels? Is it just the lifting that's a problem?
Yes, you can still write a function of type Monad m => (a :-> b) -> (m a :-> m b). But it's gotten a bit trickier as you can tell.
The wrong way is to try to write:
neededLift :: (Monad m) => ((b -> b) -> a -> a) -> (m b -> m b) -> m a -> m a
which, as Daniel pointed out, is impossible.
So we start with the isomorphisms:
isoL :: (f -> a) -> (a -> f -> f) -> ((a -> a) -> (f -> f)) isoL g s m f = s (m (g f)) f isoR :: (f -> a) -> ((a -> a) -> (f -> f)) -> (a -> f -> f) isoR _ m a = m (const a)
It turns out we really only need isoL, but isoR is there for completeness.
Then we write:
liftALabel :: Applicative f => a :-> b -> f a :-> f b