]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Type/Tuple.hs
init
[haskell/symantic.git] / Language / Symantic / Type / Tuple.hs
1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE FlexibleInstances #-}
3 {-# LANGUAGE PatternSynonyms #-}
4 {-# LANGUAGE ScopedTypeVariables #-}
5 {-# LANGUAGE TypeFamilies #-}
6 {-# OPTIONS_GHC -fno-warn-orphans #-}
7 module Language.Symantic.Type.Tuple where
8
9 import Data.Proxy
10
11 import Language.Symantic.Type.Common
12
13 -- * Type 'Type_Tuple2'
14 -- | The (,) type.
15 type Type_Tuple2
16 = Type_Type2 Constraint2_Empty (,)
17 pattern Type_Tuple2 arg res
18 = Type_Type2 Proxy Proxy arg res
19
20 instance -- String_from_Type
21 String_from_Type root =>
22 String_from_Type (Type_Tuple2 root) where
23 string_from_type (Type_Type2 _ _ a b) =
24 "(" ++ string_from_type a ++
25 ", " ++ string_from_type b ++ ")"
26
27 -- | Convenient alias to include a 'Type_Tuple2' within a type.
28 type_tuple2
29 :: forall root h_a h_b.
30 Lift_Type_Root Type_Tuple2 root
31 => root h_a
32 -> root h_b
33 -> root (h_a, h_b)
34 type_tuple2 a b = lift_type_root (Type_Tuple2 a b
35 ::Type_Tuple2 root (h_a, h_b))