camfort-1.0.1: CamFort - Cambridge Fortran infrastructure
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Fortran.Model.Util

Description

Miscellaneous combinators.

Synopsis
  • on2 :: (c -> d -> e) -> (a -> c) -> (b -> d) -> a -> b -> e
  • matchingWithBoth :: Monad m => (a -> b -> m c) -> (c -> m r) -> a -> b -> m r
  • matchingWith2 :: Monad m => (a -> m a') -> (b -> m b') -> ((a', b') -> m r) -> a -> b -> m r
  • altf :: Alternative f => (a -> f b) -> (a -> f b) -> a -> f b
  • altf2 :: Alternative f => (a -> b -> f c) -> (a -> b -> f c) -> a -> b -> f c
  • (<$$>) :: Functor f => f a -> (a -> b) -> f b
  • with :: a -> (a -> b) -> b
  • (*..) :: (a -> c -> d) -> (b -> c) -> a -> b -> d
  • (..*) :: (c -> d) -> (a -> b -> c) -> a -> b -> d

Documentation

on2 :: (c -> d -> e) -> (a -> c) -> (b -> d) -> a -> b -> e Source #

Like on, but apply a different function to each argument (which are allowed to have different types).

matchingWithBoth :: Monad m => (a -> b -> m c) -> (c -> m r) -> a -> b -> m r Source #

..* in the Kleisli category.

matchingWith2 :: Monad m => (a -> m a') -> (b -> m b') -> ((a', b') -> m r) -> a -> b -> m r Source #

on2 in the Kleisli category.

altf :: Alternative f => (a -> f b) -> (a -> f b) -> a -> f b Source #

Alternative (<|>) over single-argument functions.

altf2 :: Alternative f => (a -> b -> f c) -> (a -> b -> f c) -> a -> b -> f c Source #

Alternative (<|>) over two-argument functions.

(<$$>) :: Functor f => f a -> (a -> b) -> f b Source #

Flipped fmap.

with :: a -> (a -> b) -> b Source #

Flipped function application.

(*..) :: (a -> c -> d) -> (b -> c) -> a -> b -> d Source #

(f *.. g) x y = f x (g y). Mnemonic: the * is next to the function which has two arguments.

(..*) :: (c -> d) -> (a -> b -> c) -> a -> b -> d Source #

(f ..* g) x y = f (g x y). Mnemonic: the * is next to the function which has two arguments.