git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add some `Functor` functions.
108e04fjoneshf
prelude/prelude.purs+13−1
@@ -7,7 +7,7 @@ module Prelude
7 , ($), (#)
7 , ($), (#)
8 , (:), cons
8 , (:), cons
9 , Show, show
9 , Show, show
10− , Functor, (<$>), void
10+ , Functor, (<$>), (<$), ($>), (<#>), void
11 , Apply, (<*>)
11 , Apply, (<*>)
12 , Applicative, pure, liftA1
12 , Applicative, pure, liftA1
13 , Bind, (>>=)
13 , Bind, (>>=)
@@ -111,10 +111,22 @@ module Prelude
111 show = showArrayImpl show
111 show = showArrayImpl show
112
112
113 infixl 4 <$>
113 infixl 4 <$>
114+ infixl 4 <$
115+ infixl 4 $>
116+ infixl 1 <#>
114
117
115 class Functor f where
118 class Functor f where
116 (<$>) :: forall a b. (a -> b) -> f a -> f b
119 (<$>) :: forall a b. (a -> b) -> f a -> f b
117
120
121+ (<#>) :: forall f a b. (Functor f) => f a -> (a -> b) -> f b
122+ (<#>) fa f = f <$> fa
123+
124+ (<$) :: forall f a b. (Functor f) => b -> f a -> f b
125+ (<$) b fa = const b <$> fa
126+
127+ ($>) :: forall f a b. (Functor f) => f a -> b -> f b
128+ ($>) fa b = const b <$> fa
129+
118 void :: forall f a. (Functor f) => f a -> f Unit
130 void :: forall f a. (Functor f) => f a -> f Unit
119 void fa = const unit <$> fa
131 void fa = const unit <$> fa
120
132