We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This rules out deriving the Applicative instance for Moore machines
Applicative
Moore
instance Applicative (Moore a) where pure a = r where r = Moore a (const r) Moore f ff <*> Moore a fa = Moore (f a) (\i -> ff i <*> fa i)
So instead of implementing
instance Alternative f => Applicative (Cofree f) where pure x = x :< empty (<*>) = ap
is this not a more natural definition?
instance Applicative f => Applicative (Cofree f) where pure x = r where r = x :< pure r (f :< ff) <*> (a :< fa) = f a :< liftA2 (<*>) ff fa
The text was updated successfully, but these errors were encountered:
It would be a breaking change so it can be attached to a newtype, but it feels a lot more natural to me than the Alternative instance
newtype
Alternative
pure @(Cofree []) a = a :< [] -- vs pure @(Cofree []) a = a :< [a :< [a :< [a :< ...
Sorry, something went wrong.
No branches or pull requests
This rules out deriving the
Applicative
instance forMoore
machinesSo instead of implementing
is this not a more natural definition?
The text was updated successfully, but these errors were encountered: