import Language.Symantic.Lib.Function (a0, b1, c2)
-- * Class 'Sym_Either'
-type instance Sym (Proxy Either) = Sym_Either
+type instance Sym Either = Sym_Either
class Sym_Either term where
_Left :: term l -> term (Either l r)
_Right :: term r -> term (Either l r)
instance (Sym_Either term, Sym_Lambda term) => Sym_Either (BetaT term)
-- Typing
+instance NameTyOf Either where
+ nameTyOf _c = ["Either"] `Mod` "Either"
instance FixityOf Either
instance ClassInstancesFor Either where
- proveConstraintFor _ (TyApp _ (TyConst _ _ q) (TyApp _ c _l))
- | Just HRefl <- proj_ConstKiTy @_ @Either c
+ proveConstraintFor _ (TyConst _ _ q :$ e:@_l)
+ | Just HRefl <- proj_ConstKiTy @_ @Either e
= case () of
_ | Just Refl <- proj_Const @Functor q -> Just Dict
| Just Refl <- proj_Const @Applicative q -> Just Dict
| Just Refl <- proj_Const @Foldable q -> Just Dict
| Just Refl <- proj_Const @Traversable q -> Just Dict
_ -> Nothing
- proveConstraintFor _ (TyApp _ tq@(TyConst _ _ q) (TyApp _ (TyApp _ c l) r))
- | Just HRefl <- proj_ConstKiTy @_ @Either c
+ proveConstraintFor _ (tq@(TyConst _ _ q) :$ e:@l:@r)
+ | Just HRefl <- proj_ConstKiTy @_ @Either e
= case () of
_ | Just Refl <- proj_Const @Eq q
- , Just Dict <- proveConstraint (tq `tyApp` l)
- , Just Dict <- proveConstraint (tq `tyApp` r) -> Just Dict
+ , Just Dict <- proveConstraint (tq`tyApp`l)
+ , Just Dict <- proveConstraint (tq`tyApp`r) -> Just Dict
| Just Refl <- proj_Const @Ord q
- , Just Dict <- proveConstraint (tq `tyApp` l)
- , Just Dict <- proveConstraint (tq `tyApp` r) -> Just Dict
+ , Just Dict <- proveConstraint (tq`tyApp`l)
+ , Just Dict <- proveConstraint (tq`tyApp`r) -> Just Dict
| Just Refl <- proj_Const @Show q
- , Just Dict <- proveConstraint (tq `tyApp` l)
- , Just Dict <- proveConstraint (tq `tyApp` r) -> Just Dict
+ , Just Dict <- proveConstraint (tq`tyApp`l)
+ , Just Dict <- proveConstraint (tq`tyApp`r) -> Just Dict
| Just Refl <- proj_Const @MT.MonoFoldable q -> Just Dict
| Just Refl <- proj_Const @MT.MonoFunctor q -> Just Dict
_ -> Nothing
proveConstraintFor _c _q = Nothing
instance TypeInstancesFor Either where
- expandFamFor _c _len f (TyApp _ (TyApp _ c _ty_l) r `TypesS` TypesZ)
+ expandFamFor _c _len f (e:@_ty_l:@r `TypesS` TypesZ)
| Just HRefl <- proj_ConstKi @_ @Element f
- , Just HRefl <- proj_ConstKiTy @_ @Either c
+ , Just HRefl <- proj_ConstKiTy @_ @Either e
= Just r
expandFamFor _c _len _fam _as = Nothing
-- Compiling
instance Gram_Term_AtomsFor src ss g Either
-instance (Source src, Inj_Sym ss Either) => ModuleFor src ss Either where
+instance (Source src, SymInj ss Either) => ModuleFor src ss Either where
moduleFor = ["Either"] `moduleWhere`
[ "Left" := teEither_Left
, "Right" := teEither_Right