]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Type/Ordering.hs
init
[haskell/symantic.git] / Language / Symantic / Type / Ordering.hs
1 {-# LANGUAGE FlexibleContexts #-}
2 {-# LANGUAGE GADTs #-}
3 {-# LANGUAGE MultiParamTypeClasses #-}
4 {-# LANGUAGE OverloadedStrings #-}
5 {-# LANGUAGE ScopedTypeVariables #-}
6 {-# LANGUAGE TypeFamilies #-}
7 {-# OPTIONS_GHC -fno-warn-missing-methods #-}
8 module Language.Symantic.Type.Ordering where
9
10 import Data.Maybe (isJust)
11 import Data.Type.Equality ((:~:)(Refl))
12
13 import Language.Symantic.Type.Common
14
15 -- * Type 'Type_Ordering'
16 -- | The 'Ordering' type.
17 data Type_Ordering (root:: * -> *) h where
18 Type_Ordering :: Type_Ordering root Ordering
19 type instance Root_of_Type (Type_Ordering root) = root
20 type instance Error_of_Type ast (Type_Ordering root) = No_Error_Type
21
22 instance Constraint_Type Ord (Type_Ordering root) where
23 constraint_type _c Type_Ordering = Just Dict
24
25 instance -- Eq_Type
26 Eq_Type (Type_Ordering root) where
27 eq_type Type_Ordering Type_Ordering = Just Refl
28 instance -- Eq
29 Eq (Type_Ordering root h) where
30 x == y = isJust $ x `eq_type` y
31 instance -- String_from_Type
32 String_from_Type (Type_Ordering root) where
33 string_from_type Type_Ordering = "Ordering"
34 instance -- Show
35 Show (Type_Ordering root h) where
36 show = string_from_type
37 instance Unlift_Type1 Type_Ordering
38 instance Eq_Type1 (Type_Ordering root)
39
40 -- | Convenient alias to include a 'Type_Ordering' within a type.
41 type_ordering :: Type_Root_Lift Type_Ordering root => root Ordering
42 type_ordering = type_root_lift Type_Ordering