]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Type/Text.hs
Repr_Dup helpers
[haskell/symantic.git] / Language / Symantic / Type / Text.hs
1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE FlexibleInstances #-}
3 {-# LANGUAGE MultiParamTypeClasses #-}
4 {-# LANGUAGE PatternSynonyms #-}
5 {-# LANGUAGE ScopedTypeVariables #-}
6 {-# LANGUAGE TypeFamilies #-}
7 {-# LANGUAGE UndecidableInstances #-}
8 {-# OPTIONS_GHC -fno-warn-orphans #-}
9 module Language.Symantic.Type.Text where
10
11 import qualified Data.MonoTraversable as MT
12 import Data.Proxy
13 import Data.Text (Text)
14
15 import Language.Symantic.Type.Root
16 import Language.Symantic.Type.Type0
17 import Language.Symantic.Type.Constraint
18 import Language.Symantic.Type.Family
19
20 -- * Type 'Type_Text'
21 -- | The 'Text' type.
22 type Type_Text = Type0 (Proxy Text)
23
24 pattern Type_Text :: Type0 (Proxy Text) root Text
25 pattern Type_Text = Type0 Proxy
26
27 instance Type0_Constraint Eq (Type_Text root) where
28 type0_constraint _c Type0{} = Just Dict
29 instance Type0_Constraint Ord (Type_Text root) where
30 type0_constraint _c Type0{} = Just Dict
31 instance Type0_Constraint Monoid (Type_Text root) where
32 type0_constraint _c Type0{} = Just Dict
33 instance Type0_Constraint Num (Type_Text root)
34 instance Type0_Constraint Integral (Type_Text root)
35 instance Type_Root_Lift (Type0 (Proxy (MT.Element Text))) root =>
36 Type0_Family Type_Family_MonoElement (Type_Text root) where
37 type0_family _at Type0{} = Just type0
38 instance Type0_Constraint MT.MonoFunctor (Type_Text root) where
39 type0_constraint _c Type0{} = Just Dict
40 instance -- String_from_Type
41 String_from_Type (Type_Text root) where
42 string_from_type _ = "Text"
43
44 -- | Inject 'Type_Text' within a root type.
45 type_text :: Type_Root_Lift Type_Text root => root Text
46 type_text = type0