You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wouldn't it make sense to define WrappedApplicative's fmap via liftA instead of <$> to support the following use case?
{-# language DerivingVia #-}
import Data.Functor.Apply
data Vec3 a = MkVec3 a a a
deriving stock Show
deriving Functor via WrappedApplicative Vec3
instance Applicative Vec3 where
pure x = MkVec3 x x x
(MkVec3 f g h) <*> (MkVec3 x y z) = MkVec3 (f x) (g y) (h z)
This would be a breaking change since the instance would change from
instance Functor f => Functor (WrappedApplicative f) where
fmap f (WrapApplicative a) = WrapApplicative (f <$> a)
to
instance Applicative f => Functor (WrappedApplicative f) where
fmap f (WrapApplicative a) = WrapApplicative (liftA f a)
However due to the name WrappedApplicative it seems reasonable to require an Applicative instance.
The text was updated successfully, but these errors were encountered:
Wouldn't it make sense to define
WrappedApplicative
'sfmap
vialiftA
instead of<$>
to support the following use case?This would be a breaking change since the instance would change from
to
However due to the name
WrappedApplicative
it seems reasonable to require anApplicative
instance.The text was updated successfully, but these errors were encountered: