Make stack flags customizable in GNUmakefile.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Char.hs
index 83e8b0edf5d01f551b2ce3de9183058f8b5b9f1d..74b319b5f83d8d017d7e1c239a8a4e7e97630110 100644 (file)
@@ -7,7 +7,7 @@ import qualified Data.Char as Char
 import qualified Data.Text as Text
 
 import Language.Symantic.Grammar hiding (char, any)
-import qualified Language.Symantic.Grammar as Gram
+import qualified Language.Symantic.Grammar as G
 import Language.Symantic
 import Language.Symantic.Lib.List (tyList)
 
@@ -45,6 +45,8 @@ instance (Sym_Char r1, Sym_Char r2) => Sym_Char (Dup r1 r2) where
 instance (Sym_Char term, Sym_Lambda term) => Sym_Char (BetaT term)
 
 -- Typing
+instance NameTyOf Char where
+       nameTyOf _c = ["Char"] `Mod` "Char"
 instance ClassInstancesFor Char where
        proveConstraintFor _ (TyApp _ (TyConst _ _ q) z)
         | Just HRefl <- proj_ConstKiTy @_ @Char z
@@ -64,35 +66,35 @@ instance
  , Gram_Alt g
  , Gram_Rule g
  , Gram_Comment g
- , Inj_Sym ss Char
+ , SymInj ss Char
  ) => Gram_Term_AtomsFor src ss g Char where
        g_term_atomsFor =
         [ rule "teChar" $
-               lexeme $ g_source $
+               lexeme $ source $
                (\c src -> BinTree0 $ Token_Term $ TermAVT $ (`setSource` src) $ teChar c)
                 <$> between tickG tickG (
-                       cf_of_Terminal (Gram.any `but` tickG) <+>
+                       cfOf (G.any `but` tickG) <+>
                        '\'' <$ string "\\'"
                 )
         ]
                where
                tickG :: Gram_Terminal g' => g' Char
-               tickG = Gram.char '\''
-instance (Source src, Inj_Sym ss Char) => ModuleFor src ss Char where
+               tickG = G.char '\''
+instance (Source src, SymInj ss Char) => ModuleFor src ss Char where
        moduleFor = ["Char"] `moduleWhere`
         [ "toLower" := teChar_toLower
         , "toUpper" := teChar_toUpper
         ]
 
 -- ** 'Type's
-tyChar :: Source src => Inj_Len vs => Type src vs Char
+tyChar :: Source src => LenInj vs => Type src vs Char
 tyChar = tyConst @(K Char) @Char
 
-tyString :: Source src => Inj_Len vs => Type src vs String
+tyString :: Source src => LenInj vs => Type src vs String
 tyString = tyList tyChar
 
 -- ** 'Term's
-teChar :: Source src => Inj_Sym ss Char => Char -> Term src ss ts '[] (() #> Char)
+teChar :: Source src => SymInj ss Char => Char -> Term src ss ts '[] (() #> Char)
 teChar b = Term noConstraint tyChar $ teSym @Char $ char b
 
 teChar_toUpper, teChar_toLower :: TermDef Char '[] (() #> (Char -> Char))