Creates a tuple by pairing something with itself.
dup "foo"("foo","foo")dup ()((),())
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Modulerelude-1.2.0.0Haskell2010
SPDX-License-Identifier : MIT Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable
Contains utility functions for working with tuples.
Creates a tuple by pairing something with itself.
dup "foo"("foo","foo")dup ()((),())
Apply a function, with the result in the fst slot, and the value in the other.
A dual to toSnd.
toFst length [3, 1, 0, 2](4,[3,1,0,2])toFst (+5) 10(15,10)
Apply a function, with the result in the snd slot, and the value in the other.
A dual to toFst.
toSnd length [3, 1, 0, 2]([3,1,0,2],4)toSnd (+5) 10(10,15)
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.
A dual to traverseToSnd
traverseToFst (Just . (+1)) 10Just (11,10)traverseToFst (const Nothing) 10Nothing
Apply a function that returns a value inside of a functor, with the output in the second slot, the input in the first, and the entire tuple inside the functor.
A dual to traverseToFst.
traverseToSnd (Just . (+1)) 10Just (10,11)traverseToSnd (const Nothing) 10Nothing
Maps a function that returns a value inside of an applicative functor over both elements of a tuple, with the entire tuple inside the applicative functor.
traverseBoth (Just . ("Hello " <>)) ("Alice", "Bob")Just ("Hello Alice","Hello Bob")traverseBoth (const Nothing) ("Alice", "Bob")Nothing