concrete functor and monad transformers
#68Lift's <*> is not lazy
<*> implementation for Lift is not lazy in the sense that in order to get access to the contents of
Other, the right operand of
<*> must be in the WHNF.
This is easy to fix, e.g.:
instance (Applicative f) => Applicative (Lift f) where pure = Pure Pure f <*> ax = f <$> ax Other f <*> ax = Other $ f <*> (case ax of Pure x -> pure x Other y -> y )
Please see https://ro-che.info/articles/2019-03-02-lazy-validation-applicative for the motivation.
I've applied this, as I find this use convincing. My only reservation was that although all applicatives should satisfy
f <*> pure x = ($ x) <$> f, there might be some applicative for which the left side is more expensive.
- status set to closed