5c374e85264e24ab30b91b6faab4c0b476a2111f
[packages/containers.git] / Utils / Containers / Internal / StrictPair.hs
1 {-# LANGUAGE CPP #-}
2 #if !defined(TESTING) && defined(__GLASGOW_HASKELL__)
3 {-# LANGUAGE Safe #-}
4 #endif
5
6 #include "containers.h"
7
8 -- | A strict pair
9
10 module Utils.Containers.Internal.StrictPair (StrictPair(..), toPair) where
11
12 -- | The same as a regular Haskell pair, but
13 --
14 -- @
15 -- (x :*: _|_) = (_|_ :*: y) = _|_
16 -- @
17 data StrictPair a b = !a :*: !b
18
19 infixr 1 :*:
20
21 -- | Convert a strict pair to a standard pair.
22 toPair :: StrictPair a b -> (a, b)
23 toPair (x :*: y) = (x, y)
24 {-# INLINE toPair #-}