Data.Prod
v11.3.15 • Product Types
Generic product types (pairs).
Types
Prod :: * -> * -> *
The sigma type (dependent pair), representing a tuple where the second type can depend on the first value.
Implementationdata Prod A B = Σ A B
Pair :: * -> * -> *
Standard non-dependent product type.
Implementationdata Pair A B = Pair A B
Foreigns
No foreign functions defined in this module.
Functions
fst :: Pair A B -> A
Returns the first element of a pair.
Implementationfst p = case p of
Pair a b -> a
snd :: Pair A B -> B
Returns the second element of a pair.
Implementationsnd p = case p of
Pair a b -> b
curry :: (Pair A B -> C) -> A -> B -> C
Converts a function on pairs to a curried function.
Implementationcurry f a b = f (Pair a b)
uncurry :: (A -> B -> C) -> Pair A B -> C
Converts a curried function to a function on pairs.
Implementationuncurry f p = case p of
Pair a b -> f a b