module Data.RangeMin.Common.Combinators (when, unless, on, (<$>), (.:), uncurry', liftM, liftM2, liftM3) where

-- import Data.Functor
import Control.Monad

{-# INLINE on #-}
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
(f `on` g) x y = f (g x) (g y)

{-# INLINE (<$>) #-}
(<$>) :: Functor f => (a -> b) -> f a -> f b
(<$>) = fmap

{-# INLINE (.:) #-}
(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
(f .: g) a b = f (g a b)

uncurry' :: (a -> b -> c) -> (a, b) -> c
uncurry' f (a, b) = f a b