{-# LANGUAGE TemplateHaskell, ScopedTypeVariables, DataKinds, PolyKinds,
RankNTypes, TypeFamilies, GADTs, UndecidableInstances #-}
module Data.Singletons.Prelude.Tuple (
Sing(STuple0, STuple2, STuple3, STuple4, STuple5, STuple6, STuple7),
STuple0, STuple2, STuple3, STuple4, STuple5, STuple6, STuple7,
Fst, sFst, Snd, sSnd, Curry, sCurry, Uncurry, sUncurry, Swap, sSwap,
Tuple0Sym0,
Tuple2Sym0, Tuple2Sym1, Tuple2Sym2,
Tuple3Sym0, Tuple3Sym1, Tuple3Sym2, Tuple3Sym3,
Tuple4Sym0, Tuple4Sym1, Tuple4Sym2, Tuple4Sym3, Tuple4Sym4,
Tuple5Sym0, Tuple5Sym1, Tuple5Sym2, Tuple5Sym3, Tuple5Sym4, Tuple5Sym5,
Tuple6Sym0, Tuple6Sym1, Tuple6Sym2, Tuple6Sym3, Tuple6Sym4, Tuple6Sym5, Tuple6Sym6,
Tuple7Sym0, Tuple7Sym1, Tuple7Sym2, Tuple7Sym3, Tuple7Sym4, Tuple7Sym5, Tuple7Sym6, Tuple7Sym7,
FstSym0, FstSym1, SndSym0, SndSym1,
CurrySym0, CurrySym1, CurrySym2, CurrySym3,
UncurrySym0, UncurrySym1, UncurrySym2,
SwapSym0, SwapSym1
) where
import Data.Singletons.Prelude.Instances
import Data.Singletons.Single
$(singletonsOnly [d|
fst :: (a,b) -> a
fst (x,_) = x
snd :: (a,b) -> b
snd (_,y) = y
curry :: ((a, b) -> c) -> a -> b -> c
curry f x y = f (x, y)
uncurry :: (a -> b -> c) -> ((a, b) -> c)
uncurry f p = f (fst p) (snd p)
swap :: (a,b) -> (b,a)
swap (a,b) = (b,a)
|])