{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Language.Symantic.Type.Tuple where import Data.Proxy import Language.Symantic.Type.Root import Language.Symantic.Type.Type0 import Language.Symantic.Type.Type2 -- * Type 'Type_Tuple2' -- | The @(,)@ type. type Type_Tuple2 = Type_Type2 (Proxy (,)) type instance Constraint2_of (Proxy (,)) = Constraint2_Empty pattern Type_Tuple2 :: root a -> root b -> Type_Tuple2 root ((,) a b) pattern Type_Tuple2 a b = Type_Type2 Proxy a b instance -- String_from_Type String_from_Type root => String_from_Type (Type_Tuple2 root) where string_from_type (Type_Type2 _ a b) = "(" ++ string_from_type a ++ ", " ++ string_from_type b ++ ")" -- | Inject 'Type_Tuple2' within a root type. type_tuple2 :: forall root h_a h_b. Lift_Type_Root Type_Tuple2 root => root h_a -> root h_b -> root (h_a, h_b) type_tuple2 a b = lift_type_root (Type_Tuple2 a b ::Type_Tuple2 root (h_a, h_b))