Module

Data.Pair

Package
purescript-pairs
Repository
sharkdp/purescript-pairs

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 Source

data Pair a

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

Constructors

Instances

#(~) Source

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

#fst Source

fst :: forall a. Pair a -> a

Returns the first component of a pair.

#snd Source

snd :: forall a. Pair a -> a

Returns the second component of a pair.

#curry Source

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

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

#uncurry Source

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

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

#swap Source

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

Exchange the two components of the pair

Modules
Data.Pair