Module

Data.Pair

This module defines a datatype Pair together with a few useful instances and helper functions. Note that this is not just Tuple a a but rather a list with exactly two elements. Specifically, the Functor instance maps over both values (in contrast to the Functor instance for Tuple a).

#Pair

data Pair a

A pair simply consists of two values of the same type.

Constructors

Instances

#(~)

Operator alias for Data.Pair.Pair (left-associative / precedence 6)

#fst

fst :: forall a. Pair a -> a

Returns the first component of a pair.

#snd

snd :: forall a. Pair a -> a

Returns the second component of a pair.

#curry

curry :: forall a b. (Pair a -> b) -> a -> a -> b

Turn a function that expects a pair into a function of two arguments.

#uncurry

uncurry :: forall a b. (a -> a -> b) -> Pair a -> b

Turn a function of two arguments into a function that expects a pair.

#swap

swap :: forall a. Pair a -> Pair a

Exchange the two components of the pair

Modules