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.

Implementation
data Prod A B = Σ A B

Pair :: * -> * -> *

Standard non-dependent product type.

Implementation
data 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.

Implementation
fst p = case p of
    Pair a b -> a

snd :: Pair A B -> B

Returns the second element of a pair.

Implementation
snd 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.

Implementation
curry f a b = f (Pair a b)

uncurry :: (A -> B -> C) -> Pair A B -> C

Converts a curried function to a function on pairs.

Implementation
uncurry f p = case p of
    Pair a b -> f a b