on master help sign in
Defined (<$) and ($>), analogous to Haskell's (<*) and (*>)
commit112f92abc9e78537932f2d15b573457276e02a6c authorstartling <tdixon51793@gmail.com> dateThu 13 Dec 2012, 21:18 (14 years ago) parent4f93ab6
1 file changed+9−1
lib/Prelude/Applicative.idr+9−1
lib/Prelude/Applicative.idr+9−1
@@ -9,7 +9,15 @@ infixl 2 <$>
99
1010class Functor f => Applicative (f : Type -> Type) where
1111 pure : a -> f a
12− (<$>) : f (a -> b) -> f a -> f b
12+ (<$>) : f (a -> b) -> f a -> f b
13+
14+infixl 2 <$
15+(<$) : Applicative f => f a -> f b -> f a
16+a <$ b = fmap const a <$> b
17+
18+infixl 2 $>
19+($>) : Applicative f => f a -> f b -> f b
20+a $> b = fmap (const id) a <$> b
1321
1422class Applicative f => Alternative (f : Type -> Type) where
1523 empty : f a