License | MIT |
---|---|
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Tuple functions for composite records, inspired by relude.
Synopsis
- singleton :: a -> Record ((s :-> a) ': '[])
- pattern (:|:) :: a -> b -> Record ((s :-> a) ': ((s' :-> b) ': '[]))
- toFst :: (a -> b) -> a -> Record ((s :-> b) ': ((s' :-> a) ': '[]))
- toSnd :: (a -> b) -> a -> Record ((s :-> a) ': ((s' :-> b) ': '[]))
- fmapToFst :: Functor f => (a -> b) -> f a -> f (Record ((s :-> b) ': ((s' :-> a) ': '[])))
- fmapToSnd :: Functor f => (a -> b) -> f a -> f (Record ((s :-> a) ': ((s' :-> b) ': '[])))
- traverseToFst :: Functor m => (a -> m b) -> a -> m (Record ((s :-> b) ': ((s' :-> a) ': '[])))
- traverseToSnd :: Functor m => (a -> m b) -> a -> m (Record ((s :-> a) ': ((s' :-> b) ': '[])))
- fanout :: (x -> a) -> (x -> b) -> x -> Record ((s :-> a) ': ((s' :-> b) ': '[]))
- fanoutM :: Applicative m => (x -> m a) -> (x -> m b) -> x -> m (Record ((s :-> a) ': ((s' :-> b) ': '[])))
Documentation
pattern (:|:) :: a -> b -> Record ((s :-> a) ': ((s' :-> b) ': '[])) Source #
Pattern for a pair in a record
toFst :: (a -> b) -> a -> Record ((s :-> b) ': ((s' :-> a) ': '[])) Source #
Apply a function, with the result in the fst slot, and the value in the other.
toSnd :: (a -> b) -> a -> Record ((s :-> a) ': ((s' :-> b) ': '[])) Source #
Apply a function with the result in the snd slot, and the value in the other.
fmapToFst :: Functor f => (a -> b) -> f a -> f (Record ((s :-> b) ': ((s' :-> a) ': '[]))) Source #
Like fmap, but also keep the original value in the snd position.
fmapToSnd :: Functor f => (a -> b) -> f a -> f (Record ((s :-> a) ': ((s' :-> b) ': '[]))) Source #
Like fmap, but also keep the original value in the fst position.
traverseToFst :: Functor m => (a -> m b) -> a -> m (Record ((s :-> b) ': ((s' :-> a) ': '[]))) Source #
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.
traverseToSnd :: Functor m => (a -> m b) -> a -> m (Record ((s :-> a) ': ((s' :-> b) ': '[]))) Source #
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.