-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Tuple functions for composite records. -- -- Tuple functions for composite records. @package composite-tuple @version 0.1.2.0 -- | Tuple functions for composite records, inspired by relude. module Composite.Record.Tuple -- | Put a single value in a record. singleton :: a -> Record ((s :-> a) : '[]) -- | Pattern for a pair in a record pattern (:|:) :: a -> b -> Record ((s :-> a) : ((s' :-> b) : '[])) -- | Apply a function, with the result in the fst slot, and the value in -- the other. toFst :: (a -> b) -> a -> Record ((s :-> b) : ((s' :-> a) : '[])) -- | Apply a function with the result in the snd slot, and the value in the -- other. toSnd :: (a -> b) -> a -> Record ((s :-> a) : ((s' :-> b) : '[])) -- | Like fmap, but also keep the original value in the snd position. fmapToFst :: Functor f => (a -> b) -> f a -> f (Record ((s :-> b) : ((s' :-> a) : '[]))) -- | Like fmap, but also keep the original value in the fst position. fmapToSnd :: Functor f => (a -> b) -> f a -> f (Record ((s :-> a) : ((s' :-> b) : '[]))) -- | Apply a function that returns a value inside of a functor, with the -- output in the first slot, the input in the second, and the entire -- tuple inside the functor. traverseToFst :: Functor m => (a -> m b) -> a -> m (Record ((s :-> b) : ((s' :-> a) : '[]))) -- | Apply a function that returns a value inside of a functor, with the -- output in the second slot, the input in the fist, and the entire tuple -- inside the functor. traverseToSnd :: Functor m => (a -> m b) -> a -> m (Record ((s :-> a) : ((s' :-> b) : '[]))) -- | Apply two functions to a single value and store the results in each -- slot. fanout :: (x -> a) -> (x -> b) -> x -> Record ((s :-> a) : ((s' :-> b) : '[])) -- | Apply two applicative functions to a single value and store the -- results in each slot. fanoutM :: Applicative m => (x -> m a) -> (x -> m b) -> x -> m (Record ((s :-> a) : ((s' :-> b) : '[])))