fst package:relude

Extract the first component of a pair.
Returns first element of tuple type (with kind *) or type-level tuple (with kind (k1, k2), marked by prefix quote).
>>> :kind! Maybe (Fst '(Int, Text))
Maybe (Fst '(Int, Text)) :: *
= Maybe Int
>>> :kind! Maybe (Fst (Int, Text))
Maybe (Fst (Int, Text)) :: *
= Maybe Int
Like fmap, but also keep the original value in the snd position. A dual to fmapToSnd.
>>> fmapToFst show [3, 10, 2]
[("3",3),("10",10),("2",2)]
Deprecated: Use toFst from Tuple instead
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 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)) 10
Just (11,10)

>>> traverseToFst (const Nothing) 10
Nothing