module Example import Data.Singleton import SOAS infixr 3 -:> -- Writing the descriptions directly is fine -- but deriving their functoriality and strength is annoying -- and not needed with enough metaprogramming %hide Syntax.PreorderReasoning.prefix.(|~) %hide Syntax.PreorderReasoning.Generic.prefix.(|~) data TypeSTLC = B | (-:>) TypeSTLC TypeSTLC data OpSTLC : TypeSTLC -> (TypeSTLC .Ctx, TypeSTLC).Ctx -> Type where App : OpSTLC ty2 [<"f" :- ([<], ty1 -:> ty2), "x" :- ([<], ty1)] Lam : OpSTLC (ty1 -:> ty2) [<"body" :- ([<"x" :- ty1], ty2)] STLC : TypeSTLC .Signature STLC = MkSig OpSTLC $ \case App => [ [ (B -:> B) -:> B) [<] Ex1 = Alg $ Op Lam [ Singleton (Alg $ Op App [<[] (Alg $ Op Lam [ STLC .Term Var ty2 ctx beta (Val $ Alg $ Op App [ ty2) ctx -> STLC .Term Var (ty1 -:> ty2) ctx eta t = Alg $ Op Lam [ B) [<] Ex2 = Alg $ Op App [<[] (Alg $ Op Lam [ B) [<] Ex3 = eta $ beta $ Val Ex2