{-# LANGUAGE Haskell2010, Safe #-} {-# OPTIONS -Wall #-} -- | -- Module : Haskell.X.Ops -- Copyright : (c) Julian Fleischer 2013 -- License : MIT (See LICENSE file in cabal package) -- -- Maintainer : julian.fleischer@fu-berlin.de -- Stability : provisional -- Portability : portable -- -- Haskell extra operators. Do not import qualified. module Haskell.X.Ops ( (->>), (=>>), (|>), (<$>) ) where import Prelude import Data.Functor -- | @flip ($)@, fixity is @infixl 1@ (like @>>=@ but for non-monadic functions) (->>) :: a -> (a -> b) -> b (->>) = flip ($) infixl 1 ->> -- | Like @->>@, but wraps its result so that it can be used in a monad. -- Fixity is @infixl 1@. (=>>) :: Monad m => a -> (a -> b) -> m b x =>> f = return (f x) infixl 1 =>> -- | @flip (.)@, fixity is @infixl 9@ (same as for @.@), from F#. (|>) :: (a -> b) -> (b -> c) -> (a -> c) (|>) = flip (.) infixl 9 |>