Skip to content

Commit 0e8a64d

Browse files
authored
Merge pull request #81 from purescript/cofree-instances
Make Applicative/Monad instances consistent for Cofree
2 parents 70bd2c3 + 26cc98f commit 0e8a64d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Control/Comonad/Cofree.purs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,8 @@ instance extendCofree :: Functor f => Extend (Cofree f) where
152152
instance comonadCofree :: Functor f => Comonad (Cofree f) where
153153
extract = head
154154

155-
instance applyCofree :: Apply f => Apply (Cofree f) where
156-
apply f x = mkCofree h t
157-
where
158-
h = (head f) (head x)
159-
t = apply <$> (tail f) <*> (tail x)
155+
instance applyCofree :: Alternative f => Apply (Cofree f) where
156+
apply = ap
160157

161158
instance applicativeCofree :: Alternative f => Applicative (Cofree f) where
162159
pure a = mkCofree a empty

0 commit comments

Comments
 (0)