Add colorable and decorable.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / IO.hs
index 6000d1754973697894f087fe797b3655c32f80a1..f041125aceb87ac281c2a480967f950345551b35 100644 (file)
@@ -52,30 +52,36 @@ instance (Sym_IO_Handle term, Sym_Lambda term) => Sym_IO_Handle (BetaT term)
 instance (Sym_IO_Mode term, Sym_Lambda term) => Sym_IO_Mode (BetaT term)
 
 -- Typing
+instance NameTyOf IO where
+       nameTyOf _c = ["IO"] `Mod` "IO"
+instance NameTyOf IO.Handle where
+       nameTyOf _c = ["IO"] `Mod` "Handle"
+instance NameTyOf IO.IOMode where
+       nameTyOf _c = ["IO"] `Mod` "IOMode"
 instance FixityOf IO
 instance ClassInstancesFor IO where
-       proveConstraintFor _ (TyApp _ (TyConst _ _ q) z)
+       proveConstraintFor _ (TyConst _ _ q :$ z)
         | Just HRefl <- proj_ConstKiTy @_ @IO z
         = case () of
                 _ | Just Refl <- proj_Const @Applicative q -> Just Dict
                   | Just Refl <- proj_Const @Functor     q -> Just Dict
                   | Just Refl <- proj_Const @Monad       q -> Just Dict
                 _ -> Nothing
-       proveConstraintFor _ (TyApp _ q (TyApp _ z _a))
+       proveConstraintFor _ (TyConst _ _ q :$ z:@_a)
         | Just HRefl <- proj_ConstKiTy @_ @IO z
         = case () of
-                _ | Just Refl <- proj_ConstTy @MT.MonoFunctor q -> Just Dict
+                _ | Just Refl <- proj_Const @MT.MonoFunctor q -> Just Dict
                 _ -> Nothing
        proveConstraintFor _c _q = Nothing
 instance ClassInstancesFor IO.Handle where
-       proveConstraintFor _ (TyApp _ q z)
+       proveConstraintFor _ (TyConst _ _ q :$ z)
         | Just HRefl <- proj_ConstKiTy @_ @IO.Handle z
         = case () of
-                _ | Just Refl <- proj_ConstTy @Eq q -> Just Dict
+                _ | Just Refl <- proj_Const @Eq q -> Just Dict
                 _ -> Nothing
        proveConstraintFor _c _q = Nothing
 instance ClassInstancesFor IO.IOMode where
-       proveConstraintFor _ (TyApp _ (TyConst _ _ q) c)
+       proveConstraintFor _ (TyConst _ _ q :$ c)
         | Just HRefl <- proj_ConstKiTy @_ @IO.IOMode c
         = case () of
                 _ | Just Refl <- proj_Const @Enum q -> Just Dict
@@ -84,7 +90,7 @@ instance ClassInstancesFor IO.IOMode where
                 _ -> Nothing
        proveConstraintFor _c _q = Nothing
 instance TypeInstancesFor IO where
-       expandFamFor _c _len f (TyApp _ z a `TypesS` TypesZ)
+       expandFamFor _c _len f (z:@a `TypesS` TypesZ)
         | Just HRefl <- proj_ConstKi @_ @Element f
         , Just HRefl <- proj_ConstKiTy @_ @IO z
         = Just a