| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
NumHask.Data.Pair
Description
A Pair is *the* classical higher-kinded number but there is no canon.
Documentation
A pair of a's, implemented as a tuple, but api represented as a Pair of a's.
>>>fmap (+1) (Pair 1 2)Pair 2 3>>>pure one :: Pair IntPair 1 1>>>(*) <$> Pair 1 2 <*> pure 2Pair 2 4>>>foldr (++) [] (Pair [1,2] [3])[1,2,3]>>>Pair "a" "pair" `mappend` pure " " `mappend` Pair "string" "mappended"Pair "a string" "pair mappended"
As a Ring and Field class
>>>Pair 0 1 + zeroPair 0 1>>>Pair 0 1 + Pair 2 3Pair 2 4>>>Pair 1 1 - onePair 0 0>>>Pair 0 1 * onePair 0 1>>>Pair 0.0 1.0 / onePair 0.0 1.0>>>Pair 11 12 `mod` (pure 6)Pair 5 0
As an action
>>>Pair 1 2 .+ 3Pair 4 5
Constructors
| Pair' (a, a) |