File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ module Data.Profunctor.Joker where
33import Prelude
44
55import Data.Either (Either (..))
6- import Data.Newtype (class Newtype )
6+ import Data.Newtype (class Newtype , un )
77import Data.Profunctor (class Profunctor )
88import Data.Profunctor.Choice (class Choice )
99
@@ -27,5 +27,16 @@ instance clownJoker :: Functor f => Choice (Joker f) where
2727 left (Joker f) = Joker $ map Left f
2828 right (Joker f) = Joker $ map Right f
2929
30+ instance applyJoker :: Apply f => Apply (Joker f a ) where
31+ apply (Joker f) (Joker g) = Joker $ apply f g
32+
33+ instance applicativeJoker :: Applicative f => Applicative (Joker f a ) where
34+ pure = Joker <<< pure
35+
36+ instance bindJoker :: Bind f => Bind (Joker f a ) where
37+ bind (Joker ma) amb = Joker $ ma >>= (amb >>> un Joker )
38+
39+ instance monadJoker :: Monad m => Monad (Joker m a )
40+
3041hoistJoker :: forall f g a b . (f ~> g ) -> Joker f a b -> Joker g a b
3142hoistJoker f (Joker a) = Joker (f a)
You can’t perform that action at this time.
0 commit comments