import Language.Symantic.Lib.Functor (f2)
-- * Class 'Sym_Traversable'
-type instance Sym (Proxy Traversable) = Sym_Traversable
+type instance Sym Traversable = Sym_Traversable
class Sym_Traversable term where
traverse :: Traversable t => Applicative f => term (a -> f b) -> term (t a) -> term (f (t b))
default traverse :: Sym_Traversable (UnT term) => Trans term => Traversable t => Applicative f => term (a -> f b) -> term (t a) -> term (f (t b))
instance (Sym_Traversable term, Sym_Lambda term) => Sym_Traversable (BetaT term)
-- Typing
+instance NameTyOf Traversable where
+ nameTyOf _c = ["Traversable"] `Mod` "Traversable"
instance FixityOf Traversable
instance ClassInstancesFor Traversable
instance TypeInstancesFor Traversable
-- Compiling
instance Gram_Term_AtomsFor src ss g Traversable
-instance (Source src, Inj_Sym ss Traversable) => Module src ss Traversable where
- module_ _s = [] `moduleWhere`
+instance (Source src, SymInj ss Traversable) => ModuleFor src ss Traversable where
+ moduleFor = ["Traversable"] `moduleWhere`
[ "traverse" := teTraversable_traverse
]
teTraversable_traverse :: TermDef Traversable '[Proxy a, Proxy b, Proxy f, Proxy t] (Traversable t # Applicative f #> ((a -> f b) -> t a -> f (t b)))
teTraversable_traverse = Term (tyTraversable t # tyApplicative f2) ((a0 ~> f2 `tyApp` b1) ~> t `tyApp` a0 ~> f2 `tyApp` (t `tyApp` b1)) $ teSym @Traversable $ lam2 traverse
where
- t :: Source src => Inj_Len vs => Inj_Kind (K t) => Type src (Proxy a ': Proxy b ': Proxy c ': Proxy t ': vs) t
+ t :: Source src => LenInj vs => KindInj (K t) => Type src (Proxy a ': Proxy b ': Proxy c ': Proxy t ': vs) t
t = tyVar "t" $ VarS $ VarS $ VarS varZ