module Control.Arrow.Util where
import Control.Arrow (Arrow, arr, (&&&), (>>^), (^<<))
constantly :: Arrow a => b -> a c b
constantly :: forall (a :: * -> * -> *) b c. Arrow a => b -> a c b
constantly = forall (a :: * -> * -> *) b c. Arrow a => (b -> c) -> a b c
arr forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. a -> b -> a
const
{-# INLINE constantly #-}
elementwise :: Arrow a => (c -> d) -> a b c -> a b d
elementwise :: forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
elementwise = forall (a :: * -> * -> *) c d b.
Arrow a =>
(c -> d) -> a b c -> a b d
(^<<)
elementwise2 :: Arrow a => (c -> d -> e) -> a b c -> a b d -> a b e
elementwise2 :: forall (a :: * -> * -> *) c d e b.
Arrow a =>
(c -> d -> e) -> a b c -> a b d -> a b e
elementwise2 c -> d -> e
op a b c
a1 a b d
a2 = (a b c
a1 forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& a b d
a2) forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> (c -> d) -> a b d
>>^ forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry c -> d -> e
op