File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ module Data.Profunctor.Joker where
22
33import Prelude
44
5- import Data.Profunctor ( class Profunctor )
5+ import Data.Either ( Either (..) )
66import Data.Newtype (class Newtype )
7+ import Data.Profunctor (class Profunctor )
8+ import Data.Profunctor.Choice (class Choice )
79
810-- | Makes a trivial `Profunctor` for a covariant `Functor`.
911newtype Joker f a b = Joker (f b )
@@ -21,5 +23,9 @@ instance functorJoker :: Functor f => Functor (Joker f a) where
2123instance profunctorJoker :: Functor f => Profunctor (Joker f ) where
2224 dimap f g (Joker a) = Joker (map g a)
2325
26+ instance clownJoker :: Functor f => Choice (Joker f ) where
27+ left (Joker f) = Joker $ map Left f
28+ right (Joker f) = Joker $ map Right f
29+
2430hoistJoker :: forall f g a b . (f ~> g ) -> Joker f a b -> Joker g a b
2531hoistJoker f (Joker a) = Joker (f a)
You can’t perform that action at this time.
0 commit comments