git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add Semigroupoid
commitb07cc2e019cf6f6b90a9cad4260cd92b6ce6fb5f authorGary Burgess <gary.burgess@gmail.com> dateTue 8 Apr 2014, 23:26 (13 years ago) parente62efe1
1 file changed+9−5
prelude/prelude.purs+9−5
prelude/prelude.purs+9−5
@@ -15,16 +15,20 @@ module Prelude where
1515 infixr 9 >>>
1616 infixr 9 <<<
1717
18− class Category a where
19− id :: forall t. a t t
18+ class Semigroupoid a where
2019 (<<<) :: forall b c d. a c d -> a b c -> a b d
2120
22− (>>>) :: forall a b c d. (Category a) => a b c -> a c d -> a b d
21+ instance semigroupoidArr :: Semigroupoid (->) where
22+ (<<<) f g x = f (g x)
23+
24+ (>>>) :: forall a b c d. (Semigroupoid a) => a b c -> a c d -> a b d
2325 (>>>) f g = g <<< f
2426
27+ class (Semigroupoid a) <= Category a where
28+ id :: forall t. a t t
29+
2530 instance categoryArr :: Category (->) where
2631 id x = x
27− (<<<) f g x = f (g x)
2832
2933 infixr 0 $
3034 infixl 0 #
@@ -80,7 +84,7 @@ module Prelude where
8084 (>>=) :: forall a b. m a -> (a -> m b) -> m b
8185
8286 class (Applicative m, Bind m) <= Monad m
83−
87+
8488 return :: forall m a. (Monad m) => a -> m a
8589 return = pure
8690