{-# LANGUAGE LinearTypes #-}
{-# LANGUAGE NoImplicitPrelude #-}

-- | This module provides linear functions commonly used on tuples.
module Data.Tuple.Linear
  ( fst,
    snd,
    swap,
    curry,
    uncurry,
  )
where

import Data.Unrestricted.Linear.Internal.Consumable
import Prelude.Linear.Internal (curry, uncurry)

fst :: (Consumable b) => (a, b) %1 -> a
fst :: forall b a. Consumable b => (a, b) %1 -> a
fst (a
a, b
b) = forall a b. Consumable a => a %1 -> b %1 -> b
lseq b
b a
a

snd :: (Consumable a) => (a, b) %1 -> b
snd :: forall a b. Consumable a => (a, b) %1 -> b
snd (a
a, b
b) = forall a b. Consumable a => a %1 -> b %1 -> b
lseq a
a b
b

swap :: (a, b) %1 -> (b, a)
swap :: forall a b. (a, b) %1 -> (b, a)
swap (a
a, b
b) = (b
b, a
a)