on master help sign in
Merge pull request #4040 from msmorgan/feature/correlative-operators
c97bf3fAhmad Salim Al-Sibahi
libs/contrib/Interfaces/Correlative.idr+8
@@ -13,6 +13,14 @@ infixl 2 </>
13interface Functor f => Correlative (f : Type -> Type) where
13interface Functor f => Correlative (f : Type -> Type) where
14 (</>) : f (a -> b) -> f a -> f b
14 (</>) : f (a -> b) -> f a -> f b
15
15
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+
16||| Combine two containers elementwise using some function.
24||| Combine two containers elementwise using some function.
17zipWith : Correlative f => (a -> b -> c) -> f a -> f b -> f c
25zipWith : Correlative f => (a -> b -> c) -> f a -> f b -> f c
18zipWith f xs ys = (map f xs) </> ys
26zipWith f xs ys = (map f xs) </> ys