{-| 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 :: forall a b c. (a, b, c) -> a fst3 (a x,b _,c _) = a x -- | Returns the second element of a triplet. snd3 :: (a,b,c) -> b snd3 :: forall a b c. (a, b, c) -> b snd3 (a _,b x,c _) = b x -- | Returns the third element of a triplet. trd3 :: (a,b,c) -> c trd3 :: forall a b c. (a, b, c) -> c trd3 (a _,b _,c x) = c x -- | Uncurry 3 arguments. uncurry3 :: (a -> b -> c -> d) -> (a,b,c) -> d uncurry3 :: forall a b c d. (a -> b -> c -> d) -> (a, b, c) -> d uncurry3 a -> b -> c -> d f (a a,b b,c c) = a -> b -> c -> d f a a b b c c