Skip to content

Commit 7318626

Browse files
committed
Relax instance requirements for extend/monad
1 parent 913290f commit 7318626

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Control/Comonad/Cofree.purs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ module Control.Comonad.Cofree
1010
import Prelude
1111

1212
import Control.Comonad (class Comonad)
13-
import Control.Alt ((<|>))
14-
import Control.MonadPlus (class MonadPlus)
13+
import Control.Alternative (class Alternative, (<|>))
1514
import Control.Extend (class Extend)
1615
import Control.Monad.Trampoline (Trampoline, runTrampoline)
1716

@@ -85,9 +84,9 @@ instance applyCofree :: (Apply f) => Apply (Cofree f) where
8584
instance applicativeCofree :: (Applicative f) => Applicative (Cofree f) where
8685
pure a = mkCofree a (pure $ pure a)
8786

88-
instance bindCofree :: (MonadPlus f) => Bind (Cofree f) where
87+
instance bindCofree :: (Alternative f) => Bind (Cofree f) where
8988
bind fa f = loop fa where
9089
loop fa = let fh = f (head fa)
9190
in mkCofree (head fh) ((tail fh) <|> (loop <$> tail fa))
9291

93-
instance monadCofree :: (MonadPlus f) => Monad (Cofree f)
92+
instance monadCofree :: (Alternative f) => Monad (Cofree f)

0 commit comments

Comments
 (0)