on master help sign in
Merge pull request #4040 from msmorgan/feature/correlative-operators

Interfaces.Correlative: add the operators </ and />

commitc97bf3f0997802a5f2d1b0ec59eb4a14fc4a55d4 authorAhmad Salim Al-Sibahi <asal@itu.dk> dateThu 5 Oct 2017, 13:51 (9 years ago) parent26dbcfae6f77bb
1 file changed+8
libs/contrib/Interfaces/Correlative.idr+8
libs/contrib/Interfaces/Correlative.idr+8
@@ -13,6 +13,14 @@ infixl 2 </>
1313interface Functor f => Correlative (f : Type -> Type) where
1414 (</>) : f (a -> b) -> f a -> f b
1515
16+infixl 2 </
17+(</) : Correlative f => f a -> f b -> f a
18+x </ y = map const x </> y
19+
20+infixl 2 />
21+(/>) : Correlative f => f a -> f b -> f b
22+x /> y = map (const id) x </> y
23+
1624||| Combine two containers elementwise using some function.
1725zipWith : Correlative f => (a -> b -> c) -> f a -> f b -> f c
1826zipWith f xs ys = (map f xs) </> ys