HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulecomposite-tuple-0.1.2.0Haskell2010

Composite.Record.Tuple

Tuple functions for composite records, inspired by relude.

  • 9 values
patternpattern (:|:) :: a -> b -> Record '[s :-> a, s' :-> b]
#

Pattern for a pair in a record

valuetoFst :: (a -> b) -> a -> Record '[s :-> b, s' :-> a]
#

Apply a function, with the result in the fst slot, and the value in the other.

valuetoSnd :: (a -> b) -> a -> Record '[s :-> a, s' :-> b]
#

Apply a function with the result in the snd slot, and the value in the other.

valuefmapToFst :: Functor f => (a -> b) -> f a -> f (Record '[s :-> b, s' :-> a])
#

Like fmap, but also keep the original value in the snd position.

valuefmapToSnd :: Functor f => (a -> b) -> f a -> f (Record '[s :-> a, s' :-> b])
#

Like fmap, but also keep the original value in the fst position.

valuetraverseToFst
  1. :: Functor m
  2. => a -> m b
  3. -> a
  4. -> m (Record '[s :-> b, s' :-> a])
#

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.

valuetraverseToSnd
  1. :: Functor m
  2. => a -> m b
  3. -> a
  4. -> m (Record '[s :-> a, s' :-> b])
#

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.

valuefanout :: (x -> a) -> (x -> b) -> x -> Record '[s :-> a, s' :-> b]
#

Apply two functions to a single value and store the results in each slot.

valuefanoutM
  1. :: Applicative m
  2. => x -> m a
  3. -> x -> m b
  4. -> x
  5. -> m (Record '[s :-> a, s' :-> b])
#

Apply two applicative functions to a single value and store the results in each slot.