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
From just Djinn, you can come up with a Comonad instance for Search r when r is a Monoid:
instanceMonoidr=>Comonad (Searchr) where
extract (Search m) = m $constmempty
extend f (Search m) =Search$\pb -> f $Search$\pa -> m $\a ->mappend (pa a) $ pb $ f $pure a
I'm pretty sure the Comonad laws are satisfied by way of the associativity of the underlying Monoid, but I haven't rigorously derived them.
It also explains why there's no Alternative instance: because extract empty would be incredibly ill-typed.
The text was updated successfully, but these errors were encountered:
From just Djinn, you can come up with a
Comonad
instance forSearch r
whenr
is aMonoid
:I'm pretty sure the
Comonad
laws are satisfied by way of the associativity of the underlyingMonoid
, but I haven't rigorously derived them.It also explains why there's no
Alternative
instance: becauseextract empty
would be incredibly ill-typed.The text was updated successfully, but these errors were encountered: