{-# LANGUAGE TemplateHaskell #-}

-- | Construction and elimination of tuples

module Language.Syntactic.Functional.Tuple where



import Language.Syntactic
import Language.Syntactic.TH
import Language.Syntactic.Functional



data Tuple a
  where
    Pair :: Tuple (a :-> b :-> Full (a,b))
    Fst  :: Tuple ((a,b) :-> Full a)
    Snd  :: Tuple ((a,b) :-> Full b)

deriveSymbol    ''Tuple
deriveEquality  ''Tuple
deriveRender id ''Tuple

instance StringTree Tuple

instance Eval Tuple
  where
    evalSym :: Tuple sig -> Denotation sig
evalSym Tuple sig
Pair = (,)
    evalSym Tuple sig
Fst  = Denotation sig
forall a b. (a, b) -> a
fst
    evalSym Tuple sig
Snd  = Denotation sig
forall a b. (a, b) -> b
snd

instance EvalEnv Tuple env