module Control.Morphism (after, to, by, constant, identity, flip, (.), ($), (&), (!), (?)) where
infixr 9 .
infixr 0 $
infixl 1 &
infixr 2 !
infixr 2 ?
{-# INLINE after #-}
after :: (b -> c) -> (a -> b) -> a -> c
after f g = \x -> f (g x)
{-# INLINE to #-}
to :: (a -> b) -> a -> b
to f x = f x
{-# INLINE by #-}
by :: a -> (a -> b) -> b
by x f = f x
{-# INLINE flip #-}
flip :: (a -> b -> c) -> b -> a -> c
flip f x y = f y x
{-# INLINE constant #-}
constant :: a -> b -> a
constant x y = x
{-# INLINE (?) #-}
(?) = constant
{-# INLINE identity #-}
identity :: a -> a
identity x = x
{-# INLINE (.) #-}
(.) = after
{-# INLINE ($) #-}
($) = to
{-# INLINE (&) #-}
(&) = by
{-# INLINE (!) #-}
(!) = flip