packages feed

FiniteCategories-0.1.0.0: src/Utils/Tuple.hs

{-| Module  : FiniteCategories
Description : Utilitary functions for tuples.
Copyright   : Guillaume Sabbagh 2021
License     : GPL-3
Maintainer  : guillaumesabbagh@protonmail.com
Stability   : experimental
Portability : portable

Utilitary functions for tuples.
-}

module Utils.Tuple
(
fst3,
snd3,
trd3,
uncurry3
)
where
    -- | Returns the first element of a triplet.
    fst3 :: (a,b,c) -> a
    fst3 (x,_,_) = x
    
    -- | Returns the second element of a triplet.
    snd3 :: (a,b,c) -> b
    snd3 (_,x,_) = x
    
    -- | Returns the third element of a triplet.
    trd3 :: (a,b,c) -> c
    trd3 (_,_,x) = x
    
    -- | Uncurry 3 arguments.
    uncurry3 :: (a -> b -> c -> d) -> (a,b,c) -> d
    uncurry3 f (a,b,c) = f a b c