uniform-pair-0.1.7: Uniform pairs with class instances

Copyright(c) 2013 Tabula, Inc.
Maintainerconal@conal.net
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.UniformPair

Description

Uniform pairs. Because these pairs memoize functions (from Bool)--i.e., they're representable functors--these instances provided are fully determined by the corresponding instances for functions, thanks to the type class morphism principle.

Synopsis

Documentation

data Pair a Source

Uniform pairs

Constructors

a :# a infix 1 

Instances

fstP :: Pair a -> a Source

sndP :: Pair a -> a Source

firstP :: (a -> a) -> Pair a -> Pair a Source

secondP :: (a -> a) -> Pair a -> Pair a Source

getP :: Bool -> Pair a -> a Source

Extract an element, indexing by False for the first element and True for the second.

onElemP :: Bool -> (a -> a) -> Pair a -> Pair a Source

Update a component, indexing by False for the first element and True for the second.

compareSwap :: Ord a => Pair a -> Pair a Source