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