From 8170945b5d8336cb980c1487adb354d91f3ea115 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Tue, 16 Apr 2024 13:50:21 +0300 Subject: [PATCH 01/53] wip --- deptycheck.ipkg | 1 + src/Deriving/DepTyCheck/Util/Fusion.idr | 178 ++++++++++++++++++ tests/Tests.idr | 1 + .../matcher/008 non-shared var/DerivedGen.idr | 17 ++ .../matcher/008 non-shared var/derive.ipkg | 1 + .../matcher/008 non-shared var/expected | 11 ++ .../fusion/matcher/008 non-shared var/run | 1 + .../merger/001 one var match/DerivedGen.idr | 17 ++ .../merger/001 one var match/derive.ipkg | 1 + .../fusion/merger/001 one var match/expected | 7 + .../utils/fusion/merger/001 one var match/run | 1 + .../002 two var ordered match/DerivedGen.idr | 17 ++ .../002 two var ordered match/derive.ipkg | 1 + .../merger/002 two var ordered match/expected | 9 + .../merger/002 two var ordered match/run | 1 + .../DerivedGen.idr | 17 ++ .../003 two var unordered match/derive.ipkg | 1 + .../003 two var unordered match/expected | 9 + .../merger/003 two var unordered match/run | 1 + .../merger/004 var-const match/DerivedGen.idr | 17 ++ .../merger/004 var-const match/derive.ipkg | 1 + .../merger/004 var-const match/expected | 10 + .../fusion/merger/004 var-const match/run | 1 + .../005 const-const match/DerivedGen.idr | 17 ++ .../merger/005 const-const match/derive.ipkg | 1 + .../merger/005 const-const match/expected | 10 + .../fusion/merger/005 const-const match/run | 1 + .../006 const-const no match/DerivedGen.idr | 17 ++ .../006 const-const no match/derive.ipkg | 1 + .../merger/006 const-const no match/expected | 7 + .../merger/006 const-const no match/run | 1 + .../merger/007 prim-prim match/DerivedGen.idr | 17 ++ .../merger/007 prim-prim match/derive.ipkg | 1 + .../merger/007 prim-prim match/expected | 7 + .../fusion/merger/007 prim-prim match/run | 1 + .../utils/fusion/merger/_common/derive.ipkg | 7 + .../utils/fusion/merger/_common/run | 8 + 37 files changed, 417 insertions(+) create mode 100644 src/Deriving/DepTyCheck/Util/Fusion.idr create mode 100644 tests/derivation/utils/fusion/matcher/008 non-shared var/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/matcher/008 non-shared var/derive.ipkg create mode 100644 tests/derivation/utils/fusion/matcher/008 non-shared var/expected create mode 120000 tests/derivation/utils/fusion/matcher/008 non-shared var/run create mode 100644 tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/001 one var match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/001 one var match/expected create mode 120000 tests/derivation/utils/fusion/merger/001 one var match/run create mode 100644 tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/002 two var ordered match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/002 two var ordered match/expected create mode 120000 tests/derivation/utils/fusion/merger/002 two var ordered match/run create mode 100644 tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/003 two var unordered match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/003 two var unordered match/expected create mode 120000 tests/derivation/utils/fusion/merger/003 two var unordered match/run create mode 100644 tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/004 var-const match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/004 var-const match/expected create mode 120000 tests/derivation/utils/fusion/merger/004 var-const match/run create mode 100644 tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/005 const-const match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/005 const-const match/expected create mode 120000 tests/derivation/utils/fusion/merger/005 const-const match/run create mode 100644 tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/006 const-const no match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/006 const-const no match/expected create mode 120000 tests/derivation/utils/fusion/merger/006 const-const no match/run create mode 100644 tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/007 prim-prim match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/007 prim-prim match/expected create mode 120000 tests/derivation/utils/fusion/merger/007 prim-prim match/run create mode 100644 tests/derivation/utils/fusion/merger/_common/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/_common/run diff --git a/deptycheck.ipkg b/deptycheck.ipkg index f2fde31c1..f4c05ea76 100644 --- a/deptycheck.ipkg +++ b/deptycheck.ipkg @@ -20,6 +20,7 @@ modules = Deriving.DepTyCheck , Deriving.DepTyCheck.Gen.Core.ConsEntry , Deriving.DepTyCheck.Gen.Core.Util , Deriving.DepTyCheck.Gen.Checked + , Deriving.DepTyCheck.Util.Fusion , Deriving.DepTyCheck.Util.Logging , Deriving.DepTyCheck.Util.Reflection , Language.Reflection.Compat diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr new file mode 100644 index 000000000..9f5135d45 --- /dev/null +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -0,0 +1,178 @@ +module Deriving.DepTyCheck.Util.Fusion + +import Language.Reflection +import Language.Reflection.TTImp +import Language.Reflection.Derive +import Language.Reflection.Pretty +import Language.Reflection.Compat +import Deriving.DepTyCheck.Util.Reflection + +%default total + +matchArgs : List Arg -> List Name -> Maybe (List (Name, TTImp)) +matchArgs na la = if length na == length la then Just (zip la (map (.type) na)) else Nothing + + +buildIPi : List (Name, TTImp) -> TTImp +buildIPi l = piAll type (map (\(n, tti) => MkArg MW ExplicitArg (Just n) tti) l) +-- buildIPi l = buildIPiInner (reverse l) (type) where +-- buildIPiInner : List (Name, TTImp) -> TTImp -> TTImp +-- buildIPiInner [] res = res +-- buildIPiInner ((n, tt)::xs) res = buildIPiInner xs (IPi EmptyFC MW ExplicitArg (Just n) tt res) + + +unifyArgs : TTImp -> TTImp -> Name -> TTImp +unifyArgs (IVar _ _) (IVar _ _) n = bindVar (show n) -- unifyArgs (IVar n) (IVar Prelude.Types.Z) should be Z +unifyArgs l@(IApp _ _ _) (IVar _ _) _ = l +unifyArgs (IVar _ _) r@(IApp _ _ _) _ = r +unifyArgs l@(IApp _ _ _) r@(IApp _ _ _) _ = if l == r then l else type +unifyArgs l@(IPrimVal _ _) (IVar _ _) _ = l +unifyArgs (IVar _ _) r@(IPrimVal _ _) _ = r +unifyArgs l@(IPrimVal _ _) r@(IPrimVal _ _) _ = if l == r then l else type +unifyArgs _ _ _ = type -- others TTImp to add? + + +processArg : TTImp -> Name -> TTImp +processArg (IVar _ (UN (Basic _))) n = bindVar (show n) +processArg smth _ = smth + + +alignArgs : List (Name, TTImp) -> List (Name, TTImp) -> List Name -> List TTImp +alignArgs xs ys zs = reverse $ alignArgsInner [] xs ys zs where + alignArgsInner : List TTImp -> List (Name, TTImp) -> List (Name, TTImp) -> List Name -> List TTImp + alignArgsInner res _ _ [] = res + alignArgsInner res ((xn, xt)::xs) ((yn, yt)::ys) (zn::zs) = case (xn == zn, yn == zn) of + (True , True ) => alignArgsInner ((unifyArgs xt yt zn)::res) xs ys zs + (True , False) => alignArgsInner ((processArg xt zn)::res) xs ((yn, yt)::ys) zs + (False, True ) => alignArgsInner ((processArg yt zn)::res) ((xn, xt)::xs) ys zs + (False, False) => [var zn] + alignArgsInner res ((xn, xt)::xs) [] (zn::zs) = case (xn == zn) of + True => alignArgsInner ((processArg xt zn)::res) xs [] zs + False => [var zn] + alignArgsInner res [] ((yn, yt)::ys) (zn::zs) = case (yn == zn) of + True => alignArgsInner ((processArg yt zn)::res) [] ys zs + False => [var zn] + alignArgsInner res [] [] (zn::zs) = [var zn] + + +fuseConstrucror : List Name -> (Con, List Name, Con, List Name) -> List (Name, List TTImp) +fuseConstrucror zl (xc, xl, yc, yl) = do + let + xName = xc.name + yName = yc.name + xyName = joinBy "_" [nameStr xName, nameStr yName] + + xType = xc.type + yType = yc.type + + (_, xApps) = Reflection.unAppAny xType + (_, yApps) = Reflection.unAppAny yType + + xArgs = map getExpr xApps + yArgs = map getExpr yApps + + xArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip xl xArgs + yArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip yl yArgs + + xyAligned = alignArgs xArgsZipped yArgsZipped zl + correctlyAligned = (==) 0 $ length $ Prelude.List.filter (\xy => xy == (type)) xyAligned + + if correctlyAligned then [(UN (Basic xyName), xyAligned)] else [] + + +foldConstructor : TTImp -> List TTImp -> TTImp +foldConstructor res [] = res +foldConstructor res (t::ts) = foldConstructor (app res t) ts + + +deriveFusion : List (TypeInfo, List Name) -> (List Decl, List Name) +deriveFusion l = let + typeNames = map (\(n, _) => nameStr n.name) l + fusionTypeName = UN (Basic $ joinBy "" typeNames) + + typeArgs = map (\(ti, la) => matchArgs ti.args la) l + typeArgsDefault = map (\ta => case ta of {Just x => x; _ => []}) typeArgs -- should finish with error if any is Nothing + checkArgs = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ join typeArgsDefault + uniqueArgs = nub checkArgs -- argument types should be same in every type + + uniqueNames = nub $ sort $ join $ map (\(_, la) => la) l + -- uniqueNames = map (\(n, _) => n) uniqueArgs + + correctDecl = (length uniqueArgs) == (length uniqueNames) + typeSignature = buildIPi uniqueArgs + consProduct = [ (xc, xl, yc, yl) | (xt, xl) <- l, (yt, yl) <- l, xt.name < yt.name, xc <- xt.cons, yc <- yt.cons] + + preCons = join $ map (fuseConstrucror uniqueNames) consProduct + fusedCons = map (\(cn, lt) => mkTy cn (foldConstructor (var fusionTypeName) lt)) preCons + + in if correctDecl then ([ iData Export fusionTypeName typeSignature [] fusedCons ], uniqueNames) else ([], []) + + +buildConFromOther : TTImp -> List (Name, TTImp) -> List Name -> TTImp +buildConFromOther res _ [] = res +buildConFromOther res la (n::ns) = do + let ma = find (\(na, _) => na == n) la + case ma of {Nothing => type; Just (_, tt) => buildConFromOther (app res tt) la ns} + + +splitFusion : List ITy -> List Name -> List Name -> List Name -> List (ITy, ITy) +-- splitFusion (IData _ _ _ _ (MkData _ _ _ _ cons)) un xn yn = +splitFusion cs un xn yn = map (splitInner un xn yn) cs where + splitInner : List Name -> List Name -> List Name -> ITy -> (ITy, ITy) + splitInner un xn yn (MkTy _ _ cn ct) = do + let cs = split ((==) '_') (nameStr cn) + let xcn = UN $ Basic $ head cs + let ycn = UN $ Basic $ last cs + let (_, args) = unApp ct + let zipped = zip un args + let xc = mkTy xcn (buildConFromOther type zipped xn) + let yc = mkTy ycn (buildConFromOther type zipped yn) + (xc, yc) + + +declareFusion : List (TypeInfo, List Name) -> Elab () +declareFusion l = do + let (derived, _) = deriveFusion l + for_ derived $ logMsg "debug" 0 . interpolate + declare $ derived + +myFlow : List (TypeInfo, List Name) -> List Name -> List Name -> List (ITy, ITy) +myFlow l xn yn = do + let (derived, un) = deriveFusion l + let ts = case derived of {[IData _ _ _ (MkData _ _ _ _ cons)] => cons; _ => []} + splitFusion ts un xn yn + + +public export +runFusion : Name -> List Name -> Name -> List Name -> Elab () +runFusion x xArgs y yArgs = do + xTI <- getInfo' x + yTI <- getInfo' y + let zipped = [(xTI, xArgs), (yTI, yArgs)] + declareFusion zipped + + +-- data X : Type -> Type -> Type where +-- MkX : X m n + +-- data Y : Type -> Type -> Type where +-- MkY : Y m n + + +data X : Nat -> Type where + MkX : X 1 + +data Y : Nat -> Type where + MkY : Y 1 + +%language ElabReflection + +%runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +-- %language ElabReflection + +-- %runElab (runFusion `{X} [`{n}, `{m}] `{Y} [`{n}, `{m}]) + +-- TODO: what happens with :doc +-- pack test deptycheck fusion +-- tests for order of dependent arguments \ No newline at end of file diff --git a/tests/Tests.idr b/tests/Tests.idr index e1bc7268d..7463f29b1 100644 --- a/tests/Tests.idr +++ b/tests/Tests.idr @@ -12,6 +12,7 @@ main = goldenRunner $ , "Derivation utils: canonic signature" `atDir` "derivation/utils/canonicsig" , "Derivation utils: constructors analysis" `atDir` "derivation/utils/cons-analysis" , "Derivation utils: argument dependencies" `atDir` "derivation/utils/arg-deps" + , "Derivation utils: data types fusion" `atDir` "derivation/utils/fusion/merger" , "Reflection utils: involved types" `atDir` "derivation/utils/involved-types" , "Derivation: input validation" `atDir` "derivation/inputvalidation" , "Derivation: running harness" `atDir` "derivation/infra" diff --git a/tests/derivation/utils/fusion/matcher/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/matcher/008 non-shared var/DerivedGen.idr new file mode 100644 index 000000000..f1df92d7e --- /dev/null +++ b/tests/derivation/utils/fusion/matcher/008 non-shared var/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +%language ElabReflection + +%runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] diff --git a/tests/derivation/utils/fusion/matcher/008 non-shared var/derive.ipkg b/tests/derivation/utils/fusion/matcher/008 non-shared var/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/matcher/008 non-shared var/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/matcher/008 non-shared var/expected b/tests/derivation/utils/fusion/matcher/008 non-shared var/expected new file mode 100644 index 000000000..b41b4b435 --- /dev/null +++ b/tests/derivation/utils/fusion/matcher/008 non-shared var/expected @@ -0,0 +1,11 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG debug:0: IData Export + + (MkData XY + IPi. (MW ExplicitArg k : IType) + -> (MW ExplicitArg m : IType) + -> (MW ExplicitArg n : IType) + -> IType + [] + [ MkTy MkX_MkY + (IApp. IVar XY $ IBindVar k $ IBindVar m $ IBindVar n) ]) diff --git a/tests/derivation/utils/fusion/matcher/008 non-shared var/run b/tests/derivation/utils/fusion/matcher/008 non-shared var/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/matcher/008 non-shared var/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr new file mode 100644 index 000000000..02cf2862f --- /dev/null +++ b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type where + MkX : X n + +data Y : Type -> Type where + MkY : Y n + +%language ElabReflection + +%runElab runFusion `{X} [`{n}] `{Y} [`{n}] diff --git a/tests/derivation/utils/fusion/merger/001 one var match/derive.ipkg b/tests/derivation/utils/fusion/merger/001 one var match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/001 one var match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/001 one var match/expected b/tests/derivation/utils/fusion/merger/001 one var match/expected new file mode 100644 index 000000000..6bc972a7f --- /dev/null +++ b/tests/derivation/utils/fusion/merger/001 one var match/expected @@ -0,0 +1,7 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG debug:0: IData Export + + (MkData XY + IPi. (MW ExplicitArg n : IType) -> IType + [] + [MkTy MkX_MkY (IApp. IVar XY $ IBindVar n)]) diff --git a/tests/derivation/utils/fusion/merger/001 one var match/run b/tests/derivation/utils/fusion/merger/001 one var match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/001 one var match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr new file mode 100644 index 000000000..c403277a4 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +%language ElabReflection + +%runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/derive.ipkg b/tests/derivation/utils/fusion/merger/002 two var ordered match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/expected b/tests/derivation/utils/fusion/merger/002 two var ordered match/expected new file mode 100644 index 000000000..2a7f89766 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/expected @@ -0,0 +1,9 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG debug:0: IData Export + + (MkData XY + IPi. (MW ExplicitArg m : IType) + -> (MW ExplicitArg n : IType) + -> IType + [] + [MkTy MkX_MkY (IApp. IVar XY $ IBindVar m $ IBindVar n)]) diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/run b/tests/derivation/utils/fusion/merger/002 two var ordered match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr new file mode 100644 index 000000000..3d9cad042 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +%language ElabReflection + +%runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/derive.ipkg b/tests/derivation/utils/fusion/merger/003 two var unordered match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/expected b/tests/derivation/utils/fusion/merger/003 two var unordered match/expected new file mode 100644 index 000000000..2a7f89766 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/expected @@ -0,0 +1,9 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG debug:0: IData Export + + (MkData XY + IPi. (MW ExplicitArg m : IType) + -> (MW ExplicitArg n : IType) + -> IType + [] + [MkTy MkX_MkY (IApp. IVar XY $ IBindVar m $ IBindVar n)]) diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/run b/tests/derivation/utils/fusion/merger/003 two var unordered match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr new file mode 100644 index 000000000..c2bd3b070 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X n + +data Y : Nat -> Type where + MkY : Y 1 -- unexpected behaviour for 0 + +%language ElabReflection + +%runElab runFusion `{X} [`{n}] `{Y} [`{n}] diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/derive.ipkg b/tests/derivation/utils/fusion/merger/004 var-const match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/004 var-const match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/expected b/tests/derivation/utils/fusion/merger/004 var-const match/expected new file mode 100644 index 000000000..84de5973f --- /dev/null +++ b/tests/derivation/utils/fusion/merger/004 var-const match/expected @@ -0,0 +1,10 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG debug:0: IData Export + + (MkData XY + IPi. (MW ExplicitArg n : IVar Prelude.Types.Nat) -> IType + [] + [ MkTy MkX_MkY + (IApp. IVar XY + $ (IApp. IVar Prelude.Types.S + $ IVar Prelude.Types.Z)) ]) diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/run b/tests/derivation/utils/fusion/merger/004 var-const match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/004 var-const match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr new file mode 100644 index 000000000..1bd434526 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X 1 + +data Y : Nat -> Type where + MkY : Y 1 + +%language ElabReflection + +%runElab runFusion `{X} [`{n}] `{Y} [`{n}] diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/derive.ipkg b/tests/derivation/utils/fusion/merger/005 const-const match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/005 const-const match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/expected b/tests/derivation/utils/fusion/merger/005 const-const match/expected new file mode 100644 index 000000000..84de5973f --- /dev/null +++ b/tests/derivation/utils/fusion/merger/005 const-const match/expected @@ -0,0 +1,10 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG debug:0: IData Export + + (MkData XY + IPi. (MW ExplicitArg n : IVar Prelude.Types.Nat) -> IType + [] + [ MkTy MkX_MkY + (IApp. IVar XY + $ (IApp. IVar Prelude.Types.S + $ IVar Prelude.Types.Z)) ]) diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/run b/tests/derivation/utils/fusion/merger/005 const-const match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/005 const-const match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr new file mode 100644 index 000000000..50bb100dd --- /dev/null +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X 1 + +data Y : Nat -> Type where + MkY : Y 2 + +%language ElabReflection + +%runElab runFusion `{X} [`{n}] `{Y} [`{n}] diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/derive.ipkg b/tests/derivation/utils/fusion/merger/006 const-const no match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/expected b/tests/derivation/utils/fusion/merger/006 const-const no match/expected new file mode 100644 index 000000000..d8e660829 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/expected @@ -0,0 +1,7 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG debug:0: IData Export + + (MkData XY + IPi. (MW ExplicitArg n : IVar Prelude.Types.Nat) -> IType + [] + []) diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/run b/tests/derivation/utils/fusion/merger/006 const-const no match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr new file mode 100644 index 000000000..a20ba0dd5 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : String -> Type where + MkX : X "0" + +data Y : String -> Type where + MkY : Y "0" + +%language ElabReflection + +%runElab runFusion `{X} [`{n}] `{Y} [`{n}] diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/derive.ipkg b/tests/derivation/utils/fusion/merger/007 prim-prim match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/expected b/tests/derivation/utils/fusion/merger/007 prim-prim match/expected new file mode 100644 index 000000000..12b35dc89 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/expected @@ -0,0 +1,7 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG debug:0: IData Export + + (MkData XY + IPi. (MW ExplicitArg n : IPrimVal String) -> IType + [] + [MkTy MkX_MkY (IApp. IVar XY $ IPrimVal 0)]) diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/run b/tests/derivation/utils/fusion/merger/007 prim-prim match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/_common/derive.ipkg b/tests/derivation/utils/fusion/merger/_common/derive.ipkg new file mode 100644 index 000000000..762febf26 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/_common/derive.ipkg @@ -0,0 +1,7 @@ +package derive-test + +authors = "Simon Tsirikov" + +opts = "--no-color --console-width 0" + +depends = deptycheck diff --git a/tests/derivation/utils/fusion/merger/_common/run b/tests/derivation/utils/fusion/merger/_common/run new file mode 100644 index 000000000..8822be695 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/_common/run @@ -0,0 +1,8 @@ +rm -rf build + +NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names + +flock "$1" pack -q install-deps derive.ipkg && \ +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg DerivedGen.idr && \ + +rm -rf build From e0beb44c4beac8e296bca3782758110e8acaee04 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Tue, 23 Apr 2024 13:46:43 +0300 Subject: [PATCH 02/53] split added --- src/Deriving/DepTyCheck/Util/Fusion.idr | 149 +++++++++--------- .../matcher/008 non-shared var/expected | 11 -- .../merger/001 one var match/DerivedGen.idr | 6 +- .../fusion/merger/001 one var match/expected | 18 ++- .../002 two var ordered match/DerivedGen.idr | 8 +- .../merger/002 two var ordered match/expected | 23 +-- .../DerivedGen.idr | 6 +- .../003 two var unordered match/expected | 23 +-- .../merger/004 var-const match/DerivedGen.idr | 6 +- .../merger/004 var-const match/expected | 27 ++-- .../005 const-const match/DerivedGen.idr | 6 +- .../merger/005 const-const match/expected | 27 ++-- .../006 const-const no match/DerivedGen.idr | 6 +- .../merger/006 const-const no match/expected | 19 ++- .../merger/007 prim-prim match/DerivedGen.idr | 6 +- .../merger/007 prim-prim match/expected | 20 ++- .../008 non-shared var/DerivedGen.idr | 6 +- .../008 non-shared var/derive.ipkg | 0 .../fusion/merger/008 non-shared var/expected | 19 +++ .../008 non-shared var/run | 0 .../utils/fusion/merger/_common/run | 4 +- 21 files changed, 235 insertions(+), 155 deletions(-) delete mode 100644 tests/derivation/utils/fusion/matcher/008 non-shared var/expected rename tests/derivation/utils/fusion/{matcher => merger}/008 non-shared var/DerivedGen.idr (69%) rename tests/derivation/utils/fusion/{matcher => merger}/008 non-shared var/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/merger/008 non-shared var/expected rename tests/derivation/utils/fusion/{matcher => merger}/008 non-shared var/run (100%) diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index 9f5135d45..2112efdb5 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -15,10 +15,6 @@ matchArgs na la = if length na == length la then Just (zip la (map (.type) na)) buildIPi : List (Name, TTImp) -> TTImp buildIPi l = piAll type (map (\(n, tti) => MkArg MW ExplicitArg (Just n) tti) l) --- buildIPi l = buildIPiInner (reverse l) (type) where --- buildIPiInner : List (Name, TTImp) -> TTImp -> TTImp --- buildIPiInner [] res = res --- buildIPiInner ((n, tt)::xs) res = buildIPiInner xs (IPi EmptyFC MW ExplicitArg (Just n) tt res) unifyArgs : TTImp -> TTImp -> Name -> TTImp @@ -57,55 +53,73 @@ alignArgs xs ys zs = reverse $ alignArgsInner [] xs ys zs where fuseConstrucror : List Name -> (Con, List Name, Con, List Name) -> List (Name, List TTImp) fuseConstrucror zl (xc, xl, yc, yl) = do - let - xName = xc.name - yName = yc.name - xyName = joinBy "_" [nameStr xName, nameStr yName] + let xName = xc.name + let yName = yc.name + let xyName = joinBy "_" [nameStr xName, nameStr yName] - xType = xc.type - yType = yc.type + let xType = xc.type + let yType = yc.type - (_, xApps) = Reflection.unAppAny xType - (_, yApps) = Reflection.unAppAny yType + let (_, xApps) = Reflection.unAppAny xType + let (_, yApps) = Reflection.unAppAny yType - xArgs = map getExpr xApps - yArgs = map getExpr yApps + let xArgs = map getExpr xApps + let yArgs = map getExpr yApps - xArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip xl xArgs - yArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip yl yArgs + let xArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip xl xArgs + let yArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip yl yArgs - xyAligned = alignArgs xArgsZipped yArgsZipped zl - correctlyAligned = (==) 0 $ length $ Prelude.List.filter (\xy => xy == (type)) xyAligned + let xyAligned = alignArgs xArgsZipped yArgsZipped zl + let correctlyAligned = (==) 0 $ length $ Prelude.List.filter (\xy => xy == (type)) xyAligned if correctlyAligned then [(UN (Basic xyName), xyAligned)] else [] foldConstructor : TTImp -> List TTImp -> TTImp -foldConstructor res [] = res -foldConstructor res (t::ts) = foldConstructor (app res t) ts +foldConstructor = foldl app -deriveFusion : List (TypeInfo, List Name) -> (List Decl, List Name) -deriveFusion l = let - typeNames = map (\(n, _) => nameStr n.name) l - fusionTypeName = UN (Basic $ joinBy "" typeNames) +splitRhs : List TTImp -> TTImp +splitRhs tpe = alternative (UniqueDefault $ foldConstructor (var `{Builtin.MkPair}) tpe) [foldConstructor (var `{Builtin.Pair}) tpe, foldConstructor (var `{Builtin.MkPair}) tpe] - typeArgs = map (\(ti, la) => matchArgs ti.args la) l - typeArgsDefault = map (\ta => case ta of {Just x => x; _ => []}) typeArgs -- should finish with error if any is Nothing - checkArgs = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ join typeArgsDefault - uniqueArgs = nub checkArgs -- argument types should be same in every type - uniqueNames = nub $ sort $ join $ map (\(_, la) => la) l - -- uniqueNames = map (\(n, _) => n) uniqueArgs +splitClauses : TTImp -> List (Con, Con) -> List Clause +splitClauses sc = map (\(xc, yc) => patClause (app sc $ var $ UN $ Basic (joinBy "_" [nameStr xc.name, nameStr yc.name])) (splitRhs [var (UN $ Basic $ nameStr xc.name), var (UN $ Basic $ nameStr yc.name)])) - correctDecl = (length uniqueArgs) == (length uniqueNames) - typeSignature = buildIPi uniqueArgs - consProduct = [ (xc, xl, yc, yl) | (xt, xl) <- l, (yt, yl) <- l, xt.name < yt.name, xc <- xt.cons, yc <- yt.cons] - preCons = join $ map (fuseConstrucror uniqueNames) consProduct - fusedCons = map (\(cn, lt) => mkTy cn (foldConstructor (var fusionTypeName) lt)) preCons +splitReturnType : List Name -> List (List Name) -> List TTImp +splitReturnType tnl anll = map (\(t, al) => foldConstructor t al) $ zip (map (var . UN . Basic . nameStr) tnl) (map (map (.bindVar)) anll) + + +deriveFusion : List (TypeInfo, List Name) -> (List Decl) +deriveFusion l = do + + let typeNames = map (\(n, _) => n.name) l + let typeNamesStr = map nameStr typeNames + let joinedNames = joinBy "" typeNamesStr + let fusionTypeName = UN $ Basic joinedNames + + let typeArgs = map (\(ti, la) => matchArgs ti.args la) l + let typeArgsDefault = map (\ta => case ta of {Just x => x; _ => []}) typeArgs -- should finish with error if any is Nothing + let checkArgs = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ join typeArgsDefault + let uniqueArgs = nub checkArgs -- argument types should be same in every type + let uniqueNames = nub $ sort $ join $ map (\(_, la) => la) l + + let correctDecl = (length uniqueArgs) == (length uniqueNames) + let typeSignature = buildIPi uniqueArgs + let consProduct = [ (xc, xl, yc, yl) | (xt, xl) <- l, (yt, yl) <- l, xt.name < yt.name, xc <- xt.cons, yc <- yt.cons] - in if correctDecl then ([ iData Export fusionTypeName typeSignature [] fusedCons ], uniqueNames) else ([], []) + let preCons = join $ map (fuseConstrucror uniqueNames) consProduct + let fusedCons = map (\(cn, lt) => mkTy cn (foldConstructor (var fusionTypeName) lt)) preCons + + let splitName = UN $ Basic ("split" ++ joinedNames) + let argNamesList = map (\(_, anl) => anl) l + + let dataDecl = iData Export fusionTypeName typeSignature [] fusedCons + let claimDecl = export' splitName ((arg $ foldConstructor (var fusionTypeName) (map (.bindVar) uniqueNames)) .-> splitRhs (splitReturnType typeNames argNamesList)) + let defDecl = def splitName $ splitClauses (var splitName) (map (\(cx, _, cy, _) => (cx, cy)) consProduct) + + if correctDecl then [dataDecl, claimDecl, defDecl] else [] buildConFromOther : TTImp -> List (Name, TTImp) -> List Name -> TTImp @@ -115,64 +129,47 @@ buildConFromOther res la (n::ns) = do case ma of {Nothing => type; Just (_, tt) => buildConFromOther (app res tt) la ns} -splitFusion : List ITy -> List Name -> List Name -> List Name -> List (ITy, ITy) --- splitFusion (IData _ _ _ _ (MkData _ _ _ _ cons)) un xn yn = -splitFusion cs un xn yn = map (splitInner un xn yn) cs where - splitInner : List Name -> List Name -> List Name -> ITy -> (ITy, ITy) - splitInner un xn yn (MkTy _ _ cn ct) = do - let cs = split ((==) '_') (nameStr cn) - let xcn = UN $ Basic $ head cs - let ycn = UN $ Basic $ last cs - let (_, args) = unApp ct - let zipped = zip un args - let xc = mkTy xcn (buildConFromOther type zipped xn) - let yc = mkTy ycn (buildConFromOther type zipped yn) - (xc, yc) - - -declareFusion : List (TypeInfo, List Name) -> Elab () +declareFusion : List (TypeInfo, List Name) -> Elab (List Decl) declareFusion l = do - let (derived, _) = deriveFusion l - for_ derived $ logMsg "debug" 0 . interpolate - declare $ derived - -myFlow : List (TypeInfo, List Name) -> List Name -> List Name -> List (ITy, ITy) -myFlow l xn yn = do - let (derived, un) = deriveFusion l - let ts = case derived of {[IData _ _ _ (MkData _ _ _ _ cons)] => cons; _ => []} - splitFusion ts un xn yn + let derived = deriveFusion l + -- logMsg "debug" 0 $ show derived + declare derived + pure $ take 1 derived public export -runFusion : Name -> List Name -> Name -> List Name -> Elab () +runFusion : Name -> List Name -> Name -> List Name -> Elab (List Decl) runFusion x xArgs y yArgs = do xTI <- getInfo' x yTI <- getInfo' y let zipped = [(xTI, xArgs), (yTI, yArgs)] declareFusion zipped - --- data X : Type -> Type -> Type where --- MkX : X m n +-- data X : Type -> Type where +-- MkX : X n --- data Y : Type -> Type -> Type where --- MkY : Y m n +-- data Y : Type -> Type where +-- MkY : Y n +-- %language ElabReflection -data X : Nat -> Type where - MkX : X 1 +data X : Type -> Type -> Type where + MkX : X m n -data Y : Nat -> Type where - MkY : Y 1 +data Y : Type -> Type -> Type where + MkY : Y m n %language ElabReflection -%runElab runFusion `{X} [`{n}] `{Y} [`{n}] +decl : List Decl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] --- %language ElabReflection +-- decl : List Decl +-- decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] --- %runElab (runFusion `{X} [`{n}, `{m}] `{Y} [`{n}, `{m}]) +-- splitXY : XY n -> (X n, Y n) +-- splitXY MkX_MkY = (MkX, MkY) -- TODO: what happens with :doc --- pack test deptycheck fusion --- tests for order of dependent arguments \ No newline at end of file +-- tests for order of dependent arguments +-- preserve order of args from left to right \ No newline at end of file diff --git a/tests/derivation/utils/fusion/matcher/008 non-shared var/expected b/tests/derivation/utils/fusion/matcher/008 non-shared var/expected deleted file mode 100644 index b41b4b435..000000000 --- a/tests/derivation/utils/fusion/matcher/008 non-shared var/expected +++ /dev/null @@ -1,11 +0,0 @@ -1/1: Building DerivedGen (DerivedGen.idr) -LOG debug:0: IData Export - - (MkData XY - IPi. (MW ExplicitArg k : IType) - -> (MW ExplicitArg m : IType) - -> (MW ExplicitArg n : IType) - -> IType - [] - [ MkTy MkX_MkY - (IApp. IVar XY $ IBindVar k $ IBindVar m $ IBindVar n) ]) diff --git a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr index 02cf2862f..3b2ad5bc1 100644 --- a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr @@ -14,4 +14,8 @@ data Y : Type -> Type where %language ElabReflection -%runElab runFusion `{X} [`{n}] `{Y} [`{n}] +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +test : IO () +test = putPretty decl diff --git a/tests/derivation/utils/fusion/merger/001 one var match/expected b/tests/derivation/utils/fusion/merger/001 one var match/expected index 6bc972a7f..135123057 100644 --- a/tests/derivation/utils/fusion/merger/001 one var match/expected +++ b/tests/derivation/utils/fusion/merger/001 one var match/expected @@ -1,7 +1,11 @@ -1/1: Building DerivedGen (DerivedGen.idr) -LOG debug:0: IData Export - - (MkData XY - IPi. (MW ExplicitArg n : IType) -> IType - [] - [MkTy MkX_MkY (IApp. IVar XY $ IBindVar n)]) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XY" + (Just (MkArg MW ExplicitArg (Just "n") type .-> type)) + [] + [mkTy {name = "MkX_MkY", type = var "XY" .$ bindVar "n"}]) +] diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr index c403277a4..ba333adb8 100644 --- a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr @@ -14,4 +14,10 @@ data Y : Type -> Type -> Type where %language ElabReflection -%runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] + +decl : List Decl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] + +test : IO () +test = putPretty decl + diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/expected b/tests/derivation/utils/fusion/merger/002 two var ordered match/expected index 2a7f89766..c55d7e92f 100644 --- a/tests/derivation/utils/fusion/merger/002 two var ordered match/expected +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/expected @@ -1,9 +1,14 @@ -1/1: Building DerivedGen (DerivedGen.idr) -LOG debug:0: IData Export - - (MkData XY - IPi. (MW ExplicitArg m : IType) - -> (MW ExplicitArg n : IType) - -> IType - [] - [MkTy MkX_MkY (IApp. IVar XY $ IBindVar m $ IBindVar n)]) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XY" + (Just + ( MkArg MW ExplicitArg (Just "m") type + .-> MkArg MW ExplicitArg (Just "n") type + .-> type)) + [] + [mkTy {name = "MkX_MkY", type = var "XY" .$ bindVar "m" .$ bindVar "n"}]) +] diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr index 3d9cad042..4f9c70c87 100644 --- a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr @@ -14,4 +14,8 @@ data Y : Type -> Type -> Type where %language ElabReflection -%runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] +decl : List Decl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] + +test : IO () +test = putPretty decl diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/expected b/tests/derivation/utils/fusion/merger/003 two var unordered match/expected index 2a7f89766..c55d7e92f 100644 --- a/tests/derivation/utils/fusion/merger/003 two var unordered match/expected +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/expected @@ -1,9 +1,14 @@ -1/1: Building DerivedGen (DerivedGen.idr) -LOG debug:0: IData Export - - (MkData XY - IPi. (MW ExplicitArg m : IType) - -> (MW ExplicitArg n : IType) - -> IType - [] - [MkTy MkX_MkY (IApp. IVar XY $ IBindVar m $ IBindVar n)]) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XY" + (Just + ( MkArg MW ExplicitArg (Just "m") type + .-> MkArg MW ExplicitArg (Just "n") type + .-> type)) + [] + [mkTy {name = "MkX_MkY", type = var "XY" .$ bindVar "m" .$ bindVar "n"}]) +] diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr index c2bd3b070..fd3968852 100644 --- a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr @@ -14,4 +14,8 @@ data Y : Nat -> Type where %language ElabReflection -%runElab runFusion `{X} [`{n}] `{Y} [`{n}] +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +test : IO () +test = putPretty decl diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/expected b/tests/derivation/utils/fusion/merger/004 var-const match/expected index 84de5973f..bc95da843 100644 --- a/tests/derivation/utils/fusion/merger/004 var-const match/expected +++ b/tests/derivation/utils/fusion/merger/004 var-const match/expected @@ -1,10 +1,17 @@ -1/1: Building DerivedGen (DerivedGen.idr) -LOG debug:0: IData Export - - (MkData XY - IPi. (MW ExplicitArg n : IVar Prelude.Types.Nat) -> IType - [] - [ MkTy MkX_MkY - (IApp. IVar XY - $ (IApp. IVar Prelude.Types.S - $ IVar Prelude.Types.Z)) ]) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XY" + (Just + (MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") .-> type)) + [] + [ mkTy + { name = "MkX_MkY" + , type = + var "XY" .$ (var "Prelude.Types.S" .$ var "Prelude.Types.Z") + } + ]) +] diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr index 1bd434526..af8993838 100644 --- a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr @@ -14,4 +14,8 @@ data Y : Nat -> Type where %language ElabReflection -%runElab runFusion `{X} [`{n}] `{Y} [`{n}] +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +test : IO () +test = putPretty decl diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/expected b/tests/derivation/utils/fusion/merger/005 const-const match/expected index 84de5973f..bc95da843 100644 --- a/tests/derivation/utils/fusion/merger/005 const-const match/expected +++ b/tests/derivation/utils/fusion/merger/005 const-const match/expected @@ -1,10 +1,17 @@ -1/1: Building DerivedGen (DerivedGen.idr) -LOG debug:0: IData Export - - (MkData XY - IPi. (MW ExplicitArg n : IVar Prelude.Types.Nat) -> IType - [] - [ MkTy MkX_MkY - (IApp. IVar XY - $ (IApp. IVar Prelude.Types.S - $ IVar Prelude.Types.Z)) ]) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XY" + (Just + (MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") .-> type)) + [] + [ mkTy + { name = "MkX_MkY" + , type = + var "XY" .$ (var "Prelude.Types.S" .$ var "Prelude.Types.Z") + } + ]) +] diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr index 50bb100dd..88c4bfad7 100644 --- a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr @@ -14,4 +14,8 @@ data Y : Nat -> Type where %language ElabReflection -%runElab runFusion `{X} [`{n}] `{Y} [`{n}] +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +test : IO () +test = putPretty decl diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/expected b/tests/derivation/utils/fusion/merger/006 const-const no match/expected index d8e660829..f2d14b558 100644 --- a/tests/derivation/utils/fusion/merger/006 const-const no match/expected +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/expected @@ -1,7 +1,12 @@ -1/1: Building DerivedGen (DerivedGen.idr) -LOG debug:0: IData Export - - (MkData XY - IPi. (MW ExplicitArg n : IVar Prelude.Types.Nat) -> IType - [] - []) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XY" + (Just + (MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") .-> type)) + [] + []) +] diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr index a20ba0dd5..0b66955dd 100644 --- a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr @@ -14,4 +14,8 @@ data Y : String -> Type where %language ElabReflection -%runElab runFusion `{X} [`{n}] `{Y} [`{n}] +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +test : IO () +test = putPretty decl diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/expected b/tests/derivation/utils/fusion/merger/007 prim-prim match/expected index 12b35dc89..ec5443801 100644 --- a/tests/derivation/utils/fusion/merger/007 prim-prim match/expected +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/expected @@ -1,7 +1,13 @@ -1/1: Building DerivedGen (DerivedGen.idr) -LOG debug:0: IData Export - - (MkData XY - IPi. (MW ExplicitArg n : IPrimVal String) -> IType - [] - [MkTy MkX_MkY (IApp. IVar XY $ IPrimVal 0)]) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XY" + (Just + ( MkArg MW ExplicitArg (Just "n") (primVal (PrT StringType)) + .-> type)) + [] + [mkTy {name = "MkX_MkY", type = var "XY" .$ primVal (Str "0")}]) +] diff --git a/tests/derivation/utils/fusion/matcher/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr similarity index 69% rename from tests/derivation/utils/fusion/matcher/008 non-shared var/DerivedGen.idr rename to tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr index f1df92d7e..00689b3b4 100644 --- a/tests/derivation/utils/fusion/matcher/008 non-shared var/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr @@ -14,4 +14,8 @@ data Y : Type -> Type -> Type where %language ElabReflection -%runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] +decl : List Decl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] + +test : IO () +test = putPretty decl diff --git a/tests/derivation/utils/fusion/matcher/008 non-shared var/derive.ipkg b/tests/derivation/utils/fusion/merger/008 non-shared var/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/matcher/008 non-shared var/derive.ipkg rename to tests/derivation/utils/fusion/merger/008 non-shared var/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/expected b/tests/derivation/utils/fusion/merger/008 non-shared var/expected new file mode 100644 index 000000000..451ad27a5 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/008 non-shared var/expected @@ -0,0 +1,19 @@ +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XY" + (Just + ( MkArg MW ExplicitArg (Just "k") type + .-> MkArg MW ExplicitArg (Just "m") type + .-> MkArg MW ExplicitArg (Just "n") type + .-> type)) + [] + [ mkTy + { name = "MkX_MkY" + , type = var "XY" .$ bindVar "k" .$ bindVar "m" .$ bindVar "n" + } + ]) +] diff --git a/tests/derivation/utils/fusion/matcher/008 non-shared var/run b/tests/derivation/utils/fusion/merger/008 non-shared var/run similarity index 100% rename from tests/derivation/utils/fusion/matcher/008 non-shared var/run rename to tests/derivation/utils/fusion/merger/008 non-shared var/run diff --git a/tests/derivation/utils/fusion/merger/_common/run b/tests/derivation/utils/fusion/merger/_common/run index 8822be695..b3381f9a3 100644 --- a/tests/derivation/utils/fusion/merger/_common/run +++ b/tests/derivation/utils/fusion/merger/_common/run @@ -3,6 +3,8 @@ rm -rf build NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names flock "$1" pack -q install-deps derive.ipkg && \ -idris2 --check --no-color --console-width 0 --no-banner --find-ipkg DerivedGen.idr && \ +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg --exec test DerivedGen.idr | "$NAMES_CLEANER" + +# pack exec DerivedGen.idr rm -rf build From 2b9c930f24f80775c52324f2526fa50dece559e5 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Tue, 23 Apr 2024 14:05:09 +0300 Subject: [PATCH 03/53] fix typos --- src/Deriving/DepTyCheck/Util/Fusion.idr | 40 +++++++------------ .../merger/001 one var match/DerivedGen.idr | 4 +- .../002 two var ordered match/DerivedGen.idr | 2 +- .../DerivedGen.idr | 2 +- .../merger/004 var-const match/DerivedGen.idr | 2 +- .../005 const-const match/DerivedGen.idr | 2 +- .../006 const-const no match/DerivedGen.idr | 2 +- .../merger/007 prim-prim match/DerivedGen.idr | 2 +- .../merger/008 non-shared var/DerivedGen.idr | 2 +- .../utils/fusion/merger/_common/run | 2 - 10 files changed, 23 insertions(+), 37 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index 2112efdb5..018d193dd 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -52,7 +52,7 @@ alignArgs xs ys zs = reverse $ alignArgsInner [] xs ys zs where fuseConstrucror : List Name -> (Con, List Name, Con, List Name) -> List (Name, List TTImp) -fuseConstrucror zl (xc, xl, yc, yl) = do +fuseConstrucror zl (xc, xl, yc, yl) = do let xName = xc.name let yName = yc.name let xyName = joinBy "_" [nameStr xName, nameStr yName] @@ -93,9 +93,9 @@ splitReturnType tnl anll = map (\(t, al) => foldConstructor t al) $ zip (map (va deriveFusion : List (TypeInfo, List Name) -> (List Decl) deriveFusion l = do - - let typeNames = map (\(n, _) => n.name) l - let typeNamesStr = map nameStr typeNames + + let typeNames = map (\(n, _) => n.name) l + let typeNamesStr = map nameStr typeNames let joinedNames = joinBy "" typeNamesStr let fusionTypeName = UN $ Basic joinedNames @@ -108,7 +108,7 @@ deriveFusion l = do let correctDecl = (length uniqueArgs) == (length uniqueNames) let typeSignature = buildIPi uniqueArgs let consProduct = [ (xc, xl, yc, yl) | (xt, xl) <- l, (yt, yl) <- l, xt.name < yt.name, xc <- xt.cons, yc <- yt.cons] - + let preCons = join $ map (fuseConstrucror uniqueNames) consProduct let fusedCons = map (\(cn, lt) => mkTy cn (foldConstructor (var fusionTypeName) lt)) preCons @@ -145,31 +145,19 @@ runFusion x xArgs y yArgs = do let zipped = [(xTI, xArgs), (yTI, yArgs)] declareFusion zipped --- data X : Type -> Type where --- MkX : X n - --- data Y : Type -> Type where --- MkY : Y n - --- %language ElabReflection +-- data X : Type -> Type -> Type where +-- MkX : X m n -data X : Type -> Type -> Type where - MkX : X m n - -data Y : Type -> Type -> Type where - MkY : Y m n +-- data Y : Type -> Type -> Type where +-- MkY : Y m n -%language ElabReflection - -decl : List Decl -decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] +-- %language ElabReflection -- decl : List Decl --- decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] - --- splitXY : XY n -> (X n, Y n) --- splitXY MkX_MkY = (MkX, MkY) +-- decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] -- TODO: what happens with :doc -- tests for order of dependent arguments --- preserve order of args from left to right \ No newline at end of file +-- preserve order of args from left to right +-- TODO: IClaim -> Pair, IDef -> MkPair +-- TODO: fusion for more than 2 types diff --git a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr index 3b2ad5bc1..7ef6a1c8b 100644 --- a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr @@ -8,9 +8,9 @@ import public Deriving.DepTyCheck.Gen.Core data X : Type -> Type where MkX : X n - + data Y : Type -> Type where - MkY : Y n + MkY : Y n %language ElabReflection diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr index ba333adb8..3f06bc757 100644 --- a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr @@ -8,7 +8,7 @@ import public Deriving.DepTyCheck.Gen.Core data X : Type -> Type -> Type where MkX : X m n - + data Y : Type -> Type -> Type where MkY : Y m n diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr index 4f9c70c87..baf82abb2 100644 --- a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr @@ -8,7 +8,7 @@ import public Deriving.DepTyCheck.Gen.Core data X : Type -> Type -> Type where MkX : X m n - + data Y : Type -> Type -> Type where MkY : Y m n diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr index fd3968852..ae3a991a1 100644 --- a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr @@ -8,7 +8,7 @@ import public Deriving.DepTyCheck.Gen.Core data X : Nat -> Type where MkX : X n - + data Y : Nat -> Type where MkY : Y 1 -- unexpected behaviour for 0 diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr index af8993838..844372c37 100644 --- a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr @@ -8,7 +8,7 @@ import public Deriving.DepTyCheck.Gen.Core data X : Nat -> Type where MkX : X 1 - + data Y : Nat -> Type where MkY : Y 1 diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr index 88c4bfad7..94530ab2d 100644 --- a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr @@ -8,7 +8,7 @@ import public Deriving.DepTyCheck.Gen.Core data X : Nat -> Type where MkX : X 1 - + data Y : Nat -> Type where MkY : Y 2 diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr index 0b66955dd..101f0cf6a 100644 --- a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr @@ -8,7 +8,7 @@ import public Deriving.DepTyCheck.Gen.Core data X : String -> Type where MkX : X "0" - + data Y : String -> Type where MkY : Y "0" diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr index 00689b3b4..e36bcdc23 100644 --- a/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr @@ -8,7 +8,7 @@ import public Deriving.DepTyCheck.Gen.Core data X : Type -> Type -> Type where MkX : X m n - + data Y : Type -> Type -> Type where MkY : Y m n diff --git a/tests/derivation/utils/fusion/merger/_common/run b/tests/derivation/utils/fusion/merger/_common/run index b3381f9a3..d845a951b 100644 --- a/tests/derivation/utils/fusion/merger/_common/run +++ b/tests/derivation/utils/fusion/merger/_common/run @@ -5,6 +5,4 @@ NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names flock "$1" pack -q install-deps derive.ipkg && \ idris2 --check --no-color --console-width 0 --no-banner --find-ipkg --exec test DerivedGen.idr | "$NAMES_CLEANER" -# pack exec DerivedGen.idr - rm -rf build From 824f19587d8ac85141bff5f00ced4e076834590a Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Thu, 16 May 2024 16:14:29 +0300 Subject: [PATCH 04/53] split fixed and tests added --- src/Deriving/DepTyCheck/Util/Fusion.idr | 37 +++++++++++++++---- tests/Tests.idr | 1 + .../merger/001 one var match/DerivedGen.idr | 5 +-- .../fusion/merger/001 one var match/expected | 1 + .../002 two var ordered match/DerivedGen.idr | 4 +- .../merger/002 two var ordered match/expected | 1 + .../DerivedGen.idr | 4 +- .../003 two var unordered match/expected | 1 + .../merger/004 var-const match/DerivedGen.idr | 4 +- .../merger/004 var-const match/expected | 1 + .../005 const-const match/DerivedGen.idr | 4 +- .../merger/005 const-const match/expected | 1 + .../006 const-const no match/DerivedGen.idr | 4 +- .../merger/006 const-const no match/expected | 1 + .../merger/007 prim-prim match/DerivedGen.idr | 4 +- .../merger/007 prim-prim match/expected | 1 + .../merger/008 non-shared var/DerivedGen.idr | 4 +- .../fusion/merger/008 non-shared var/expected | 1 + .../utils/fusion/merger/_common/run | 3 +- .../splitter/001 one var match/DerivedGen.idr | 20 ++++++++++ .../splitter/001 one var match/derive.ipkg | 1 + .../splitter/001 one var match/expected | 21 +++++++++++ .../fusion/splitter/001 one var match/run | 1 + .../002 two var ordered match/DerivedGen.idr | 23 ++++++++++++ .../002 two var ordered match/derive.ipkg | 1 + .../002 two var ordered match/expected | 25 +++++++++++++ .../splitter/002 two var ordered match/run | 1 + .../DerivedGen.idr | 21 +++++++++++ .../003 two var unordered match/derive.ipkg | 1 + .../003 two var unordered match/expected | 25 +++++++++++++ .../splitter/003 two var unordered match/run | 1 + .../004 var-const match/DerivedGen.idr | 21 +++++++++++ .../splitter/004 var-const match/derive.ipkg | 1 + .../splitter/004 var-const match/expected | 21 +++++++++++ .../fusion/splitter/004 var-const match/run | 1 + .../005 const-const match/DerivedGen.idr | 21 +++++++++++ .../005 const-const match/derive.ipkg | 1 + .../splitter/005 const-const match/expected | 21 +++++++++++ .../fusion/splitter/005 const-const match/run | 1 + .../006 const-const no match/DerivedGen.idr | 21 +++++++++++ .../006 const-const no match/derive.ipkg | 1 + .../006 const-const no match/expected | 2 + .../splitter/006 const-const no match/run | 1 + .../007 prim-prim match/DerivedGen.idr | 21 +++++++++++ .../splitter/007 prim-prim match/derive.ipkg | 1 + .../splitter/007 prim-prim match/expected | 21 +++++++++++ .../fusion/splitter/007 prim-prim match/run | 1 + .../008 non-shared var/DerivedGen.idr | 21 +++++++++++ .../splitter/008 non-shared var/derive.ipkg | 1 + .../splitter/008 non-shared var/expected | 25 +++++++++++++ .../fusion/splitter/008 non-shared var/run | 1 + .../utils/fusion/splitter/_common/derive.ipkg | 7 ++++ .../utils/fusion/splitter/_common/run | 9 +++++ 53 files changed, 418 insertions(+), 26 deletions(-) create mode 100644 tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/001 one var match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/001 one var match/expected create mode 120000 tests/derivation/utils/fusion/splitter/001 one var match/run create mode 100644 tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/002 two var ordered match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/002 two var ordered match/expected create mode 120000 tests/derivation/utils/fusion/splitter/002 two var ordered match/run create mode 100644 tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/003 two var unordered match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/003 two var unordered match/expected create mode 120000 tests/derivation/utils/fusion/splitter/003 two var unordered match/run create mode 100644 tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/004 var-const match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/004 var-const match/expected create mode 120000 tests/derivation/utils/fusion/splitter/004 var-const match/run create mode 100644 tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/005 const-const match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/005 const-const match/expected create mode 120000 tests/derivation/utils/fusion/splitter/005 const-const match/run create mode 100644 tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/006 const-const no match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/006 const-const no match/expected create mode 120000 tests/derivation/utils/fusion/splitter/006 const-const no match/run create mode 100644 tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/007 prim-prim match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/007 prim-prim match/expected create mode 120000 tests/derivation/utils/fusion/splitter/007 prim-prim match/run create mode 100644 tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/008 non-shared var/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/008 non-shared var/expected create mode 120000 tests/derivation/utils/fusion/splitter/008 non-shared var/run create mode 100644 tests/derivation/utils/fusion/splitter/_common/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/_common/run diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index 018d193dd..a99a8288d 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -79,18 +79,28 @@ foldConstructor : TTImp -> List TTImp -> TTImp foldConstructor = foldl app -splitRhs : List TTImp -> TTImp -splitRhs tpe = alternative (UniqueDefault $ foldConstructor (var `{Builtin.MkPair}) tpe) [foldConstructor (var `{Builtin.Pair}) tpe, foldConstructor (var `{Builtin.MkPair}) tpe] +splitRhsDef : List TTImp -> TTImp +splitRhsDef tpe = foldConstructor (var `{Builtin.MkPair}) tpe + +splitRhsClaim : List TTImp -> TTImp +splitRhsClaim tpe = foldConstructor (var `{Builtin.Pair}) tpe splitClauses : TTImp -> List (Con, Con) -> List Clause -splitClauses sc = map (\(xc, yc) => patClause (app sc $ var $ UN $ Basic (joinBy "_" [nameStr xc.name, nameStr yc.name])) (splitRhs [var (UN $ Basic $ nameStr xc.name), var (UN $ Basic $ nameStr yc.name)])) +splitClauses sc = map (\(xc, yc) => patClause (app sc $ var $ UN $ Basic (joinBy "_" [nameStr xc.name, nameStr yc.name])) (splitRhsDef [var (UN $ Basic $ nameStr xc.name), var (UN $ Basic $ nameStr yc.name)])) splitReturnType : List Name -> List (List Name) -> List TTImp splitReturnType tnl anll = map (\(t, al) => foldConstructor t al) $ zip (map (var . UN . Basic . nameStr) tnl) (map (map (.bindVar)) anll) +combinations : List (List Nat) -> List (List Nat) +combinations l = map reverse $ combinationsInner l [[]] where + combinationsInner : List (List Nat) -> List (List Nat) -> List (List Nat) + combinationsInner (xs::xss) rss = combinationsInner xss $ join $ map (\x => map (\rs => x :: rs) rss) xs + combinationsInner [] rss = rss + + deriveFusion : List (TypeInfo, List Name) -> (List Decl) deriveFusion l = do @@ -108,6 +118,7 @@ deriveFusion l = do let correctDecl = (length uniqueArgs) == (length uniqueNames) let typeSignature = buildIPi uniqueArgs let consProduct = [ (xc, xl, yc, yl) | (xt, xl) <- l, (yt, yl) <- l, xt.name < yt.name, xc <- xt.cons, yc <- yt.cons] + -- all combinations from given lists (constructors) let preCons = join $ map (fuseConstrucror uniqueNames) consProduct let fusedCons = map (\(cn, lt) => mkTy cn (foldConstructor (var fusionTypeName) lt)) preCons @@ -116,10 +127,10 @@ deriveFusion l = do let argNamesList = map (\(_, anl) => anl) l let dataDecl = iData Export fusionTypeName typeSignature [] fusedCons - let claimDecl = export' splitName ((arg $ foldConstructor (var fusionTypeName) (map (.bindVar) uniqueNames)) .-> splitRhs (splitReturnType typeNames argNamesList)) + let claimDecl = export' splitName ((arg $ foldConstructor (var fusionTypeName) (map (.bindVar) uniqueNames)) .-> splitRhsClaim (splitReturnType typeNames argNamesList)) let defDecl = def splitName $ splitClauses (var splitName) (map (\(cx, _, cy, _) => (cx, cy)) consProduct) - if correctDecl then [dataDecl, claimDecl, defDecl] else [] + if correctDecl then (if (length fusedCons /= 0) then [dataDecl, claimDecl, defDecl] else [dataDecl]) else [] buildConFromOther : TTImp -> List (Name, TTImp) -> List Name -> TTImp @@ -132,9 +143,8 @@ buildConFromOther res la (n::ns) = do declareFusion : List (TypeInfo, List Name) -> Elab (List Decl) declareFusion l = do let derived = deriveFusion l - -- logMsg "debug" 0 $ show derived declare derived - pure $ take 1 derived + pure $ derived public export @@ -145,6 +155,15 @@ runFusion x xArgs y yArgs = do let zipped = [(xTI, xArgs), (yTI, yArgs)] declareFusion zipped + +public export +getFusion : List Decl -> List Decl +getFusion = take 1 + +public export +getSplit : List Decl -> List Decl +getSplit = drop 1 + -- data X : Type -> Type -> Type where -- MkX : X m n @@ -156,8 +175,10 @@ runFusion x xArgs y yArgs = do -- decl : List Decl -- decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] +-- test : IO () +-- test = putPretty decl + -- TODO: what happens with :doc -- tests for order of dependent arguments -- preserve order of args from left to right --- TODO: IClaim -> Pair, IDef -> MkPair -- TODO: fusion for more than 2 types diff --git a/tests/Tests.idr b/tests/Tests.idr index 7463f29b1..425b1f74b 100644 --- a/tests/Tests.idr +++ b/tests/Tests.idr @@ -13,6 +13,7 @@ main = goldenRunner $ , "Derivation utils: constructors analysis" `atDir` "derivation/utils/cons-analysis" , "Derivation utils: argument dependencies" `atDir` "derivation/utils/arg-deps" , "Derivation utils: data types fusion" `atDir` "derivation/utils/fusion/merger" + , "Derivation utils: fused data types split" `atDir` "derivation/utils/fusion/splitter" , "Reflection utils: involved types" `atDir` "derivation/utils/involved-types" , "Derivation: input validation" `atDir` "derivation/inputvalidation" , "Derivation: running harness" `atDir` "derivation/infra" diff --git a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr index 7ef6a1c8b..89e8bce09 100644 --- a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr @@ -3,7 +3,6 @@ module DerivedGen import public Deriving.DepTyCheck.Util.Fusion import public Deriving.DepTyCheck.Gen.Core - %default total data X : Type -> Type where @@ -17,5 +16,5 @@ data Y : Type -> Type where decl : List Decl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] -test : IO () -test = putPretty decl +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/001 one var match/expected b/tests/derivation/utils/fusion/merger/001 one var match/expected index 135123057..8a8f43860 100644 --- a/tests/derivation/utils/fusion/merger/001 one var match/expected +++ b/tests/derivation/utils/fusion/merger/001 one var match/expected @@ -1,3 +1,4 @@ +1/1: Building DerivedGen (DerivedGen.idr) [ IData emptyFC (specified Export) diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr index 3f06bc757..730969621 100644 --- a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr @@ -18,6 +18,6 @@ data Y : Type -> Type -> Type where decl : List Decl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] -test : IO () -test = putPretty decl +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/expected b/tests/derivation/utils/fusion/merger/002 two var ordered match/expected index c55d7e92f..2f1021e2c 100644 --- a/tests/derivation/utils/fusion/merger/002 two var ordered match/expected +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/expected @@ -1,3 +1,4 @@ +1/1: Building DerivedGen (DerivedGen.idr) [ IData emptyFC (specified Export) diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr index baf82abb2..206ec61f4 100644 --- a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr @@ -17,5 +17,5 @@ data Y : Type -> Type -> Type where decl : List Decl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] -test : IO () -test = putPretty decl +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/expected b/tests/derivation/utils/fusion/merger/003 two var unordered match/expected index c55d7e92f..2f1021e2c 100644 --- a/tests/derivation/utils/fusion/merger/003 two var unordered match/expected +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/expected @@ -1,3 +1,4 @@ +1/1: Building DerivedGen (DerivedGen.idr) [ IData emptyFC (specified Export) diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr index ae3a991a1..0c976c1e4 100644 --- a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr @@ -17,5 +17,5 @@ data Y : Nat -> Type where decl : List Decl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] -test : IO () -test = putPretty decl +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/expected b/tests/derivation/utils/fusion/merger/004 var-const match/expected index bc95da843..1728ff26b 100644 --- a/tests/derivation/utils/fusion/merger/004 var-const match/expected +++ b/tests/derivation/utils/fusion/merger/004 var-const match/expected @@ -1,3 +1,4 @@ +1/1: Building DerivedGen (DerivedGen.idr) [ IData emptyFC (specified Export) diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr index 844372c37..2a0eca0a0 100644 --- a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr @@ -17,5 +17,5 @@ data Y : Nat -> Type where decl : List Decl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] -test : IO () -test = putPretty decl +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/expected b/tests/derivation/utils/fusion/merger/005 const-const match/expected index bc95da843..1728ff26b 100644 --- a/tests/derivation/utils/fusion/merger/005 const-const match/expected +++ b/tests/derivation/utils/fusion/merger/005 const-const match/expected @@ -1,3 +1,4 @@ +1/1: Building DerivedGen (DerivedGen.idr) [ IData emptyFC (specified Export) diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr index 94530ab2d..fb36bfd96 100644 --- a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr @@ -17,5 +17,5 @@ data Y : Nat -> Type where decl : List Decl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] -test : IO () -test = putPretty decl +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/expected b/tests/derivation/utils/fusion/merger/006 const-const no match/expected index f2d14b558..04bb36376 100644 --- a/tests/derivation/utils/fusion/merger/006 const-const no match/expected +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/expected @@ -1,3 +1,4 @@ +1/1: Building DerivedGen (DerivedGen.idr) [ IData emptyFC (specified Export) diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr index 101f0cf6a..30bec0a41 100644 --- a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr @@ -17,5 +17,5 @@ data Y : String -> Type where decl : List Decl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] -test : IO () -test = putPretty decl +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/expected b/tests/derivation/utils/fusion/merger/007 prim-prim match/expected index ec5443801..4b434edf9 100644 --- a/tests/derivation/utils/fusion/merger/007 prim-prim match/expected +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/expected @@ -1,3 +1,4 @@ +1/1: Building DerivedGen (DerivedGen.idr) [ IData emptyFC (specified Export) diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr index e36bcdc23..8758de682 100644 --- a/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr @@ -17,5 +17,5 @@ data Y : Type -> Type -> Type where decl : List Decl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] -test : IO () -test = putPretty decl +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/expected b/tests/derivation/utils/fusion/merger/008 non-shared var/expected index 451ad27a5..64dc6df32 100644 --- a/tests/derivation/utils/fusion/merger/008 non-shared var/expected +++ b/tests/derivation/utils/fusion/merger/008 non-shared var/expected @@ -1,3 +1,4 @@ +1/1: Building DerivedGen (DerivedGen.idr) [ IData emptyFC (specified Export) diff --git a/tests/derivation/utils/fusion/merger/_common/run b/tests/derivation/utils/fusion/merger/_common/run index d845a951b..2a6b6401c 100644 --- a/tests/derivation/utils/fusion/merger/_common/run +++ b/tests/derivation/utils/fusion/merger/_common/run @@ -3,6 +3,7 @@ rm -rf build NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names flock "$1" pack -q install-deps derive.ipkg && \ -idris2 --check --no-color --console-width 0 --no-banner --find-ipkg --exec test DerivedGen.idr | "$NAMES_CLEANER" +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg DerivedGen.idr && \ +pack exec DerivedGen.idr | "$NAMES_CLEANER" rm -rf build diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr new file mode 100644 index 000000000..6d5097730 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr @@ -0,0 +1,20 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type where + MkX : X n + +data Y : Type -> Type where + MkY : Y n + +%language ElabReflection + +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/derive.ipkg b/tests/derivation/utils/fusion/splitter/001 one var match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/001 one var match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/expected b/tests/derivation/utils/fusion/splitter/001 one var match/expected new file mode 100644 index 000000000..2b2cd79ca --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/001 one var match/expected @@ -0,0 +1,21 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXY" + , type = + MkArg MW ExplicitArg Nothing (var "XY" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "n") + .$ (var "Y" .$ bindVar "n") + }) +, IDef + emptyFC + "splitXY" + [ var "splitXY" .$ var "MkX_MkY" + .= var "Builtin.MkPair" .$ var "MkX" .$ var "MkY" + ] +] diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/run b/tests/derivation/utils/fusion/splitter/001 one var match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/001 one var match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr new file mode 100644 index 000000000..4002c5ef5 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +%language ElabReflection + + +decl : List Decl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] + +main : IO () +main = putPretty $ getSplit decl + diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/derive.ipkg b/tests/derivation/utils/fusion/splitter/002 two var ordered match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/002 two var ordered match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/expected b/tests/derivation/utils/fusion/splitter/002 two var ordered match/expected new file mode 100644 index 000000000..51c574c3a --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/002 two var ordered match/expected @@ -0,0 +1,25 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXY" + , type = + MkArg + MW + ExplicitArg + Nothing + (var "XY" .$ bindVar "m" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "m" .$ bindVar "n") + .$ (var "Y" .$ bindVar "m" .$ bindVar "n") + }) +, IDef + emptyFC + "splitXY" + [ var "splitXY" .$ var "MkX_MkY" + .= var "Builtin.MkPair" .$ var "MkX" .$ var "MkY" + ] +] diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/run b/tests/derivation/utils/fusion/splitter/002 two var ordered match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/002 two var ordered match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr new file mode 100644 index 000000000..648431c41 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +%language ElabReflection + +decl : List Decl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/derive.ipkg b/tests/derivation/utils/fusion/splitter/003 two var unordered match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/003 two var unordered match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/expected b/tests/derivation/utils/fusion/splitter/003 two var unordered match/expected new file mode 100644 index 000000000..f5304c0b2 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/003 two var unordered match/expected @@ -0,0 +1,25 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXY" + , type = + MkArg + MW + ExplicitArg + Nothing + (var "XY" .$ bindVar "m" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "m" .$ bindVar "n") + .$ (var "Y" .$ bindVar "n" .$ bindVar "m") + }) +, IDef + emptyFC + "splitXY" + [ var "splitXY" .$ var "MkX_MkY" + .= var "Builtin.MkPair" .$ var "MkX" .$ var "MkY" + ] +] diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/run b/tests/derivation/utils/fusion/splitter/003 two var unordered match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/003 two var unordered match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr new file mode 100644 index 000000000..599c6f3b7 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X n + +data Y : Nat -> Type where + MkY : Y 1 -- unexpected behaviour for 0 + +%language ElabReflection + +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/derive.ipkg b/tests/derivation/utils/fusion/splitter/004 var-const match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/004 var-const match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/expected b/tests/derivation/utils/fusion/splitter/004 var-const match/expected new file mode 100644 index 000000000..2b2cd79ca --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/004 var-const match/expected @@ -0,0 +1,21 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXY" + , type = + MkArg MW ExplicitArg Nothing (var "XY" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "n") + .$ (var "Y" .$ bindVar "n") + }) +, IDef + emptyFC + "splitXY" + [ var "splitXY" .$ var "MkX_MkY" + .= var "Builtin.MkPair" .$ var "MkX" .$ var "MkY" + ] +] diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/run b/tests/derivation/utils/fusion/splitter/004 var-const match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/004 var-const match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr new file mode 100644 index 000000000..33bdd8fc3 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X 1 + +data Y : Nat -> Type where + MkY : Y 1 + +%language ElabReflection + +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/derive.ipkg b/tests/derivation/utils/fusion/splitter/005 const-const match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/005 const-const match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/expected b/tests/derivation/utils/fusion/splitter/005 const-const match/expected new file mode 100644 index 000000000..2b2cd79ca --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/005 const-const match/expected @@ -0,0 +1,21 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXY" + , type = + MkArg MW ExplicitArg Nothing (var "XY" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "n") + .$ (var "Y" .$ bindVar "n") + }) +, IDef + emptyFC + "splitXY" + [ var "splitXY" .$ var "MkX_MkY" + .= var "Builtin.MkPair" .$ var "MkX" .$ var "MkY" + ] +] diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/run b/tests/derivation/utils/fusion/splitter/005 const-const match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/005 const-const match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr new file mode 100644 index 000000000..fab60b2e3 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X 1 + +data Y : Nat -> Type where + MkY : Y 2 + +%language ElabReflection + +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/derive.ipkg b/tests/derivation/utils/fusion/splitter/006 const-const no match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/006 const-const no match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/expected b/tests/derivation/utils/fusion/splitter/006 const-const no match/expected new file mode 100644 index 000000000..02e9acf39 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/006 const-const no match/expected @@ -0,0 +1,2 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[] diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/run b/tests/derivation/utils/fusion/splitter/006 const-const no match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/006 const-const no match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr new file mode 100644 index 000000000..91f4bfda4 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : String -> Type where + MkX : X "0" + +data Y : String -> Type where + MkY : Y "0" + +%language ElabReflection + +decl : List Decl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/derive.ipkg b/tests/derivation/utils/fusion/splitter/007 prim-prim match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/007 prim-prim match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/expected b/tests/derivation/utils/fusion/splitter/007 prim-prim match/expected new file mode 100644 index 000000000..2b2cd79ca --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/007 prim-prim match/expected @@ -0,0 +1,21 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXY" + , type = + MkArg MW ExplicitArg Nothing (var "XY" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "n") + .$ (var "Y" .$ bindVar "n") + }) +, IDef + emptyFC + "splitXY" + [ var "splitXY" .$ var "MkX_MkY" + .= var "Builtin.MkPair" .$ var "MkX" .$ var "MkY" + ] +] diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/run b/tests/derivation/utils/fusion/splitter/007 prim-prim match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/007 prim-prim match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr new file mode 100644 index 000000000..6ccbd0f09 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +%language ElabReflection + +decl : List Decl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/derive.ipkg b/tests/derivation/utils/fusion/splitter/008 non-shared var/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/008 non-shared var/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/expected b/tests/derivation/utils/fusion/splitter/008 non-shared var/expected new file mode 100644 index 000000000..16abc6342 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/008 non-shared var/expected @@ -0,0 +1,25 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXY" + , type = + MkArg + MW + ExplicitArg + Nothing + (var "XY" .$ bindVar "k" .$ bindVar "m" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "m" .$ bindVar "n") + .$ (var "Y" .$ bindVar "n" .$ bindVar "k") + }) +, IDef + emptyFC + "splitXY" + [ var "splitXY" .$ var "MkX_MkY" + .= var "Builtin.MkPair" .$ var "MkX" .$ var "MkY" + ] +] diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/run b/tests/derivation/utils/fusion/splitter/008 non-shared var/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/008 non-shared var/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/_common/derive.ipkg b/tests/derivation/utils/fusion/splitter/_common/derive.ipkg new file mode 100644 index 000000000..762febf26 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/_common/derive.ipkg @@ -0,0 +1,7 @@ +package derive-test + +authors = "Simon Tsirikov" + +opts = "--no-color --console-width 0" + +depends = deptycheck diff --git a/tests/derivation/utils/fusion/splitter/_common/run b/tests/derivation/utils/fusion/splitter/_common/run new file mode 100644 index 000000000..2a6b6401c --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/_common/run @@ -0,0 +1,9 @@ +rm -rf build + +NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names + +flock "$1" pack -q install-deps derive.ipkg && \ +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg DerivedGen.idr && \ +pack exec DerivedGen.idr | "$NAMES_CLEANER" + +rm -rf build From 527644a9277a4ae88b2d678552448d062e08e2e7 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Wed, 22 May 2024 14:31:13 +0300 Subject: [PATCH 05/53] multiple types fusion added --- src/Deriving/DepTyCheck/Util/Fusion.idr | 199 ++++++++++++------ .../merger/001 one var match/DerivedGen.idr | 2 +- .../002 two var ordered match/DerivedGen.idr | 2 +- .../DerivedGen.idr | 2 +- .../merger/004 var-const match/DerivedGen.idr | 2 +- .../005 const-const match/DerivedGen.idr | 2 +- .../006 const-const no match/DerivedGen.idr | 2 +- .../merger/007 prim-prim match/DerivedGen.idr | 2 +- .../merger/008 non-shared var/DerivedGen.idr | 2 +- .../009 three types fusion/DerivedGen.idr | 23 ++ .../merger/009 three types fusion/derive.ipkg | 1 + .../merger/009 three types fusion/expected | 12 ++ .../fusion/merger/009 three types fusion/run | 1 + .../splitter/001 one var match/DerivedGen.idr | 2 +- .../002 two var ordered match/DerivedGen.idr | 2 +- .../DerivedGen.idr | 2 +- .../004 var-const match/DerivedGen.idr | 2 +- .../005 const-const match/DerivedGen.idr | 2 +- .../006 const-const no match/DerivedGen.idr | 2 +- .../006 const-const no match/expected | 16 +- .../007 prim-prim match/DerivedGen.idr | 2 +- .../008 non-shared var/DerivedGen.idr | 2 +- .../009 three types fusion/DerivedGen.idr | 23 ++ .../009 three types fusion/derive.ipkg | 1 + .../splitter/009 three types fusion/expected | 25 +++ .../splitter/009 three types fusion/run | 1 + 26 files changed, 253 insertions(+), 81 deletions(-) create mode 100644 tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/009 three types fusion/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/009 three types fusion/expected create mode 120000 tests/derivation/utils/fusion/merger/009 three types fusion/run create mode 100644 tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/009 three types fusion/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/009 three types fusion/expected create mode 120000 tests/derivation/utils/fusion/splitter/009 three types fusion/run diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index a99a8288d..a3050fa4a 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -18,7 +18,7 @@ buildIPi l = piAll type (map (\(n, tti) => MkArg MW ExplicitArg (Just n) tti) l) unifyArgs : TTImp -> TTImp -> Name -> TTImp -unifyArgs (IVar _ _) (IVar _ _) n = bindVar (show n) -- unifyArgs (IVar n) (IVar Prelude.Types.Z) should be Z +unifyArgs (IVar _ _) (IVar _ _) n = var n -- unifyArgs (IVar n) (IVar Prelude.Types.Z) should be Z unifyArgs l@(IApp _ _ _) (IVar _ _) _ = l unifyArgs (IVar _ _) r@(IApp _ _ _) _ = r unifyArgs l@(IApp _ _ _) r@(IApp _ _ _) _ = if l == r then l else type @@ -29,50 +29,65 @@ unifyArgs _ _ _ = type -- others TTImp to add? processArg : TTImp -> Name -> TTImp -processArg (IVar _ (UN (Basic _))) n = bindVar (show n) +processArg (IVar _ (UN (Basic _))) n = var n processArg smth _ = smth -alignArgs : List (Name, TTImp) -> List (Name, TTImp) -> List Name -> List TTImp -alignArgs xs ys zs = reverse $ alignArgsInner [] xs ys zs where - alignArgsInner : List TTImp -> List (Name, TTImp) -> List (Name, TTImp) -> List Name -> List TTImp - alignArgsInner res _ _ [] = res - alignArgsInner res ((xn, xt)::xs) ((yn, yt)::ys) (zn::zs) = case (xn == zn, yn == zn) of - (True , True ) => alignArgsInner ((unifyArgs xt yt zn)::res) xs ys zs - (True , False) => alignArgsInner ((processArg xt zn)::res) xs ((yn, yt)::ys) zs - (False, True ) => alignArgsInner ((processArg yt zn)::res) ((xn, xt)::xs) ys zs - (False, False) => [var zn] - alignArgsInner res ((xn, xt)::xs) [] (zn::zs) = case (xn == zn) of - True => alignArgsInner ((processArg xt zn)::res) xs [] zs - False => [var zn] - alignArgsInner res [] ((yn, yt)::ys) (zn::zs) = case (yn == zn) of - True => alignArgsInner ((processArg yt zn)::res) [] ys zs - False => [var zn] - alignArgsInner res [] [] (zn::zs) = [var zn] - - -fuseConstrucror : List Name -> (Con, List Name, Con, List Name) -> List (Name, List TTImp) -fuseConstrucror zl (xc, xl, yc, yl) = do - let xName = xc.name - let yName = yc.name +bindArgs : TTImp -> TTImp +bindArgs (IVar _ (UN (Basic n))) = bindVar n +bindArgs smth = smth + + +alignArgs : List Name -> List (Name, TTImp) -> List (Name, TTImp) -> List (Name, TTImp) +alignArgs zs xs ys = reverse $ alignArgsInner zs [] xs ys where + alignArgsInner : List Name -> List (Name, TTImp) -> List (Name, TTImp) -> List (Name, TTImp) -> List (Name, TTImp) + alignArgsInner [] res _ _ = res + alignArgsInner (zn::zs) res ((xn, xt)::xs) ((yn, yt)::ys) = case (xn == zn, yn == zn) of + (True , True ) => alignArgsInner zs ((zn, unifyArgs xt yt zn)::res) xs ys + (True , False) => alignArgsInner zs ((zn, processArg xt zn)::res) xs ((yn, yt)::ys) + (False, True ) => alignArgsInner zs ((zn, processArg yt zn)::res) ((xn, xt)::xs) ys + (False, False) => [(zn, var zn)] + alignArgsInner (zn::zs) res ((xn, xt)::xs) [] = case (xn == zn) of + True => alignArgsInner zs ((zn, processArg xt zn)::res) xs [] + False => [(zn, var zn)] + alignArgsInner (zn::zs) res [] ((yn, yt)::ys) = case (yn == zn) of + True => alignArgsInner zs ((zn, processArg yt zn)::res) [] ys + False => [(zn, var zn)] + alignArgsInner (zn::zs) res [] [] = [(zn, var zn)] + +-- alignArgs : List (Name, TTImp) -> List (Name, TTImp) -> List Name -> List TTImp +-- alignArgs xs ys zs = reverse $ alignArgsInner [] xs ys zs where +-- alignArgsInner : List TTImp -> List (Name, TTImp) -> List (Name, TTImp) -> List Name -> List TTImp +-- alignArgsInner res _ _ [] = res +-- alignArgsInner res ((xn, xt)::xs) ((yn, yt)::ys) (zn::zs) = case (xn == zn, yn == zn) of +-- (True , True ) => alignArgsInner ((unifyArgs xt yt zn)::res) xs ys zs +-- (True , False) => alignArgsInner ((processArg xt zn)::res) xs ((yn, yt)::ys) zs +-- (False, True ) => alignArgsInner ((processArg yt zn)::res) ((xn, xt)::xs) ys zs +-- (False, False) => [var zn] +-- alignArgsInner res ((xn, xt)::xs) [] (zn::zs) = case (xn == zn) of +-- True => alignArgsInner ((processArg xt zn)::res) xs [] zs +-- False => [var zn] +-- alignArgsInner res [] ((yn, yt)::ys) (zn::zs) = case (yn == zn) of +-- True => alignArgsInner ((processArg yt zn)::res) [] ys zs +-- False => [var zn] +-- alignArgsInner res [] [] (zn::zs) = [var zn] + +-- index instead of intermediate name +-- Name (List? String), Type (TTImp), Args (List Name) +-- fuseConstrucror : List Name -> (Con, List Name) -> (Con, List Name) -> List (Name, List TTImp) +fuseConstrucror : List Name -> (Name, List TTImp, List Name) -> (Name, List TTImp, List Name) -> (Name, List TTImp, List Name) +fuseConstrucror zl (xName, xArgs, xArgNames) (yName, yArgs, yArgNames) = do let xyName = joinBy "_" [nameStr xName, nameStr yName] - let xType = xc.type - let yType = yc.type + let xArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip xArgNames xArgs + let yArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip yArgNames yArgs - let (_, xApps) = Reflection.unAppAny xType - let (_, yApps) = Reflection.unAppAny yType + let xyAligned = alignArgs zl xArgsZipped yArgsZipped + let xyArgNames = map (\(names, _) => names) xyAligned + let xyArgs = map (\(_, args) => args) xyAligned + let correctlyAligned = (==) Nothing $ find ((==) type) xyArgs - let xArgs = map getExpr xApps - let yArgs = map getExpr yApps - - let xArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip xl xArgs - let yArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip yl yArgs - - let xyAligned = alignArgs xArgsZipped yArgsZipped zl - let correctlyAligned = (==) 0 $ length $ Prelude.List.filter (\xy => xy == (type)) xyAligned - - if correctlyAligned then [(UN (Basic xyName), xyAligned)] else [] + if correctlyAligned then (UN (Basic xyName), xyArgs, xyArgNames) else (UN (Basic "fail"), [], []) foldConstructor : TTImp -> List TTImp -> TTImp @@ -80,28 +95,61 @@ foldConstructor = foldl app splitRhsDef : List TTImp -> TTImp -splitRhsDef tpe = foldConstructor (var `{Builtin.MkPair}) tpe +splitRhsDef [] = type +splitRhsDef (t::[]) = t +splitRhsDef (t::ts) = app (var `{Builtin.MkPair} .$ t) (splitRhsDef ts) splitRhsClaim : List TTImp -> TTImp -splitRhsClaim tpe = foldConstructor (var `{Builtin.Pair}) tpe +splitRhsClaim [] = type +splitRhsClaim (t::[]) = t +splitRhsClaim (t::ts) = app (var `{Builtin.Pair} .$ t) (splitRhsClaim ts) -splitClauses : TTImp -> List (Con, Con) -> List Clause -splitClauses sc = map (\(xc, yc) => patClause (app sc $ var $ UN $ Basic (joinBy "_" [nameStr xc.name, nameStr yc.name])) (splitRhsDef [var (UN $ Basic $ nameStr xc.name), var (UN $ Basic $ nameStr yc.name)])) +splitClauses : TTImp -> List (List String) -> List Clause +splitClauses sc = map ( + \cs => + patClause + (app sc $ var $ UN $ Basic (joinBy "_" cs)) + (splitRhsDef (map (\c => var (UN $ Basic c)) cs)) + ) splitReturnType : List Name -> List (List Name) -> List TTImp -splitReturnType tnl anll = map (\(t, al) => foldConstructor t al) $ zip (map (var . UN . Basic . nameStr) tnl) (map (map (.bindVar)) anll) +splitReturnType tnl anll = map + (\(t, al) => foldConstructor t al) $ + zip (map (var . UN . Basic . nameStr) tnl) (map (map (.bindVar)) anll) -combinations : List (List Nat) -> List (List Nat) +combinations : List (List a) -> List (List a) -- Vect to precisely express number of elements in tuple combinations l = map reverse $ combinationsInner l [[]] where - combinationsInner : List (List Nat) -> List (List Nat) -> List (List Nat) + combinationsInner : List (List a) -> List (List a) -> List (List a) combinationsInner (xs::xss) rss = combinationsInner xss $ join $ map (\x => map (\rs => x :: rs) rss) xs combinationsInner [] rss = rss -deriveFusion : List (TypeInfo, List Name) -> (List Decl) +-- combinations' : Vect (S $ S n) (List1 a) -> List1 (Vect (S $ S n) a) -- Vect to precisely express number of elements in tuple +-- combinations' l = map reverse $ combinationsInner l [Nil] where +-- combinationsInner : Vect m (List1 a) -> List1 (Vect k a) -> List1 (Vect (m + k) a) +-- combinationsInner (xs::xss) rss = combinationsInner xss $ join $ map (\x => map (\rs => x :: rs) rss) xs +-- combinationsInner Nil rss = rss + + + +public export +record FusionDecl where + constructor MkFusionDecl + dataType : Decl + splitClaim : Decl + splitDef : Decl + + +prepareConArgs : TTImp -> List TTImp +prepareConArgs t = do + let (_, tApps) = Reflection.unAppAny t + map getExpr tApps + + +deriveFusion : List (TypeInfo, List Name) -> Maybe FusionDecl deriveFusion l = do let typeNames = map (\(n, _) => n.name) l @@ -117,20 +165,29 @@ deriveFusion l = do let correctDecl = (length uniqueArgs) == (length uniqueNames) let typeSignature = buildIPi uniqueArgs - let consProduct = [ (xc, xl, yc, yl) | (xt, xl) <- l, (yt, yl) <- l, xt.name < yt.name, xc <- xt.cons, yc <- yt.cons] - -- all combinations from given lists (constructors) - let preCons = join $ map (fuseConstrucror uniqueNames) consProduct - let fusedCons = map (\(cn, lt) => mkTy cn (foldConstructor (var fusionTypeName) lt)) preCons + let consAll = map (\(t, args) => map (\c => (c, args)) t.cons) l + let consComb = combinations consAll + let consCombPrepared = map (map (\(con, args) => (con.name, prepareConArgs con.type, args))) consComb + let preFusedCons = map (\x => foldl (fuseConstrucror uniqueNames) (case x of { + [] => (UN (Basic "fail"), [], []) + (a::_) => a}) (drop 1 x)) consCombPrepared + let filteredFusedCons = filter (\(n, _, _) => n /= UN (Basic "fail")) preFusedCons + let fusedCons = map (\(cn, lt, _) => mkTy cn (foldConstructor (var fusionTypeName) (map bindArgs lt))) filteredFusedCons let splitName = UN $ Basic ("split" ++ joinedNames) let argNamesList = map (\(_, anl) => anl) l let dataDecl = iData Export fusionTypeName typeSignature [] fusedCons - let claimDecl = export' splitName ((arg $ foldConstructor (var fusionTypeName) (map (.bindVar) uniqueNames)) .-> splitRhsClaim (splitReturnType typeNames argNamesList)) - let defDecl = def splitName $ splitClauses (var splitName) (map (\(cx, _, cy, _) => (cx, cy)) consProduct) + let claimDecl = export' splitName ((arg $ + foldConstructor (var fusionTypeName) (map (.bindVar) uniqueNames)) .-> + splitRhsClaim (splitReturnType typeNames argNamesList)) + + let defCases = def splitName $ splitClauses (var splitName) (map (map (\(c, _) => nameStr c.name)) consComb) + let defImpossible = def splitName [impossibleClause (var splitName .$ implicitTrue)] + let defDecl = if (length fusedCons /= 0) then defCases else defImpossible - if correctDecl then (if (length fusedCons /= 0) then [dataDecl, claimDecl, defDecl] else [dataDecl]) else [] + if correctDecl then Just (MkFusionDecl dataDecl claimDecl defDecl) else Nothing buildConFromOther : TTImp -> List (Name, TTImp) -> List Name -> TTImp @@ -140,15 +197,15 @@ buildConFromOther res la (n::ns) = do case ma of {Nothing => type; Just (_, tt) => buildConFromOther (app res tt) la ns} -declareFusion : List (TypeInfo, List Name) -> Elab (List Decl) +declareFusion : List (TypeInfo, List Name) -> Elab (Maybe FusionDecl) declareFusion l = do let derived = deriveFusion l - declare derived + case derived of {Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef]; Nothing => declare []} pure $ derived public export -runFusion : Name -> List Name -> Name -> List Name -> Elab (List Decl) +runFusion : Name -> List Name -> Name -> List Name -> Elab (Maybe FusionDecl) runFusion x xArgs y yArgs = do xTI <- getInfo' x yTI <- getInfo' y @@ -156,19 +213,32 @@ runFusion x xArgs y yArgs = do declareFusion zipped +-- public export +-- runFusionList : List (Name, List Name) -> ELab (Maybe FusionDecl) +-- runFusionList l = declareFusion $ map (\(n, args) => { do info <- getInfo' n; (info, args)}) l + + public export -getFusion : List Decl -> List Decl -getFusion = take 1 +runFusionThree : Name -> List Name -> Name -> List Name -> Name -> List Name -> Elab (Maybe FusionDecl) +runFusionThree x xArgs y yArgs z zArgs = do + xTI <- getInfo' x + yTI <- getInfo' y + zTI <- getInfo' z + let zipped = [(xTI, xArgs), (yTI, yArgs), (zTI, zArgs)] + declareFusion zipped + public export -getSplit : List Decl -> List Decl -getSplit = drop 1 +getFusion : Maybe FusionDecl -> List Decl +getFusion Nothing = [] +getFusion (Just fd) = [(fd.dataType)] --- data X : Type -> Type -> Type where --- MkX : X m n --- data Y : Type -> Type -> Type where --- MkY : Y m n +public export +getSplit : Maybe FusionDecl -> List Decl +getSplit Nothing = [] +getSplit (Just fd) = [fd.splitClaim, fd.splitDef] + -- %language ElabReflection @@ -182,3 +252,4 @@ getSplit = drop 1 -- tests for order of dependent arguments -- preserve order of args from left to right -- TODO: fusion for more than 2 types +-- fold fuseConstructor on combinations diff --git a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr index 89e8bce09..19629eca9 100644 --- a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr @@ -13,7 +13,7 @@ data Y : Type -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr index 730969621..240c465bf 100644 --- a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr @@ -15,7 +15,7 @@ data Y : Type -> Type -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] main : IO () diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr index 206ec61f4..ee535357b 100644 --- a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Type -> Type -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] main : IO () diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr index 0c976c1e4..80c200ef4 100644 --- a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Nat -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr index 2a0eca0a0..b3de39f07 100644 --- a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Nat -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr index fb36bfd96..40888bd38 100644 --- a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Nat -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr index 30bec0a41..a8905c0e5 100644 --- a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : String -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr index 8758de682..7d7cab4d9 100644 --- a/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Type -> Type -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] main : IO () diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr b/tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr new file mode 100644 index 000000000..5c19bb16e --- /dev/null +++ b/tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type where + MkX : X n + +data Y : Type -> Type where + MkY : Y n + +data Z : Type -> Type where + MkZ : Z n + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusionThree `{X} [`{n}] `{Y} [`{n}] `{Z} [`{n}] + +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/derive.ipkg b/tests/derivation/utils/fusion/merger/009 three types fusion/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/009 three types fusion/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/expected b/tests/derivation/utils/fusion/merger/009 three types fusion/expected new file mode 100644 index 000000000..3201cc8a3 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/009 three types fusion/expected @@ -0,0 +1,12 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XYZ" + (Just (MkArg MW ExplicitArg (Just "n") type .-> type)) + [] + [mkTy {name = "MkX_MkY_MkZ", type = var "XYZ" .$ bindVar "n"}]) +] diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/run b/tests/derivation/utils/fusion/merger/009 three types fusion/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/009 three types fusion/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr index 6d5097730..fec14da88 100644 --- a/tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr @@ -13,7 +13,7 @@ data Y : Type -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr index 4002c5ef5..b60348b96 100644 --- a/tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr @@ -15,7 +15,7 @@ data Y : Type -> Type -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] main : IO () diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr index 648431c41..2dec6cbc8 100644 --- a/tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Type -> Type -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] main : IO () diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr index 599c6f3b7..73734ed42 100644 --- a/tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Nat -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr index 33bdd8fc3..dc39cb8a3 100644 --- a/tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Nat -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr index fab60b2e3..addb061fe 100644 --- a/tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Nat -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/expected b/tests/derivation/utils/fusion/splitter/006 const-const no match/expected index 02e9acf39..40a1b3fa5 100644 --- a/tests/derivation/utils/fusion/splitter/006 const-const no match/expected +++ b/tests/derivation/utils/fusion/splitter/006 const-const no match/expected @@ -1,2 +1,16 @@ 1/1: Building DerivedGen (DerivedGen.idr) -[] +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXY" + , type = + MkArg MW ExplicitArg Nothing (var "XY" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "n") + .$ (var "Y" .$ bindVar "n") + }) +, IDef emptyFC "splitXY" [impossibleClause (var "splitXY" .$ implicitTrue)] +] diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr index 91f4bfda4..9b6e86fa2 100644 --- a/tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : String -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr index 6ccbd0f09..8d3353c5b 100644 --- a/tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr @@ -14,7 +14,7 @@ data Y : Type -> Type -> Type where %language ElabReflection -decl : List Decl +decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] main : IO () diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr new file mode 100644 index 000000000..548a0c62a --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type where + MkX : X n + +data Y : Type -> Type where + MkY : Y n + +data Z : Type -> Type where + MkZ : Z n + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusionThree `{X} [`{n}] `{Y} [`{n}] `{Z} [`{n}] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/derive.ipkg b/tests/derivation/utils/fusion/splitter/009 three types fusion/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/009 three types fusion/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/expected b/tests/derivation/utils/fusion/splitter/009 three types fusion/expected new file mode 100644 index 000000000..947c0470b --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/009 three types fusion/expected @@ -0,0 +1,25 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXYZ" + , type = + MkArg MW ExplicitArg Nothing (var "XYZ" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "n") + .$ ( var "Builtin.Pair" + .$ (var "Y" .$ bindVar "n") + .$ (var "Z" .$ bindVar "n")) + }) +, IDef + emptyFC + "splitXYZ" + [ var "splitXYZ" .$ var "MkX_MkY_MkZ" + .= var "Builtin.MkPair" + .$ var "MkX" + .$ (var "Builtin.MkPair" .$ var "MkY" .$ var "MkZ") + ] +] diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/run b/tests/derivation/utils/fusion/splitter/009 three types fusion/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/009 three types fusion/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 2bb88ee2d5c5be33bf6d4131633527196c3be6b5 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Wed, 22 May 2024 19:11:59 +0300 Subject: [PATCH 06/53] refactoring fusion --- src/Deriving/DepTyCheck/Util/Fusion.idr | 178 +++++++----------- .../009 three types fusion/DerivedGen.idr | 2 +- .../010 three types two args/DerivedGen.idr | 23 +++ .../010 three types two args/derive.ipkg | 1 + .../merger/010 three types two args/expected | 20 ++ .../merger/010 three types two args/run | 1 + .../009 three types fusion/DerivedGen.idr | 2 +- .../010 three types two args/DerivedGen.idr | 23 +++ .../010 three types two args/derive.ipkg | 1 + .../010 three types two args/expected | 29 +++ .../splitter/010 three types two args/run | 1 + 11 files changed, 172 insertions(+), 109 deletions(-) create mode 100644 tests/derivation/utils/fusion/merger/010 three types two args/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/merger/010 three types two args/derive.ipkg create mode 100644 tests/derivation/utils/fusion/merger/010 three types two args/expected create mode 120000 tests/derivation/utils/fusion/merger/010 three types two args/run create mode 100644 tests/derivation/utils/fusion/splitter/010 three types two args/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/splitter/010 three types two args/derive.ipkg create mode 100644 tests/derivation/utils/fusion/splitter/010 three types two args/expected create mode 120000 tests/derivation/utils/fusion/splitter/010 three types two args/run diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index a3050fa4a..734023d82 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -6,11 +6,14 @@ import Language.Reflection.Derive import Language.Reflection.Pretty import Language.Reflection.Compat import Deriving.DepTyCheck.Util.Reflection +import Data.Nat %default total matchArgs : List Arg -> List Name -> Maybe (List (Name, TTImp)) -matchArgs na la = if length na == length la then Just (zip la (map (.type) na)) else Nothing +matchArgs na la = if length na == length la + then Just (zip la (map (.type) na)) + else Nothing buildIPi : List (Name, TTImp) -> TTImp @@ -39,55 +42,38 @@ bindArgs smth = smth alignArgs : List Name -> List (Name, TTImp) -> List (Name, TTImp) -> List (Name, TTImp) -alignArgs zs xs ys = reverse $ alignArgsInner zs [] xs ys where - alignArgsInner : List Name -> List (Name, TTImp) -> List (Name, TTImp) -> List (Name, TTImp) -> List (Name, TTImp) - alignArgsInner [] res _ _ = res - alignArgsInner (zn::zs) res ((xn, xt)::xs) ((yn, yt)::ys) = case (xn == zn, yn == zn) of - (True , True ) => alignArgsInner zs ((zn, unifyArgs xt yt zn)::res) xs ys - (True , False) => alignArgsInner zs ((zn, processArg xt zn)::res) xs ((yn, yt)::ys) - (False, True ) => alignArgsInner zs ((zn, processArg yt zn)::res) ((xn, xt)::xs) ys - (False, False) => [(zn, var zn)] - alignArgsInner (zn::zs) res ((xn, xt)::xs) [] = case (xn == zn) of - True => alignArgsInner zs ((zn, processArg xt zn)::res) xs [] - False => [(zn, var zn)] - alignArgsInner (zn::zs) res [] ((yn, yt)::ys) = case (yn == zn) of - True => alignArgsInner zs ((zn, processArg yt zn)::res) [] ys - False => [(zn, var zn)] - alignArgsInner (zn::zs) res [] [] = [(zn, var zn)] - --- alignArgs : List (Name, TTImp) -> List (Name, TTImp) -> List Name -> List TTImp --- alignArgs xs ys zs = reverse $ alignArgsInner [] xs ys zs where --- alignArgsInner : List TTImp -> List (Name, TTImp) -> List (Name, TTImp) -> List Name -> List TTImp --- alignArgsInner res _ _ [] = res --- alignArgsInner res ((xn, xt)::xs) ((yn, yt)::ys) (zn::zs) = case (xn == zn, yn == zn) of --- (True , True ) => alignArgsInner ((unifyArgs xt yt zn)::res) xs ys zs --- (True , False) => alignArgsInner ((processArg xt zn)::res) xs ((yn, yt)::ys) zs --- (False, True ) => alignArgsInner ((processArg yt zn)::res) ((xn, xt)::xs) ys zs --- (False, False) => [var zn] --- alignArgsInner res ((xn, xt)::xs) [] (zn::zs) = case (xn == zn) of --- True => alignArgsInner ((processArg xt zn)::res) xs [] zs --- False => [var zn] --- alignArgsInner res [] ((yn, yt)::ys) (zn::zs) = case (yn == zn) of --- True => alignArgsInner ((processArg yt zn)::res) [] ys zs --- False => [var zn] --- alignArgsInner res [] [] (zn::zs) = [var zn] - --- index instead of intermediate name --- Name (List? String), Type (TTImp), Args (List Name) --- fuseConstrucror : List Name -> (Con, List Name) -> (Con, List Name) -> List (Name, List TTImp) +alignArgs zs xs ys = go zs xs ys where + go : List Name -> List (Name, TTImp) -> List (Name, TTImp) -> List (Name, TTImp) + go [] _ _ = [] + go (zn::zs) [] [] = [] + go (zn::zs) ((xn, xt)::xs) ((yn, yt)::ys) = case (xn == zn, yn == zn) of + (True , True ) => (zn, unifyArgs xt yt zn)::(go zs xs ys) + (True , False) => (zn, processArg xt zn) ::(go zs xs ((yn, yt)::ys)) + (False, True ) => (zn, processArg yt zn) ::(go zs ((xn, xt)::xs) ys) + (False, False) => (go zs ((xn, xt)::xs) ((yn, yt)::ys)) + go (zn::zs) ((xn, xt)::xs) [] = case (xn == zn) of + True => (zn, processArg xt zn)::(go zs xs []) + False => (go zs xs []) + go (zn::zs) [] ((yn, yt)::ys) = case (yn == zn) of + True => (zn, processArg yt zn)::(go zs [] ys) + False => (go zs [] ys) + + fuseConstrucror : List Name -> (Name, List TTImp, List Name) -> (Name, List TTImp, List Name) -> (Name, List TTImp, List Name) fuseConstrucror zl (xName, xArgs, xArgNames) (yName, yArgs, yArgNames) = do let xyName = joinBy "_" [nameStr xName, nameStr yName] - let xArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip xArgNames xArgs - let yArgsZipped = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ zip yArgNames yArgs + let xArgsZipped = sortBy (comparing fst) $ zip xArgNames xArgs + let yArgsZipped = sortBy (comparing fst) $ zip yArgNames yArgs + + let xyAligned = alignArgs zl xArgsZipped yArgsZipped + let xyArgNames = map fst xyAligned + let xyArgs = map snd xyAligned - let xyAligned = alignArgs zl xArgsZipped yArgsZipped - let xyArgNames = map (\(names, _) => names) xyAligned - let xyArgs = map (\(_, args) => args) xyAligned - let correctlyAligned = (==) Nothing $ find ((==) type) xyArgs + let Nothing = find ((==) type) xyArgs + | Just _ => (UN (Basic "fail"), [], []) - if correctlyAligned then (UN (Basic xyName), xyArgs, xyArgNames) else (UN (Basic "fail"), [], []) + (UN (Basic xyName), xyArgs, xyArgNames) foldConstructor : TTImp -> List TTImp -> TTImp @@ -106,35 +92,29 @@ splitRhsClaim (t::ts) = app (var `{Builtin.Pair} .$ t) (splitRhsClaim ts) splitClauses : TTImp -> List (List String) -> List Clause -splitClauses sc = map ( +splitClauses sc = map \cs => - patClause - (app sc $ var $ UN $ Basic (joinBy "_" cs)) - (splitRhsDef (map (\c => var (UN $ Basic c)) cs)) - ) + patClause + (app sc $ var $ UN $ Basic (joinBy "_" cs)) + (splitRhsDef (map (\c => var (UN $ Basic c)) cs)) + splitReturnType : List Name -> List (List Name) -> List TTImp splitReturnType tnl anll = map (\(t, al) => foldConstructor t al) $ - zip (map (var . UN . Basic . nameStr) tnl) (map (map (.bindVar)) anll) + zip + (map (var . UN . Basic . nameStr) tnl) + (map (map (.bindVar)) anll) -combinations : List (List a) -> List (List a) -- Vect to precisely express number of elements in tuple +combinations : List (List a) -> List (List a) combinations l = map reverse $ combinationsInner l [[]] where combinationsInner : List (List a) -> List (List a) -> List (List a) combinationsInner (xs::xss) rss = combinationsInner xss $ join $ map (\x => map (\rs => x :: rs) rss) xs combinationsInner [] rss = rss --- combinations' : Vect (S $ S n) (List1 a) -> List1 (Vect (S $ S n) a) -- Vect to precisely express number of elements in tuple --- combinations' l = map reverse $ combinationsInner l [Nil] where --- combinationsInner : Vect m (List1 a) -> List1 (Vect k a) -> List1 (Vect (m + k) a) --- combinationsInner (xs::xss) rss = combinationsInner xss $ join $ map (\x => map (\rs => x :: rs) rss) xs --- combinationsInner Nil rss = rss - - - public export record FusionDecl where constructor MkFusionDecl @@ -149,7 +129,7 @@ prepareConArgs t = do map getExpr tApps -deriveFusion : List (TypeInfo, List Name) -> Maybe FusionDecl +deriveFusion : List (TypeInfo, List Name) -> Maybe FusionDecl -- rewrite to smaller functions, List1, Vect to optimize deriveFusion l = do let typeNames = map (\(n, _) => n.name) l @@ -158,49 +138,50 @@ deriveFusion l = do let fusionTypeName = UN $ Basic joinedNames let typeArgs = map (\(ti, la) => matchArgs ti.args la) l - let typeArgsDefault = map (\ta => case ta of {Just x => x; _ => []}) typeArgs -- should finish with error if any is Nothing - let checkArgs = sortBy (\(n1, _), (n2, _) => compare n1 n2) $ join typeArgsDefault + let False = any isNothing typeArgs + | True => Nothing + + let typeArgsDefault = catMaybes typeArgs + let checkArgs = sortBy (comparing fst) $ join typeArgsDefault let uniqueArgs = nub checkArgs -- argument types should be same in every type - let uniqueNames = nub $ sort $ join $ map (\(_, la) => la) l + let uniqueNames = nub $ sort $ join $ map snd l - let correctDecl = (length uniqueArgs) == (length uniqueNames) + let True = length uniqueArgs == length uniqueNames + | False => Nothing let typeSignature = buildIPi uniqueArgs let consAll = map (\(t, args) => map (\c => (c, args)) t.cons) l let consComb = combinations consAll let consCombPrepared = map (map (\(con, args) => (con.name, prepareConArgs con.type, args))) consComb - let preFusedCons = map (\x => foldl (fuseConstrucror uniqueNames) (case x of { - [] => (UN (Basic "fail"), [], []) - (a::_) => a}) (drop 1 x)) consCombPrepared - let filteredFusedCons = filter (\(n, _, _) => n /= UN (Basic "fail")) preFusedCons - let fusedCons = map (\(cn, lt, _) => mkTy cn (foldConstructor (var fusionTypeName) (map bindArgs lt))) filteredFusedCons + let preFusedCons = consCombPrepared <&> \x => foldl (fuseConstrucror uniqueNames) (case x of + [] => (UN (Basic "fail"), [], []) + (a::_) => a) (drop 1 x) + let filteredFusedCons = filter (((/=) $ UN (Basic "fail")) . fst) preFusedCons + let fusedCons = map + (\(cn, lt, _) => mkTy cn (foldConstructor (var fusionTypeName) (map bindArgs lt))) + filteredFusedCons let splitName = UN $ Basic ("split" ++ joinedNames) - let argNamesList = map (\(_, anl) => anl) l + let argNamesList = map snd l let dataDecl = iData Export fusionTypeName typeSignature [] fusedCons - let claimDecl = export' splitName ((arg $ - foldConstructor (var fusionTypeName) (map (.bindVar) uniqueNames)) .-> - splitRhsClaim (splitReturnType typeNames argNamesList)) - - let defCases = def splitName $ splitClauses (var splitName) (map (map (\(c, _) => nameStr c.name)) consComb) - let defImpossible = def splitName [impossibleClause (var splitName .$ implicitTrue)] - let defDecl = if (length fusedCons /= 0) then defCases else defImpossible + let claimDecl = export' splitName $ + (arg $ foldConstructor (var fusionTypeName) (map (.bindVar) uniqueNames)) .-> + splitRhsClaim (splitReturnType typeNames argNamesList) - if correctDecl then Just (MkFusionDecl dataDecl claimDecl defDecl) else Nothing + let defDecl = if (not $ null fusedCons) + then def splitName $ splitClauses (var splitName) (map (map (nameStr . (.name) . fst)) consComb) + else def splitName [impossibleClause (var splitName .$ implicitTrue)] - -buildConFromOther : TTImp -> List (Name, TTImp) -> List Name -> TTImp -buildConFromOther res _ [] = res -buildConFromOther res la (n::ns) = do - let ma = find (\(na, _) => na == n) la - case ma of {Nothing => type; Just (_, tt) => buildConFromOther (app res tt) la ns} + Just (MkFusionDecl dataDecl claimDecl defDecl) declareFusion : List (TypeInfo, List Name) -> Elab (Maybe FusionDecl) declareFusion l = do let derived = deriveFusion l - case derived of {Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef]; Nothing => declare []} + case derived of + Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef] + Nothing => declare [] pure $ derived @@ -213,19 +194,11 @@ runFusion x xArgs y yArgs = do declareFusion zipped --- public export --- runFusionList : List (Name, List Name) -> ELab (Maybe FusionDecl) --- runFusionList l = declareFusion $ map (\(n, args) => { do info <- getInfo' n; (info, args)}) l - - public export -runFusionThree : Name -> List Name -> Name -> List Name -> Name -> List Name -> Elab (Maybe FusionDecl) -runFusionThree x xArgs y yArgs z zArgs = do - xTI <- getInfo' x - yTI <- getInfo' y - zTI <- getInfo' z - let zipped = [(xTI, xArgs), (yTI, yArgs), (zTI, zArgs)] - declareFusion zipped +runFusionList : List (Name, List Name) -> Elab (Maybe FusionDecl) +runFusionList l = do + l' <- for l $ \(n, args) => (, args) <$> getInfo' n + declareFusion l' public export @@ -240,16 +213,7 @@ getSplit Nothing = [] getSplit (Just fd) = [fd.splitClaim, fd.splitDef] --- %language ElabReflection - --- decl : List Decl --- decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{k}] - --- test : IO () --- test = putPretty decl - -- TODO: what happens with :doc -- tests for order of dependent arguments -- preserve order of args from left to right --- TODO: fusion for more than 2 types --- fold fuseConstructor on combinations +-- TODO: List Arg -> group and filter which to fuse (argDeps) diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr b/tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr index 5c19bb16e..8516bdf52 100644 --- a/tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr +++ b/tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr @@ -17,7 +17,7 @@ data Z : Type -> Type where %language ElabReflection decl : Maybe FusionDecl -decl = %runElab runFusionThree `{X} [`{n}] `{Y} [`{n}] `{Z} [`{n}] +decl = %runElab runFusionList [(`{X}, [`{n}]), (`{Y}, [`{n}]), (`{Z}, [`{n}])] main : IO () main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/010 three types two args/DerivedGen.idr b/tests/derivation/utils/fusion/merger/010 three types two args/DerivedGen.idr new file mode 100644 index 000000000..0291869d5 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/010 three types two args/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type -> Type where + MkX : X n m + +data Y : Type -> Type -> Type where + MkY : Y n m + +data Z : Type -> Type -> Type where + MkZ : Z n m + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusionList [(`{X}, [`{n}, `{m}]), (`{Y}, [`{m}, `{k}]), (`{Z}, [`{k}, `{n}])] + +main : IO () +main = putPretty $ getFusion decl diff --git a/tests/derivation/utils/fusion/merger/010 three types two args/derive.ipkg b/tests/derivation/utils/fusion/merger/010 three types two args/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/merger/010 three types two args/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/merger/010 three types two args/expected b/tests/derivation/utils/fusion/merger/010 three types two args/expected new file mode 100644 index 000000000..f8a219b84 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/010 three types two args/expected @@ -0,0 +1,20 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IData + emptyFC + (specified Export) + Nothing + (MkData + emptyFC + "XYZ" + (Just + ( MkArg MW ExplicitArg (Just "k") type + .-> MkArg MW ExplicitArg (Just "m") type + .-> MkArg MW ExplicitArg (Just "n") type + .-> type)) + [] + [ mkTy + { name = "MkX_MkY_MkZ" + , type = var "XYZ" .$ bindVar "k" .$ bindVar "m" .$ bindVar "n" + } + ]) +] diff --git a/tests/derivation/utils/fusion/merger/010 three types two args/run b/tests/derivation/utils/fusion/merger/010 three types two args/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/merger/010 three types two args/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr index 548a0c62a..9538e51aa 100644 --- a/tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr +++ b/tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr @@ -17,7 +17,7 @@ data Z : Type -> Type where %language ElabReflection decl : Maybe FusionDecl -decl = %runElab runFusionThree `{X} [`{n}] `{Y} [`{n}] `{Z} [`{n}] +decl = %runElab runFusionList [(`{X}, [`{n}]), (`{Y}, [`{n}]), (`{Z}, [`{n}])] main : IO () main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/010 three types two args/DerivedGen.idr b/tests/derivation/utils/fusion/splitter/010 three types two args/DerivedGen.idr new file mode 100644 index 000000000..3f74e83c1 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/010 three types two args/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type -> Type where + MkX : X n m + +data Y : Type -> Type -> Type where + MkY : Y n m + +data Z : Type -> Type -> Type where + MkZ : Z n m + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusionList [(`{X}, [`{n}, `{m}]), (`{Y}, [`{m}, `{k}]), (`{Z}, [`{k}, `{n}])] + +main : IO () +main = putPretty $ getSplit decl diff --git a/tests/derivation/utils/fusion/splitter/010 three types two args/derive.ipkg b/tests/derivation/utils/fusion/splitter/010 three types two args/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/010 three types two args/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/010 three types two args/expected b/tests/derivation/utils/fusion/splitter/010 three types two args/expected new file mode 100644 index 000000000..653dfc9b2 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/010 three types two args/expected @@ -0,0 +1,29 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "splitXYZ" + , type = + MkArg + MW + ExplicitArg + Nothing + (var "XYZ" .$ bindVar "k" .$ bindVar "m" .$ bindVar "n") + .-> var "Builtin.Pair" + .$ (var "X" .$ bindVar "n" .$ bindVar "m") + .$ ( var "Builtin.Pair" + .$ (var "Y" .$ bindVar "m" .$ bindVar "k") + .$ (var "Z" .$ bindVar "k" .$ bindVar "n")) + }) +, IDef + emptyFC + "splitXYZ" + [ var "splitXYZ" .$ var "MkX_MkY_MkZ" + .= var "Builtin.MkPair" + .$ var "MkX" + .$ (var "Builtin.MkPair" .$ var "MkY" .$ var "MkZ") + ] +] diff --git a/tests/derivation/utils/fusion/splitter/010 three types two args/run b/tests/derivation/utils/fusion/splitter/010 three types two args/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/splitter/010 three types two args/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From a325fc6fd33df53541409b9b40e7c13e3f8b6ec0 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Wed, 22 May 2024 21:28:35 +0300 Subject: [PATCH 07/53] rewrite fusion to use Vect and List1 --- src/Deriving/DepTyCheck/Util/Fusion.idr | 59 +++++++++++-------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index 734023d82..971d89346 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -5,6 +5,7 @@ import Language.Reflection.TTImp import Language.Reflection.Derive import Language.Reflection.Pretty import Language.Reflection.Compat +import Deriving.DepTyCheck.Util.Collections import Deriving.DepTyCheck.Util.Reflection import Data.Nat @@ -93,11 +94,10 @@ splitRhsClaim (t::ts) = app (var `{Builtin.Pair} .$ t) (splitRhsClaim ts) splitClauses : TTImp -> List (List String) -> List Clause splitClauses sc = map - \cs => + (\cs => patClause (app sc $ var $ UN $ Basic (joinBy "_" cs)) - (splitRhsDef (map (\c => var (UN $ Basic c)) cs)) - + (splitRhsDef (map (\c => var (UN $ Basic c)) cs))) splitReturnType : List Name -> List (List Name) -> List TTImp @@ -108,13 +108,6 @@ splitReturnType tnl anll = map (map (map (.bindVar)) anll) -combinations : List (List a) -> List (List a) -combinations l = map reverse $ combinationsInner l [[]] where - combinationsInner : List (List a) -> List (List a) -> List (List a) - combinationsInner (xs::xss) rss = combinationsInner xss $ join $ map (\x => map (\rs => x :: rs) rss) xs - combinationsInner [] rss = rss - - public export record FusionDecl where constructor MkFusionDecl @@ -129,40 +122,42 @@ prepareConArgs t = do map getExpr tApps -deriveFusion : List (TypeInfo, List Name) -> Maybe FusionDecl -- rewrite to smaller functions, List1, Vect to optimize -deriveFusion l = do +fusionTypeName : List Name -> Name +fusionTypeName = UN . Basic . (joinBy "") . (map nameStr) - let typeNames = map (\(n, _) => n.name) l - let typeNamesStr = map nameStr typeNames - let joinedNames = joinBy "" typeNamesStr - let fusionTypeName = UN $ Basic joinedNames + +deriveFusion : Vect (2 + n) (TypeInfo, List Name) -> Maybe FusionDecl +deriveFusion l = do + let typeNames = toList $ map ((.name) . fst) l + let fusionTypeName = fusionTypeName $ typeNames let typeArgs = map (\(ti, la) => matchArgs ti.args la) l let False = any isNothing typeArgs | True => Nothing - let typeArgsDefault = catMaybes typeArgs - let checkArgs = sortBy (comparing fst) $ join typeArgsDefault - let uniqueArgs = nub checkArgs -- argument types should be same in every type - let uniqueNames = nub $ sort $ join $ map snd l + let uniqueArgs = nub $ (sortBy (comparing fst)) $ join $ catMaybes $ toList typeArgs -- arg types from type signature + let uniqueNames = nub $ sort $ join $ toList $ map snd l -- names from target type constructor - let True = length uniqueArgs == length uniqueNames + let True = length uniqueArgs == length uniqueNames -- same parameter name could not be associated with different types | False => Nothing let typeSignature = buildIPi uniqueArgs - let consAll = map (\(t, args) => map (\c => (c, args)) t.cons) l + let consPre = map (\(t, args) => (t.cons, args)) l + let True = all (not . Prelude.null . fst) consPre + | False => Nothing + let consML1 = map (\(cons, args) => (toList1' cons, args)) consPre -- how to prove and use toList? + let consL1 = map (\(cons, args) => case cons of {Just x => (x, args); Nothing => ((MkCon (UN (Basic "")) [] type):::[], args)}) consML1 + let consAll = map (\(cons, args) => map (\c => (c, args)) cons) consL1 let consComb = combinations consAll let consCombPrepared = map (map (\(con, args) => (con.name, prepareConArgs con.type, args))) consComb - let preFusedCons = consCombPrepared <&> \x => foldl (fuseConstrucror uniqueNames) (case x of - [] => (UN (Basic "fail"), [], []) - (a::_) => a) (drop 1 x) - let filteredFusedCons = filter (((/=) $ UN (Basic "fail")) . fst) preFusedCons + let preFusedCons = consCombPrepared <&> \x => foldl (fuseConstrucror uniqueNames) (head x) (tail x) + let filteredFusedCons = filter (((/=) $ UN (Basic "fail")) . fst) $ toList preFusedCons let fusedCons = map (\(cn, lt, _) => mkTy cn (foldConstructor (var fusionTypeName) (map bindArgs lt))) filteredFusedCons - let splitName = UN $ Basic ("split" ++ joinedNames) - let argNamesList = map snd l + let splitName = UN $ Basic ("split" ++ (nameStr fusionTypeName)) + let argNamesList = toList $ map snd l let dataDecl = iData Export fusionTypeName typeSignature [] fusedCons let claimDecl = export' splitName $ @@ -170,13 +165,13 @@ deriveFusion l = do splitRhsClaim (splitReturnType typeNames argNamesList) let defDecl = if (not $ null fusedCons) - then def splitName $ splitClauses (var splitName) (map (map (nameStr . (.name) . fst)) consComb) + then def splitName $ splitClauses (var splitName) $ toList (map (toList . (map (\(x, _) => nameStr x.name))) consComb) else def splitName [impossibleClause (var splitName .$ implicitTrue)] Just (MkFusionDecl dataDecl claimDecl defDecl) -declareFusion : List (TypeInfo, List Name) -> Elab (Maybe FusionDecl) +declareFusion : Vect (2 + n) (TypeInfo, List Name) -> Elab (Maybe FusionDecl) declareFusion l = do let derived = deriveFusion l case derived of @@ -190,12 +185,12 @@ runFusion : Name -> List Name -> Name -> List Name -> Elab (Maybe FusionDecl) runFusion x xArgs y yArgs = do xTI <- getInfo' x yTI <- getInfo' y - let zipped = [(xTI, xArgs), (yTI, yArgs)] + let zipped = (xTI, xArgs) :: (yTI, yArgs) :: Nil declareFusion zipped public export -runFusionList : List (Name, List Name) -> Elab (Maybe FusionDecl) +runFusionList : Vect (2 + n) (Name, List Name) -> Elab (Maybe FusionDecl) runFusionList l = do l' <- for l $ \(n, args) => (, args) <$> getInfo' n declareFusion l' From 9dabb5524becf8f67a01a30dc52992e9e39efc9c Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Mon, 27 May 2024 19:11:26 +0300 Subject: [PATCH 08/53] draft for fusion dependencies solver --- src/Deriving/DepTyCheck/Util/Fusion.idr | 22 ++++++++++++++++++- tests/Tests.idr | 1 + .../001 one var match/DerivedGen.idr | 14 ++++++++++++ .../depsolver/001 one var match/derive.ipkg | 1 + .../depsolver/001 one var match/expected | 2 ++ .../fusion/depsolver/001 one var match/run | 1 + .../002 one var no match/DerivedGen.idr | 14 ++++++++++++ .../002 one var no match/derive.ipkg | 1 + .../depsolver/002 one var no match/expected | 2 ++ .../fusion/depsolver/002 one var no match/run | 1 + .../003 two vars one match/DerivedGen.idr | 14 ++++++++++++ .../003 two vars one match/derive.ipkg | 1 + .../depsolver/003 two vars one match/expected | 2 ++ .../depsolver/003 two vars one match/run | 1 + .../004 three types one match/DerivedGen.idr | 16 ++++++++++++++ .../004 three types one match/derive.ipkg | 1 + .../004 three types one match/expected | 2 ++ .../depsolver/004 three types one match/run | 1 + .../fusion/depsolver/_common/derive.ipkg | 7 ++++++ .../utils/fusion/depsolver/_common/run | 9 ++++++++ 20 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 tests/derivation/utils/fusion/depsolver/001 one var match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/depsolver/001 one var match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/depsolver/001 one var match/expected create mode 120000 tests/derivation/utils/fusion/depsolver/001 one var match/run create mode 100644 tests/derivation/utils/fusion/depsolver/002 one var no match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/depsolver/002 one var no match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/depsolver/002 one var no match/expected create mode 120000 tests/derivation/utils/fusion/depsolver/002 one var no match/run create mode 100644 tests/derivation/utils/fusion/depsolver/003 two vars one match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/depsolver/003 two vars one match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/depsolver/003 two vars one match/expected create mode 120000 tests/derivation/utils/fusion/depsolver/003 two vars one match/run create mode 100644 tests/derivation/utils/fusion/depsolver/004 three types one match/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/depsolver/004 three types one match/derive.ipkg create mode 100644 tests/derivation/utils/fusion/depsolver/004 three types one match/expected create mode 120000 tests/derivation/utils/fusion/depsolver/004 three types one match/run create mode 100644 tests/derivation/utils/fusion/depsolver/_common/derive.ipkg create mode 100644 tests/derivation/utils/fusion/depsolver/_common/run diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index 971d89346..8a0f996f5 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -165,7 +165,7 @@ deriveFusion l = do splitRhsClaim (splitReturnType typeNames argNamesList) let defDecl = if (not $ null fusedCons) - then def splitName $ splitClauses (var splitName) $ toList (map (toList . (map (\(x, _) => nameStr x.name))) consComb) + then def splitName $ splitClauses (var splitName) $ toList (map (toList . (map (nameStr . (.name) . fst))) consComb) else def splitName [impossibleClause (var splitName .$ implicitTrue)] Just (MkFusionDecl dataDecl claimDecl defDecl) @@ -180,6 +180,26 @@ declareFusion l = do pure $ derived +prepareArgsSolve : Arg -> (Name, List String) +prepareArgsSolve a = do + let (xt, as) = Reflection.unAppAny a.type + let xn = case xt of {IVar _ n => n; _ => UN $ Basic "fail"} + let ts = map getExpr as + let ns = map (\t => case t of {IBindVar _ n => n; _ => "fail"}) ts + (xn, ns) + + +public export +solveDependencies : List Arg -> List (List (Name, List String)) +solveDependencies l = go l [] where + go : List Arg -> List (List (Name, List String)) -> List (List (Name, List String)) + go [] acc = map reverse acc + go (a::as) acc = go as (merge (prepareArgsSolve a) acc) where + merge : (Name, List String) -> List (List (Name, List String)) -> List (List (Name, List String)) + merge a [] = [[a]] + merge (m, as) (rs::rss) = if (any (not . Prelude.null . (intersect as) . snd) rs) then ((m, as)::rs)::rss else rs::(merge (m, as) rss) + + public export runFusion : Name -> List Name -> Name -> List Name -> Elab (Maybe FusionDecl) runFusion x xArgs y yArgs = do diff --git a/tests/Tests.idr b/tests/Tests.idr index 425b1f74b..750757ce3 100644 --- a/tests/Tests.idr +++ b/tests/Tests.idr @@ -14,6 +14,7 @@ main = goldenRunner $ , "Derivation utils: argument dependencies" `atDir` "derivation/utils/arg-deps" , "Derivation utils: data types fusion" `atDir` "derivation/utils/fusion/merger" , "Derivation utils: fused data types split" `atDir` "derivation/utils/fusion/splitter" + , "Derivation utils: dependency solver for fusion" `atDir` "derivation/utils/fusion/depsolver" , "Reflection utils: involved types" `atDir` "derivation/utils/involved-types" , "Derivation: input validation" `atDir` "derivation/inputvalidation" , "Derivation: running harness" `atDir` "derivation/infra" diff --git a/tests/derivation/utils/fusion/depsolver/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/depsolver/001 one var match/DerivedGen.idr new file mode 100644 index 000000000..ed358fde0 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/001 one var match/DerivedGen.idr @@ -0,0 +1,14 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + + +deps : List Arg +deps = [MkArg MW ExplicitArg Nothing (var "X" .$ bindVar "a"), MkArg MW ExplicitArg Nothing (var "Y" .$ bindVar "a")] + + +main : IO () +main = putPretty $ solveDependencies deps diff --git a/tests/derivation/utils/fusion/depsolver/001 one var match/derive.ipkg b/tests/derivation/utils/fusion/depsolver/001 one var match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/001 one var match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/depsolver/001 one var match/expected b/tests/derivation/utils/fusion/depsolver/001 one var match/expected new file mode 100644 index 000000000..fce161db9 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/001 one var match/expected @@ -0,0 +1,2 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[[("X", ["a"]), ("Y", ["a"])]] diff --git a/tests/derivation/utils/fusion/depsolver/001 one var match/run b/tests/derivation/utils/fusion/depsolver/001 one var match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/001 one var match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/depsolver/002 one var no match/DerivedGen.idr b/tests/derivation/utils/fusion/depsolver/002 one var no match/DerivedGen.idr new file mode 100644 index 000000000..8f019efb4 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/002 one var no match/DerivedGen.idr @@ -0,0 +1,14 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + + +deps : List Arg +deps = [MkArg MW ExplicitArg Nothing (var "X" .$ bindVar "a"), MkArg MW ExplicitArg Nothing (var "Y" .$ bindVar "b")] + + +main : IO () +main = putPretty $ solveDependencies deps diff --git a/tests/derivation/utils/fusion/depsolver/002 one var no match/derive.ipkg b/tests/derivation/utils/fusion/depsolver/002 one var no match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/002 one var no match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/depsolver/002 one var no match/expected b/tests/derivation/utils/fusion/depsolver/002 one var no match/expected new file mode 100644 index 000000000..daad2582c --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/002 one var no match/expected @@ -0,0 +1,2 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[[("X", ["a"])], [("Y", ["b"])]] diff --git a/tests/derivation/utils/fusion/depsolver/002 one var no match/run b/tests/derivation/utils/fusion/depsolver/002 one var no match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/002 one var no match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/depsolver/003 two vars one match/DerivedGen.idr b/tests/derivation/utils/fusion/depsolver/003 two vars one match/DerivedGen.idr new file mode 100644 index 000000000..eb3946929 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/003 two vars one match/DerivedGen.idr @@ -0,0 +1,14 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + + +deps : List Arg +deps = [MkArg MW ExplicitArg Nothing (var "X" .$ bindVar "a" .$ bindVar "b"), MkArg MW ExplicitArg Nothing (var "Y" .$ bindVar "b" .$ bindVar "c")] + + +main : IO () +main = putPretty $ solveDependencies deps diff --git a/tests/derivation/utils/fusion/depsolver/003 two vars one match/derive.ipkg b/tests/derivation/utils/fusion/depsolver/003 two vars one match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/003 two vars one match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/depsolver/003 two vars one match/expected b/tests/derivation/utils/fusion/depsolver/003 two vars one match/expected new file mode 100644 index 000000000..80f2ce404 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/003 two vars one match/expected @@ -0,0 +1,2 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[[("X", ["a", "b"]), ("Y", ["b", "c"])]] diff --git a/tests/derivation/utils/fusion/depsolver/003 two vars one match/run b/tests/derivation/utils/fusion/depsolver/003 two vars one match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/003 two vars one match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/depsolver/004 three types one match/DerivedGen.idr b/tests/derivation/utils/fusion/depsolver/004 three types one match/DerivedGen.idr new file mode 100644 index 000000000..00f8e84ad --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/004 three types one match/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + + +deps : List Arg +deps = [ MkArg MW ExplicitArg Nothing (var "X" .$ bindVar "a") + , MkArg MW ExplicitArg Nothing (var "Y" .$ bindVar "a") + , MkArg MW ExplicitArg Nothing (var "Z" .$ bindVar "b") ] + + +main : IO () +main = putPretty $ solveDependencies deps diff --git a/tests/derivation/utils/fusion/depsolver/004 three types one match/derive.ipkg b/tests/derivation/utils/fusion/depsolver/004 three types one match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/004 three types one match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/depsolver/004 three types one match/expected b/tests/derivation/utils/fusion/depsolver/004 three types one match/expected new file mode 100644 index 000000000..ad6c26e1c --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/004 three types one match/expected @@ -0,0 +1,2 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[[("X", ["a"]), ("Y", ["a"])], [("Z", ["b"])]] diff --git a/tests/derivation/utils/fusion/depsolver/004 three types one match/run b/tests/derivation/utils/fusion/depsolver/004 three types one match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/004 three types one match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/depsolver/_common/derive.ipkg b/tests/derivation/utils/fusion/depsolver/_common/derive.ipkg new file mode 100644 index 000000000..762febf26 --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/_common/derive.ipkg @@ -0,0 +1,7 @@ +package derive-test + +authors = "Simon Tsirikov" + +opts = "--no-color --console-width 0" + +depends = deptycheck diff --git a/tests/derivation/utils/fusion/depsolver/_common/run b/tests/derivation/utils/fusion/depsolver/_common/run new file mode 100644 index 000000000..2a6b6401c --- /dev/null +++ b/tests/derivation/utils/fusion/depsolver/_common/run @@ -0,0 +1,9 @@ +rm -rf build + +NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names + +flock "$1" pack -q install-deps derive.ipkg && \ +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg DerivedGen.idr && \ +pack exec DerivedGen.idr | "$NAMES_CLEANER" + +rm -rf build From d1777a5c46aa7818de2c7041c0dbaf18bd1c01f4 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Tue, 4 Jun 2024 21:43:31 +0300 Subject: [PATCH 09/53] target type generator derivation from fused type generator added --- src/Deriving/DepTyCheck/Util/Fusion.idr | 91 ++++++++++++++++--- tests/Tests.idr | 6 +- .../001 one var match/DerivedGen.idr | 0 .../depsolver/001 one var match/derive.ipkg | 0 .../depsolver/001 one var match/expected | 0 .../depsolver/001 one var match/run | 0 .../002 one var no match/DerivedGen.idr | 0 .../002 one var no match/derive.ipkg | 0 .../depsolver/002 one var no match/expected | 0 .../depsolver/002 one var no match/run | 0 .../003 two vars one match/DerivedGen.idr | 0 .../003 two vars one match/derive.ipkg | 0 .../depsolver/003 two vars one match/expected | 0 .../depsolver/003 two vars one match/run | 0 .../004 three types one match/DerivedGen.idr | 0 .../004 three types one match/derive.ipkg | 0 .../004 three types one match/expected | 0 .../depsolver/004 three types one match/run | 0 .../{ => print}/depsolver/_common/derive.ipkg | 0 .../fusion/{ => print}/depsolver/_common/run | 0 .../001 one var match/DerivedGen.idr | 23 +++++ .../generator}/001 one var match/derive.ipkg | 0 .../generator/001 one var match/expected | 58 ++++++++++++ .../generator}/001 one var match/run | 0 .../002 two var ordered match/DerivedGen.idr | 26 ++++++ .../002 two var ordered match/derive.ipkg | 0 .../002 two var ordered match/expected | 64 +++++++++++++ .../generator}/002 two var ordered match/run | 0 .../DerivedGen.idr | 24 +++++ .../003 two var unordered match/derive.ipkg | 0 .../003 two var unordered match/expected | 64 +++++++++++++ .../003 two var unordered match/run | 0 .../004 var-const match/DerivedGen.idr | 24 +++++ .../004 var-const match/derive.ipkg | 0 .../generator/004 var-const match/expected | 62 +++++++++++++ .../generator}/004 var-const match/run | 0 .../005 const-const match/DerivedGen.idr | 24 +++++ .../005 const-const match/derive.ipkg | 0 .../generator/005 const-const match/expected | 62 +++++++++++++ .../generator}/005 const-const match/run | 0 .../006 const-const no match/DerivedGen.idr | 24 +++++ .../006 const-const no match/derive.ipkg | 0 .../006 const-const no match/expected | 62 +++++++++++++ .../generator}/006 const-const no match/run | 0 .../007 prim-prim match/DerivedGen.idr | 24 +++++ .../007 prim-prim match/derive.ipkg | 0 .../generator/007 prim-prim match/expected | 62 +++++++++++++ .../generator}/007 prim-prim match/run | 0 .../008 non-shared var/DerivedGen.idr | 24 +++++ .../generator}/008 non-shared var/derive.ipkg | 0 .../generator/008 non-shared var/expected | 79 ++++++++++++++++ .../generator}/008 non-shared var/run | 0 .../009 three types fusion/DerivedGen.idr | 27 ++++++ .../009 three types fusion/derive.ipkg | 0 .../generator/009 three types fusion/expected | 61 +++++++++++++ .../generator}/009 three types fusion/run | 0 .../010 three types two args/DerivedGen.idr | 26 ++++++ .../010 three types two args/derive.ipkg | 0 .../010 three types two args/expected | 82 +++++++++++++++++ .../generator}/010 three types two args/run | 0 .../generator}/_common/derive.ipkg | 0 .../{merger => print/generator}/_common/run | 0 .../merger/001 one var match/DerivedGen.idr | 0 .../merger}/001 one var match/derive.ipkg | 0 .../merger/001 one var match/expected | 0 .../merger}/001 one var match/run | 0 .../002 two var ordered match/DerivedGen.idr | 0 .../002 two var ordered match/derive.ipkg | 0 .../merger/002 two var ordered match/expected | 0 .../merger}/002 two var ordered match/run | 0 .../DerivedGen.idr | 0 .../003 two var unordered match/derive.ipkg | 0 .../003 two var unordered match/expected | 0 .../merger}/003 two var unordered match/run | 0 .../merger/004 var-const match/DerivedGen.idr | 0 .../merger}/004 var-const match/derive.ipkg | 0 .../merger/004 var-const match/expected | 0 .../merger}/004 var-const match/run | 0 .../005 const-const match/DerivedGen.idr | 0 .../merger}/005 const-const match/derive.ipkg | 0 .../merger/005 const-const match/expected | 0 .../merger}/005 const-const match/run | 0 .../006 const-const no match/DerivedGen.idr | 0 .../006 const-const no match/derive.ipkg | 0 .../merger/006 const-const no match/expected | 0 .../merger}/006 const-const no match/run | 0 .../merger/007 prim-prim match/DerivedGen.idr | 0 .../merger}/007 prim-prim match/derive.ipkg | 0 .../merger/007 prim-prim match/expected | 0 .../merger}/007 prim-prim match/run | 0 .../merger/008 non-shared var/DerivedGen.idr | 0 .../merger}/008 non-shared var/derive.ipkg | 0 .../merger/008 non-shared var/expected | 0 .../merger}/008 non-shared var/run | 0 .../009 three types fusion/DerivedGen.idr | 0 .../009 three types fusion/derive.ipkg | 0 .../merger/009 three types fusion/expected | 0 .../merger}/009 three types fusion/run | 0 .../010 three types two args/DerivedGen.idr | 0 .../010 three types two args/derive.ipkg | 0 .../merger/010 three types two args/expected | 0 .../merger}/010 three types two args/run | 0 .../merger}/_common/derive.ipkg | 0 .../{splitter => print/merger}/_common/run | 0 .../splitter/001 one var match/DerivedGen.idr | 0 .../splitter/001 one var match/derive.ipkg | 1 + .../splitter/001 one var match/expected | 0 .../print/splitter/001 one var match/run | 1 + .../002 two var ordered match/DerivedGen.idr | 0 .../002 two var ordered match/derive.ipkg | 1 + .../002 two var ordered match/expected | 0 .../splitter/002 two var ordered match/run | 1 + .../DerivedGen.idr | 0 .../003 two var unordered match/derive.ipkg | 1 + .../003 two var unordered match/expected | 0 .../splitter/003 two var unordered match/run | 1 + .../004 var-const match/DerivedGen.idr | 0 .../splitter/004 var-const match/derive.ipkg | 1 + .../splitter/004 var-const match/expected | 0 .../print/splitter/004 var-const match/run | 1 + .../005 const-const match/DerivedGen.idr | 0 .../005 const-const match/derive.ipkg | 1 + .../splitter/005 const-const match/expected | 0 .../print/splitter/005 const-const match/run | 1 + .../006 const-const no match/DerivedGen.idr | 0 .../006 const-const no match/derive.ipkg | 1 + .../006 const-const no match/expected | 0 .../splitter/006 const-const no match/run | 1 + .../007 prim-prim match/DerivedGen.idr | 0 .../splitter/007 prim-prim match/derive.ipkg | 1 + .../splitter/007 prim-prim match/expected | 0 .../print/splitter/007 prim-prim match/run | 1 + .../008 non-shared var/DerivedGen.idr | 0 .../splitter/008 non-shared var/derive.ipkg | 1 + .../splitter/008 non-shared var/expected | 0 .../print/splitter/008 non-shared var/run | 1 + .../009 three types fusion/DerivedGen.idr | 0 .../009 three types fusion/derive.ipkg | 1 + .../splitter/009 three types fusion/expected | 0 .../print/splitter/009 three types fusion/run | 1 + .../010 three types two args/DerivedGen.idr | 0 .../010 three types two args/derive.ipkg | 1 + .../010 three types two args/expected | 0 .../splitter/010 three types two args/run | 1 + .../fusion/print/splitter/_common/derive.ipkg | 7 ++ .../utils/fusion/print/splitter/_common/run | 9 ++ 146 files changed, 1019 insertions(+), 16 deletions(-) rename tests/derivation/utils/fusion/{ => print}/depsolver/001 one var match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/001 one var match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/001 one var match/expected (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/001 one var match/run (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/002 one var no match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/002 one var no match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/002 one var no match/expected (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/002 one var no match/run (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/003 two vars one match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/003 two vars one match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/003 two vars one match/expected (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/003 two vars one match/run (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/004 three types one match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/004 three types one match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/004 three types one match/expected (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/004 three types one match/run (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/_common/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/depsolver/_common/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/001 one var match/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/001 one var match/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/001 one var match/expected rename tests/derivation/utils/fusion/{merger => print/generator}/001 one var match/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/002 two var ordered match/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/002 two var ordered match/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/002 two var ordered match/expected rename tests/derivation/utils/fusion/{merger => print/generator}/002 two var ordered match/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/003 two var unordered match/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/003 two var unordered match/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/003 two var unordered match/expected rename tests/derivation/utils/fusion/{merger => print/generator}/003 two var unordered match/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/004 var-const match/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/004 var-const match/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/004 var-const match/expected rename tests/derivation/utils/fusion/{merger => print/generator}/004 var-const match/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/005 const-const match/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/005 const-const match/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/005 const-const match/expected rename tests/derivation/utils/fusion/{merger => print/generator}/005 const-const match/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/006 const-const no match/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/006 const-const no match/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/006 const-const no match/expected rename tests/derivation/utils/fusion/{merger => print/generator}/006 const-const no match/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/007 prim-prim match/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/007 prim-prim match/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/007 prim-prim match/expected rename tests/derivation/utils/fusion/{merger => print/generator}/007 prim-prim match/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/008 non-shared var/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/008 non-shared var/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/008 non-shared var/expected rename tests/derivation/utils/fusion/{merger => print/generator}/008 non-shared var/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/009 three types fusion/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/009 three types fusion/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/009 three types fusion/expected rename tests/derivation/utils/fusion/{merger => print/generator}/009 three types fusion/run (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/010 three types two args/DerivedGen.idr rename tests/derivation/utils/fusion/{merger => print/generator}/010 three types two args/derive.ipkg (100%) create mode 100644 tests/derivation/utils/fusion/print/generator/010 three types two args/expected rename tests/derivation/utils/fusion/{merger => print/generator}/010 three types two args/run (100%) rename tests/derivation/utils/fusion/{merger => print/generator}/_common/derive.ipkg (100%) rename tests/derivation/utils/fusion/{merger => print/generator}/_common/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/001 one var match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/001 one var match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/001 one var match/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/001 one var match/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/002 two var ordered match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/002 two var ordered match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/002 two var ordered match/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/002 two var ordered match/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/003 two var unordered match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/003 two var unordered match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/003 two var unordered match/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/003 two var unordered match/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/004 var-const match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/004 var-const match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/004 var-const match/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/004 var-const match/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/005 const-const match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/005 const-const match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/005 const-const match/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/005 const-const match/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/006 const-const no match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/006 const-const no match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/006 const-const no match/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/006 const-const no match/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/007 prim-prim match/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/007 prim-prim match/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/007 prim-prim match/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/007 prim-prim match/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/008 non-shared var/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/008 non-shared var/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/008 non-shared var/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/008 non-shared var/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/009 three types fusion/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/009 three types fusion/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/009 three types fusion/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/009 three types fusion/run (100%) rename tests/derivation/utils/fusion/{ => print}/merger/010 three types two args/DerivedGen.idr (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/010 three types two args/derive.ipkg (100%) rename tests/derivation/utils/fusion/{ => print}/merger/010 three types two args/expected (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/010 three types two args/run (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/_common/derive.ipkg (100%) rename tests/derivation/utils/fusion/{splitter => print/merger}/_common/run (100%) rename tests/derivation/utils/fusion/{ => print}/splitter/001 one var match/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/001 one var match/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/001 one var match/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/001 one var match/run rename tests/derivation/utils/fusion/{ => print}/splitter/002 two var ordered match/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/002 two var ordered match/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/002 two var ordered match/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/002 two var ordered match/run rename tests/derivation/utils/fusion/{ => print}/splitter/003 two var unordered match/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/003 two var unordered match/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/003 two var unordered match/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/003 two var unordered match/run rename tests/derivation/utils/fusion/{ => print}/splitter/004 var-const match/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/004 var-const match/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/004 var-const match/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/004 var-const match/run rename tests/derivation/utils/fusion/{ => print}/splitter/005 const-const match/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/005 const-const match/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/005 const-const match/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/005 const-const match/run rename tests/derivation/utils/fusion/{ => print}/splitter/006 const-const no match/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/006 const-const no match/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/006 const-const no match/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/006 const-const no match/run rename tests/derivation/utils/fusion/{ => print}/splitter/007 prim-prim match/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/007 prim-prim match/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/007 prim-prim match/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/007 prim-prim match/run rename tests/derivation/utils/fusion/{ => print}/splitter/008 non-shared var/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/008 non-shared var/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/008 non-shared var/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/008 non-shared var/run rename tests/derivation/utils/fusion/{ => print}/splitter/009 three types fusion/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/009 three types fusion/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/009 three types fusion/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/009 three types fusion/run rename tests/derivation/utils/fusion/{ => print}/splitter/010 three types two args/DerivedGen.idr (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/010 three types two args/derive.ipkg rename tests/derivation/utils/fusion/{ => print}/splitter/010 three types two args/expected (100%) create mode 120000 tests/derivation/utils/fusion/print/splitter/010 three types two args/run create mode 100644 tests/derivation/utils/fusion/print/splitter/_common/derive.ipkg create mode 100644 tests/derivation/utils/fusion/print/splitter/_common/run diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index 8a0f996f5..e34a5bc42 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -5,6 +5,7 @@ import Language.Reflection.TTImp import Language.Reflection.Derive import Language.Reflection.Pretty import Language.Reflection.Compat +import public Deriving.DepTyCheck.Gen import Deriving.DepTyCheck.Util.Collections import Deriving.DepTyCheck.Util.Reflection import Data.Nat @@ -86,6 +87,7 @@ splitRhsDef [] = type splitRhsDef (t::[]) = t splitRhsDef (t::ts) = app (var `{Builtin.MkPair} .$ t) (splitRhsDef ts) + splitRhsClaim : List TTImp -> TTImp splitRhsClaim [] = type splitRhsClaim (t::[]) = t @@ -114,6 +116,9 @@ record FusionDecl where dataType : Decl splitClaim : Decl splitDef : Decl + genFClaim : Decl + genRClaim : Decl + genRDef : Decl prepareConArgs : TTImp -> List TTImp @@ -122,14 +127,29 @@ prepareConArgs t = do map getExpr tApps -fusionTypeName : List Name -> Name -fusionTypeName = UN . Basic . (joinBy "") . (map nameStr) +joinNames : List Name -> Name +joinNames = UN . Basic . (joinBy "") . (map nameStr) + + +genRMkDPair : TTImp -> List Name -> TTImp +genRMkDPair = foldr (\n, acc => var `{MkDPair} .$ n.bindVar .$ acc) + + +genFDPair : Name -> List (Name, TTImp) -> TTImp +genFDPair n l = foldr + (\(n, tt), acc => var `{DPair} .$ tt .$ (MkArg MW ExplicitArg (Just n) tt `lam` acc)) + (foldConstructor (var n) (map (var . fst) l)) + l + + +genFRhsClaim : Name -> List (Name, TTImp) -> TTImp +genFRhsClaim n l = var `{Gen} .$ var `{MaybeEmpty} .$ genFDPair n l deriveFusion : Vect (2 + n) (TypeInfo, List Name) -> Maybe FusionDecl deriveFusion l = do let typeNames = toList $ map ((.name) . fst) l - let fusionTypeName = fusionTypeName $ typeNames + let fusionTypeName = joinNames $ typeNames let typeArgs = map (\(ti, la) => matchArgs ti.args la) l let False = any isNothing typeArgs @@ -146,7 +166,10 @@ deriveFusion l = do let True = all (not . Prelude.null . fst) consPre | False => Nothing let consML1 = map (\(cons, args) => (toList1' cons, args)) consPre -- how to prove and use toList? - let consL1 = map (\(cons, args) => case cons of {Just x => (x, args); Nothing => ((MkCon (UN (Basic "")) [] type):::[], args)}) consML1 + let consL1 = map (\(cons, args) => case cons of + Just x => (x, args) + Nothing => ((MkCon (UN (Basic "")) [] type):::[], args) + ) consML1 let consAll = map (\(cons, args) => map (\c => (c, args)) cons) consL1 let consComb = combinations consAll let consCombPrepared = map (map (\(con, args) => (con.name, prepareConArgs con.type, args))) consComb @@ -165,17 +188,57 @@ deriveFusion l = do splitRhsClaim (splitReturnType typeNames argNamesList) let defDecl = if (not $ null fusedCons) - then def splitName $ splitClauses (var splitName) $ toList (map (toList . (map (nameStr . (.name) . fst))) consComb) + then def splitName $ splitClauses (var splitName) $ + toList (map (toList . (map (nameStr . (.name) . fst))) consComb) else def splitName [impossibleClause (var splitName .$ implicitTrue)] - Just (MkFusionDecl dataDecl claimDecl defDecl) + let stub = ILog Nothing + let genFName = UN $ Basic ("gen" ++ (nameStr fusionTypeName)) + let genFClaim = export' genFName $ + (MkArg MW ExplicitArg Nothing (var `{Fuel})) .-> + (genFRhsClaim fusionTypeName uniqueArgs) + + let genRClaim = export' (`{genZ_ultimate}) $ + (MkArg MW ExplicitArg Nothing (var `{Fuel})) .-> + (var `{Gen} .$ var `{MaybeEmpty} .$ var `{Z}) + + let fusedVarName = toLower $ nameStr fusionTypeName + let typeVarNames = map (toLower . nameStr) typeNames + let genRDef = def + `{genZ_ultimate} + [ var `{genZ_ultimate} + .$ bindVar "fl" + .= var `{(>>=)} + .$ (var genFName .$ var `{fl}) + .$ ( + MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + `lam` iCase { + sc = var "{lamc:0}", + ty = implicitFalse, + clauses = + [ genRMkDPair (bindVar fusedVarName) uniqueNames + .= iCase { + sc = var splitName .$ (var $ UN $ Basic fusedVarName), + ty = implicitTrue, + clauses = + [ (splitRhsDef (map bindVar typeVarNames)) + .= var `{pure} + .$ foldConstructor (var `{MkZ}) (map var uniqueNames ++ map (var . UN . Basic) typeVarNames) + ] + } + ] + } + ) + ] + + Just (MkFusionDecl dataDecl claimDecl defDecl genFClaim genRClaim genRDef) declareFusion : Vect (2 + n) (TypeInfo, List Name) -> Elab (Maybe FusionDecl) declareFusion l = do let derived = deriveFusion l case derived of - Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef] + Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef, fd.genFClaim, fd.genRClaim, fd.genRDef] Nothing => declare [] pure $ derived @@ -193,11 +256,13 @@ public export solveDependencies : List Arg -> List (List (Name, List String)) solveDependencies l = go l [] where go : List Arg -> List (List (Name, List String)) -> List (List (Name, List String)) - go [] acc = map reverse acc + go [] acc = map reverse acc -- SnocList go (a::as) acc = go as (merge (prepareArgsSolve a) acc) where merge : (Name, List String) -> List (List (Name, List String)) -> List (List (Name, List String)) merge a [] = [[a]] - merge (m, as) (rs::rss) = if (any (not . Prelude.null . (intersect as) . snd) rs) then ((m, as)::rs)::rss else rs::(merge (m, as) rss) + merge (m, as) (rs::rss) = if (any (not . Prelude.null . (intersect as) . snd) rs) + then ((m, as)::rs)::rss + else rs::(merge (m, as) rss) public export @@ -228,7 +293,7 @@ getSplit Nothing = [] getSplit (Just fd) = [fd.splitClaim, fd.splitDef] --- TODO: what happens with :doc --- tests for order of dependent arguments --- preserve order of args from left to right --- TODO: List Arg -> group and filter which to fuse (argDeps) +public export +getGen : Maybe FusionDecl -> List Decl +getGen Nothing = [] +getGen (Just fd) = [fd.genFClaim, fd.genRClaim, fd.genRDef] diff --git a/tests/Tests.idr b/tests/Tests.idr index 750757ce3..e25579f81 100644 --- a/tests/Tests.idr +++ b/tests/Tests.idr @@ -12,9 +12,9 @@ main = goldenRunner $ , "Derivation utils: canonic signature" `atDir` "derivation/utils/canonicsig" , "Derivation utils: constructors analysis" `atDir` "derivation/utils/cons-analysis" , "Derivation utils: argument dependencies" `atDir` "derivation/utils/arg-deps" - , "Derivation utils: data types fusion" `atDir` "derivation/utils/fusion/merger" - , "Derivation utils: fused data types split" `atDir` "derivation/utils/fusion/splitter" - , "Derivation utils: dependency solver for fusion" `atDir` "derivation/utils/fusion/depsolver" + , [ "Derivation utils: \{p} fusion \{w}" `atDir` "derivation/utils/fusion/\{p}/\{w}" + | p <- ["print", "run"], w <- ["merger", "splitter", "depsolver", "generator"] + ] , "Reflection utils: involved types" `atDir` "derivation/utils/involved-types" , "Derivation: input validation" `atDir` "derivation/inputvalidation" , "Derivation: running harness" `atDir` "derivation/infra" diff --git a/tests/derivation/utils/fusion/depsolver/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/print/depsolver/001 one var match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/depsolver/001 one var match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/depsolver/001 one var match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/depsolver/001 one var match/derive.ipkg b/tests/derivation/utils/fusion/print/depsolver/001 one var match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/depsolver/001 one var match/derive.ipkg rename to tests/derivation/utils/fusion/print/depsolver/001 one var match/derive.ipkg diff --git a/tests/derivation/utils/fusion/depsolver/001 one var match/expected b/tests/derivation/utils/fusion/print/depsolver/001 one var match/expected similarity index 100% rename from tests/derivation/utils/fusion/depsolver/001 one var match/expected rename to tests/derivation/utils/fusion/print/depsolver/001 one var match/expected diff --git a/tests/derivation/utils/fusion/depsolver/001 one var match/run b/tests/derivation/utils/fusion/print/depsolver/001 one var match/run similarity index 100% rename from tests/derivation/utils/fusion/depsolver/001 one var match/run rename to tests/derivation/utils/fusion/print/depsolver/001 one var match/run diff --git a/tests/derivation/utils/fusion/depsolver/002 one var no match/DerivedGen.idr b/tests/derivation/utils/fusion/print/depsolver/002 one var no match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/depsolver/002 one var no match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/depsolver/002 one var no match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/depsolver/002 one var no match/derive.ipkg b/tests/derivation/utils/fusion/print/depsolver/002 one var no match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/depsolver/002 one var no match/derive.ipkg rename to tests/derivation/utils/fusion/print/depsolver/002 one var no match/derive.ipkg diff --git a/tests/derivation/utils/fusion/depsolver/002 one var no match/expected b/tests/derivation/utils/fusion/print/depsolver/002 one var no match/expected similarity index 100% rename from tests/derivation/utils/fusion/depsolver/002 one var no match/expected rename to tests/derivation/utils/fusion/print/depsolver/002 one var no match/expected diff --git a/tests/derivation/utils/fusion/depsolver/002 one var no match/run b/tests/derivation/utils/fusion/print/depsolver/002 one var no match/run similarity index 100% rename from tests/derivation/utils/fusion/depsolver/002 one var no match/run rename to tests/derivation/utils/fusion/print/depsolver/002 one var no match/run diff --git a/tests/derivation/utils/fusion/depsolver/003 two vars one match/DerivedGen.idr b/tests/derivation/utils/fusion/print/depsolver/003 two vars one match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/depsolver/003 two vars one match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/depsolver/003 two vars one match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/depsolver/003 two vars one match/derive.ipkg b/tests/derivation/utils/fusion/print/depsolver/003 two vars one match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/depsolver/003 two vars one match/derive.ipkg rename to tests/derivation/utils/fusion/print/depsolver/003 two vars one match/derive.ipkg diff --git a/tests/derivation/utils/fusion/depsolver/003 two vars one match/expected b/tests/derivation/utils/fusion/print/depsolver/003 two vars one match/expected similarity index 100% rename from tests/derivation/utils/fusion/depsolver/003 two vars one match/expected rename to tests/derivation/utils/fusion/print/depsolver/003 two vars one match/expected diff --git a/tests/derivation/utils/fusion/depsolver/003 two vars one match/run b/tests/derivation/utils/fusion/print/depsolver/003 two vars one match/run similarity index 100% rename from tests/derivation/utils/fusion/depsolver/003 two vars one match/run rename to tests/derivation/utils/fusion/print/depsolver/003 two vars one match/run diff --git a/tests/derivation/utils/fusion/depsolver/004 three types one match/DerivedGen.idr b/tests/derivation/utils/fusion/print/depsolver/004 three types one match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/depsolver/004 three types one match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/depsolver/004 three types one match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/depsolver/004 three types one match/derive.ipkg b/tests/derivation/utils/fusion/print/depsolver/004 three types one match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/depsolver/004 three types one match/derive.ipkg rename to tests/derivation/utils/fusion/print/depsolver/004 three types one match/derive.ipkg diff --git a/tests/derivation/utils/fusion/depsolver/004 three types one match/expected b/tests/derivation/utils/fusion/print/depsolver/004 three types one match/expected similarity index 100% rename from tests/derivation/utils/fusion/depsolver/004 three types one match/expected rename to tests/derivation/utils/fusion/print/depsolver/004 three types one match/expected diff --git a/tests/derivation/utils/fusion/depsolver/004 three types one match/run b/tests/derivation/utils/fusion/print/depsolver/004 three types one match/run similarity index 100% rename from tests/derivation/utils/fusion/depsolver/004 three types one match/run rename to tests/derivation/utils/fusion/print/depsolver/004 three types one match/run diff --git a/tests/derivation/utils/fusion/depsolver/_common/derive.ipkg b/tests/derivation/utils/fusion/print/depsolver/_common/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/depsolver/_common/derive.ipkg rename to tests/derivation/utils/fusion/print/depsolver/_common/derive.ipkg diff --git a/tests/derivation/utils/fusion/depsolver/_common/run b/tests/derivation/utils/fusion/print/depsolver/_common/run similarity index 100% rename from tests/derivation/utils/fusion/depsolver/_common/run rename to tests/derivation/utils/fusion/print/depsolver/_common/run diff --git a/tests/derivation/utils/fusion/print/generator/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/001 one var match/DerivedGen.idr new file mode 100644 index 000000000..22ba774d4 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/001 one var match/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type where + MkX : X n + +data Y : Type -> Type where + MkY : Y n + +data Z : Type where + MkZ : (n : Type) -> X n -> Y n -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/001 one var match/derive.ipkg b/tests/derivation/utils/fusion/print/generator/001 one var match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/001 one var match/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/001 one var match/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/001 one var match/expected b/tests/derivation/utils/fusion/print/generator/001 one var match/expected new file mode 100644 index 000000000..e57ae900e --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/001 one var match/expected @@ -0,0 +1,58 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXY" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "n") type + .=> var "XY" .$ var "n")) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXY" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "n" .$ bindVar "xy" + .= iCase + { sc = var "splitXY" .$ var "xy" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ bindVar "y" + .= var "pure" + .$ ( var "MkZ" + .$ var "n" + .$ var "x" + .$ var "y") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/001 one var match/run b/tests/derivation/utils/fusion/print/generator/001 one var match/run similarity index 100% rename from tests/derivation/utils/fusion/merger/001 one var match/run rename to tests/derivation/utils/fusion/print/generator/001 one var match/run diff --git a/tests/derivation/utils/fusion/print/generator/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/002 two var ordered match/DerivedGen.idr new file mode 100644 index 000000000..8923d1f73 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/002 two var ordered match/DerivedGen.idr @@ -0,0 +1,26 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +data Z : Type where + MkZ : (m : Type) -> (n : Type) -> X m n -> Y m n -> Z + +%language ElabReflection + + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] + +main : IO () +main = putPretty $ getGen decl + diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/derive.ipkg b/tests/derivation/utils/fusion/print/generator/002 two var ordered match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/002 two var ordered match/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/002 two var ordered match/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/002 two var ordered match/expected b/tests/derivation/utils/fusion/print/generator/002 two var ordered match/expected new file mode 100644 index 000000000..8917d2a46 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/002 two var ordered match/expected @@ -0,0 +1,64 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXY" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "m") type + .=> var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "n") type + .=> var "XY" .$ var "m" .$ var "n"))) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXY" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" + .$ bindVar "m" + .$ (var "MkDPair" .$ bindVar "n" .$ bindVar "xy") + .= iCase + { sc = var "splitXY" .$ var "xy" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ bindVar "y" + .= var "pure" + .$ ( var "MkZ" + .$ var "m" + .$ var "n" + .$ var "x" + .$ var "y") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/run b/tests/derivation/utils/fusion/print/generator/002 two var ordered match/run similarity index 100% rename from tests/derivation/utils/fusion/merger/002 two var ordered match/run rename to tests/derivation/utils/fusion/print/generator/002 two var ordered match/run diff --git a/tests/derivation/utils/fusion/print/generator/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/003 two var unordered match/DerivedGen.idr new file mode 100644 index 000000000..e3a3f5a11 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/003 two var unordered match/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +data Z : Type where + MkZ : (m : Type) -> (n : Type) -> X m n -> Y n m -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/derive.ipkg b/tests/derivation/utils/fusion/print/generator/003 two var unordered match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/003 two var unordered match/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/003 two var unordered match/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/003 two var unordered match/expected b/tests/derivation/utils/fusion/print/generator/003 two var unordered match/expected new file mode 100644 index 000000000..8917d2a46 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/003 two var unordered match/expected @@ -0,0 +1,64 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXY" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "m") type + .=> var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "n") type + .=> var "XY" .$ var "m" .$ var "n"))) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXY" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" + .$ bindVar "m" + .$ (var "MkDPair" .$ bindVar "n" .$ bindVar "xy") + .= iCase + { sc = var "splitXY" .$ var "xy" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ bindVar "y" + .= var "pure" + .$ ( var "MkZ" + .$ var "m" + .$ var "n" + .$ var "x" + .$ var "y") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/run b/tests/derivation/utils/fusion/print/generator/003 two var unordered match/run similarity index 100% rename from tests/derivation/utils/fusion/merger/003 two var unordered match/run rename to tests/derivation/utils/fusion/print/generator/003 two var unordered match/run diff --git a/tests/derivation/utils/fusion/print/generator/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/004 var-const match/DerivedGen.idr new file mode 100644 index 000000000..568e37ade --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/004 var-const match/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X n + +data Y : Nat -> Type where + MkY : Y 1 -- unexpected behaviour for 0 + +data Z : Type where + MkZ : (m : Nat) -> X m -> Y m -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/derive.ipkg b/tests/derivation/utils/fusion/print/generator/004 var-const match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/004 var-const match/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/004 var-const match/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/004 var-const match/expected b/tests/derivation/utils/fusion/print/generator/004 var-const match/expected new file mode 100644 index 000000000..69e292ebd --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/004 var-const match/expected @@ -0,0 +1,62 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXY" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg + MW + ExplicitArg + (Just "n") + (var "Prelude.Types.Nat") + .=> var "XY" .$ var "n")) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXY" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "n" .$ bindVar "xy" + .= iCase + { sc = var "splitXY" .$ var "xy" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ bindVar "y" + .= var "pure" + .$ ( var "MkZ" + .$ var "n" + .$ var "x" + .$ var "y") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/run b/tests/derivation/utils/fusion/print/generator/004 var-const match/run similarity index 100% rename from tests/derivation/utils/fusion/merger/004 var-const match/run rename to tests/derivation/utils/fusion/print/generator/004 var-const match/run diff --git a/tests/derivation/utils/fusion/print/generator/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/005 const-const match/DerivedGen.idr new file mode 100644 index 000000000..13f9f9b73 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/005 const-const match/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X 1 + +data Y : Nat -> Type where + MkY : Y 1 + +data Z : Type where + MkZ : (m : Nat) -> X m -> Y m -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/derive.ipkg b/tests/derivation/utils/fusion/print/generator/005 const-const match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/005 const-const match/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/005 const-const match/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/005 const-const match/expected b/tests/derivation/utils/fusion/print/generator/005 const-const match/expected new file mode 100644 index 000000000..69e292ebd --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/005 const-const match/expected @@ -0,0 +1,62 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXY" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg + MW + ExplicitArg + (Just "n") + (var "Prelude.Types.Nat") + .=> var "XY" .$ var "n")) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXY" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "n" .$ bindVar "xy" + .= iCase + { sc = var "splitXY" .$ var "xy" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ bindVar "y" + .= var "pure" + .$ ( var "MkZ" + .$ var "n" + .$ var "x" + .$ var "y") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/run b/tests/derivation/utils/fusion/print/generator/005 const-const match/run similarity index 100% rename from tests/derivation/utils/fusion/merger/005 const-const match/run rename to tests/derivation/utils/fusion/print/generator/005 const-const match/run diff --git a/tests/derivation/utils/fusion/print/generator/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/006 const-const no match/DerivedGen.idr new file mode 100644 index 000000000..1dbc529a2 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/006 const-const no match/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Nat -> Type where + MkX : X 1 + +data Y : Nat -> Type where + MkY : Y 2 + +data Z : Type where + MkZ : (m : Nat) -> X m -> Y m -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/derive.ipkg b/tests/derivation/utils/fusion/print/generator/006 const-const no match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/006 const-const no match/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/006 const-const no match/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/006 const-const no match/expected b/tests/derivation/utils/fusion/print/generator/006 const-const no match/expected new file mode 100644 index 000000000..69e292ebd --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/006 const-const no match/expected @@ -0,0 +1,62 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXY" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg + MW + ExplicitArg + (Just "n") + (var "Prelude.Types.Nat") + .=> var "XY" .$ var "n")) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXY" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "n" .$ bindVar "xy" + .= iCase + { sc = var "splitXY" .$ var "xy" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ bindVar "y" + .= var "pure" + .$ ( var "MkZ" + .$ var "n" + .$ var "x" + .$ var "y") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/run b/tests/derivation/utils/fusion/print/generator/006 const-const no match/run similarity index 100% rename from tests/derivation/utils/fusion/merger/006 const-const no match/run rename to tests/derivation/utils/fusion/print/generator/006 const-const no match/run diff --git a/tests/derivation/utils/fusion/print/generator/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/007 prim-prim match/DerivedGen.idr new file mode 100644 index 000000000..c76c23c99 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/007 prim-prim match/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : String -> Type where + MkX : X "0" + +data Y : String -> Type where + MkY : Y "0" + +data Z : Type where + MkZ : (m : String) -> X m -> Y m -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/derive.ipkg b/tests/derivation/utils/fusion/print/generator/007 prim-prim match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/007 prim-prim match/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/007 prim-prim match/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/007 prim-prim match/expected b/tests/derivation/utils/fusion/print/generator/007 prim-prim match/expected new file mode 100644 index 000000000..ba604ed24 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/007 prim-prim match/expected @@ -0,0 +1,62 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXY" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ primVal (PrT StringType) + .$ ( MkArg + MW + ExplicitArg + (Just "n") + (primVal (PrT StringType)) + .=> var "XY" .$ var "n")) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXY" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "n" .$ bindVar "xy" + .= iCase + { sc = var "splitXY" .$ var "xy" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ bindVar "y" + .= var "pure" + .$ ( var "MkZ" + .$ var "n" + .$ var "x" + .$ var "y") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/run b/tests/derivation/utils/fusion/print/generator/007 prim-prim match/run similarity index 100% rename from tests/derivation/utils/fusion/merger/007 prim-prim match/run rename to tests/derivation/utils/fusion/print/generator/007 prim-prim match/run diff --git a/tests/derivation/utils/fusion/print/generator/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/008 non-shared var/DerivedGen.idr new file mode 100644 index 000000000..8fc1bf653 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/008 non-shared var/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + + +%default total + +data X : Type -> Type -> Type where + MkX : X m n + +data Y : Type -> Type -> Type where + MkY : Y m n + +data Z : Type where + MkZ : (k : Type) -> (m : Type) -> (n : Type) -> X k m -> Y m n -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{k}, `{m}] `{Y} [`{m}, `{n}] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/derive.ipkg b/tests/derivation/utils/fusion/print/generator/008 non-shared var/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/008 non-shared var/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/008 non-shared var/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/008 non-shared var/expected b/tests/derivation/utils/fusion/print/generator/008 non-shared var/expected new file mode 100644 index 000000000..dae530cab --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/008 non-shared var/expected @@ -0,0 +1,79 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXY" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "k") type + .=> var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "m") type + .=> var "DPair" + .$ type + .$ ( MkArg + MW + ExplicitArg + (Just "n") + type + .=> var "XY" + .$ var "k" + .$ var "m" + .$ var "n")))) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXY" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" + .$ bindVar "k" + .$ ( var "MkDPair" + .$ bindVar "m" + .$ ( var "MkDPair" + .$ bindVar "n" + .$ bindVar "xy")) + .= iCase + { sc = var "splitXY" .$ var "xy" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ bindVar "y" + .= var "pure" + .$ ( var "MkZ" + .$ var "k" + .$ var "m" + .$ var "n" + .$ var "x" + .$ var "y") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/run b/tests/derivation/utils/fusion/print/generator/008 non-shared var/run similarity index 100% rename from tests/derivation/utils/fusion/merger/008 non-shared var/run rename to tests/derivation/utils/fusion/print/generator/008 non-shared var/run diff --git a/tests/derivation/utils/fusion/print/generator/009 three types fusion/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/009 three types fusion/DerivedGen.idr new file mode 100644 index 000000000..447b29c5d --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/009 three types fusion/DerivedGen.idr @@ -0,0 +1,27 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type where + MkX : X n + +data Y : Type -> Type where + MkY : Y n + +data W : Type -> Type where + MkW : W n + + +data Z : Type where + MkZ : (m : Type) -> X m -> Y m -> W m -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusionList [(`{X}, [`{n}]), (`{Y}, [`{n}]), (`{W}, [`{n}])] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/derive.ipkg b/tests/derivation/utils/fusion/print/generator/009 three types fusion/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/009 three types fusion/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/009 three types fusion/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/009 three types fusion/expected b/tests/derivation/utils/fusion/print/generator/009 three types fusion/expected new file mode 100644 index 000000000..418a75ae0 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/009 three types fusion/expected @@ -0,0 +1,61 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXYW" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "n") type + .=> var "XYW" .$ var "n")) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXYW" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "n" .$ bindVar "xyw" + .= iCase + { sc = var "splitXYW" .$ var "xyw" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ ( var "Builtin.MkPair" + .$ bindVar "y" + .$ bindVar "w") + .= var "pure" + .$ ( var "MkZ" + .$ var "n" + .$ var "x" + .$ var "y" + .$ var "w") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/run b/tests/derivation/utils/fusion/print/generator/009 three types fusion/run similarity index 100% rename from tests/derivation/utils/fusion/merger/009 three types fusion/run rename to tests/derivation/utils/fusion/print/generator/009 three types fusion/run diff --git a/tests/derivation/utils/fusion/print/generator/010 three types two args/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/010 three types two args/DerivedGen.idr new file mode 100644 index 000000000..055dce567 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/010 three types two args/DerivedGen.idr @@ -0,0 +1,26 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type -> Type where + MkX : X n m + +data Y : Type -> Type -> Type where + MkY : Y n m + +data W : Type -> Type -> Type where + MkW : W n m + +data Z : Type where + MkZ : (k : Type) -> (m : Type) -> (n : Type) -> X k m -> Y m n -> W n k -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusionList [(`{X}, [`{k}, `{m}]), (`{Y}, [`{m}, `{n}]), (`{W}, [`{n}, `{k}])] + +main : IO () +main = putPretty $ getGen decl diff --git a/tests/derivation/utils/fusion/merger/010 three types two args/derive.ipkg b/tests/derivation/utils/fusion/print/generator/010 three types two args/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/010 three types two args/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/010 three types two args/derive.ipkg diff --git a/tests/derivation/utils/fusion/print/generator/010 three types two args/expected b/tests/derivation/utils/fusion/print/generator/010 three types two args/expected new file mode 100644 index 000000000..5da629478 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/010 three types two args/expected @@ -0,0 +1,82 @@ +1/1: Building DerivedGen (DerivedGen.idr) +[ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genXYW" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "k") type + .=> var "DPair" + .$ type + .$ ( MkArg MW ExplicitArg (Just "m") type + .=> var "DPair" + .$ type + .$ ( MkArg + MW + ExplicitArg + (Just "n") + type + .=> var "XYW" + .$ var "k" + .$ var "m" + .$ var "n")))) + }) +, IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "genZ_ultimate" + , type = + MkArg MW ExplicitArg Nothing (var "Fuel") + .-> var "Gen" .$ var "MaybeEmpty" .$ var "Z" + }) +, IDef + emptyFC + "genZ_ultimate" + [ var "genZ_ultimate" .$ bindVar "fl" + .= var ">>=" + .$ (var "genXYW" .$ var "fl") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "MkDPair" + .$ bindVar "k" + .$ ( var "MkDPair" + .$ bindVar "m" + .$ ( var "MkDPair" + .$ bindVar "n" + .$ bindVar "xyw")) + .= iCase + { sc = var "splitXYW" .$ var "xyw" + , ty = implicitTrue + , clauses = + [ var "Builtin.MkPair" + .$ bindVar "x" + .$ ( var "Builtin.MkPair" + .$ bindVar "y" + .$ bindVar "w") + .= var "pure" + .$ ( var "MkZ" + .$ var "k" + .$ var "m" + .$ var "n" + .$ var "x" + .$ var "y" + .$ var "w") + ] + } + ] + }) + ] +] diff --git a/tests/derivation/utils/fusion/merger/010 three types two args/run b/tests/derivation/utils/fusion/print/generator/010 three types two args/run similarity index 100% rename from tests/derivation/utils/fusion/merger/010 three types two args/run rename to tests/derivation/utils/fusion/print/generator/010 three types two args/run diff --git a/tests/derivation/utils/fusion/merger/_common/derive.ipkg b/tests/derivation/utils/fusion/print/generator/_common/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/merger/_common/derive.ipkg rename to tests/derivation/utils/fusion/print/generator/_common/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/_common/run b/tests/derivation/utils/fusion/print/generator/_common/run similarity index 100% rename from tests/derivation/utils/fusion/merger/_common/run rename to tests/derivation/utils/fusion/print/generator/_common/run diff --git a/tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/001 one var match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/001 one var match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/001 one var match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/derive.ipkg b/tests/derivation/utils/fusion/print/merger/001 one var match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/001 one var match/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/001 one var match/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/001 one var match/expected b/tests/derivation/utils/fusion/print/merger/001 one var match/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/001 one var match/expected rename to tests/derivation/utils/fusion/print/merger/001 one var match/expected diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/run b/tests/derivation/utils/fusion/print/merger/001 one var match/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/001 one var match/run rename to tests/derivation/utils/fusion/print/merger/001 one var match/run diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/002 two var ordered match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/002 two var ordered match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/002 two var ordered match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/derive.ipkg b/tests/derivation/utils/fusion/print/merger/002 two var ordered match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/002 two var ordered match/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/002 two var ordered match/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/002 two var ordered match/expected b/tests/derivation/utils/fusion/print/merger/002 two var ordered match/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/002 two var ordered match/expected rename to tests/derivation/utils/fusion/print/merger/002 two var ordered match/expected diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/run b/tests/derivation/utils/fusion/print/merger/002 two var ordered match/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/002 two var ordered match/run rename to tests/derivation/utils/fusion/print/merger/002 two var ordered match/run diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/003 two var unordered match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/003 two var unordered match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/003 two var unordered match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/derive.ipkg b/tests/derivation/utils/fusion/print/merger/003 two var unordered match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/003 two var unordered match/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/003 two var unordered match/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/003 two var unordered match/expected b/tests/derivation/utils/fusion/print/merger/003 two var unordered match/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/003 two var unordered match/expected rename to tests/derivation/utils/fusion/print/merger/003 two var unordered match/expected diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/run b/tests/derivation/utils/fusion/print/merger/003 two var unordered match/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/003 two var unordered match/run rename to tests/derivation/utils/fusion/print/merger/003 two var unordered match/run diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/004 var-const match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/004 var-const match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/004 var-const match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/derive.ipkg b/tests/derivation/utils/fusion/print/merger/004 var-const match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/004 var-const match/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/004 var-const match/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/004 var-const match/expected b/tests/derivation/utils/fusion/print/merger/004 var-const match/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/004 var-const match/expected rename to tests/derivation/utils/fusion/print/merger/004 var-const match/expected diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/run b/tests/derivation/utils/fusion/print/merger/004 var-const match/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/004 var-const match/run rename to tests/derivation/utils/fusion/print/merger/004 var-const match/run diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/005 const-const match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/005 const-const match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/005 const-const match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/derive.ipkg b/tests/derivation/utils/fusion/print/merger/005 const-const match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/005 const-const match/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/005 const-const match/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/005 const-const match/expected b/tests/derivation/utils/fusion/print/merger/005 const-const match/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/005 const-const match/expected rename to tests/derivation/utils/fusion/print/merger/005 const-const match/expected diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/run b/tests/derivation/utils/fusion/print/merger/005 const-const match/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/005 const-const match/run rename to tests/derivation/utils/fusion/print/merger/005 const-const match/run diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/006 const-const no match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/006 const-const no match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/006 const-const no match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/derive.ipkg b/tests/derivation/utils/fusion/print/merger/006 const-const no match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/006 const-const no match/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/006 const-const no match/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/006 const-const no match/expected b/tests/derivation/utils/fusion/print/merger/006 const-const no match/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/006 const-const no match/expected rename to tests/derivation/utils/fusion/print/merger/006 const-const no match/expected diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/run b/tests/derivation/utils/fusion/print/merger/006 const-const no match/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/006 const-const no match/run rename to tests/derivation/utils/fusion/print/merger/006 const-const no match/run diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/007 prim-prim match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/007 prim-prim match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/007 prim-prim match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/derive.ipkg b/tests/derivation/utils/fusion/print/merger/007 prim-prim match/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/007 prim-prim match/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/007 prim-prim match/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/007 prim-prim match/expected b/tests/derivation/utils/fusion/print/merger/007 prim-prim match/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/007 prim-prim match/expected rename to tests/derivation/utils/fusion/print/merger/007 prim-prim match/expected diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/run b/tests/derivation/utils/fusion/print/merger/007 prim-prim match/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/007 prim-prim match/run rename to tests/derivation/utils/fusion/print/merger/007 prim-prim match/run diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/008 non-shared var/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/008 non-shared var/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/008 non-shared var/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/derive.ipkg b/tests/derivation/utils/fusion/print/merger/008 non-shared var/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/008 non-shared var/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/008 non-shared var/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/008 non-shared var/expected b/tests/derivation/utils/fusion/print/merger/008 non-shared var/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/008 non-shared var/expected rename to tests/derivation/utils/fusion/print/merger/008 non-shared var/expected diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/run b/tests/derivation/utils/fusion/print/merger/008 non-shared var/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/008 non-shared var/run rename to tests/derivation/utils/fusion/print/merger/008 non-shared var/run diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/009 three types fusion/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/009 three types fusion/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/009 three types fusion/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/derive.ipkg b/tests/derivation/utils/fusion/print/merger/009 three types fusion/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/009 three types fusion/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/009 three types fusion/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/009 three types fusion/expected b/tests/derivation/utils/fusion/print/merger/009 three types fusion/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/009 three types fusion/expected rename to tests/derivation/utils/fusion/print/merger/009 three types fusion/expected diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/run b/tests/derivation/utils/fusion/print/merger/009 three types fusion/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/009 three types fusion/run rename to tests/derivation/utils/fusion/print/merger/009 three types fusion/run diff --git a/tests/derivation/utils/fusion/merger/010 three types two args/DerivedGen.idr b/tests/derivation/utils/fusion/print/merger/010 three types two args/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/merger/010 three types two args/DerivedGen.idr rename to tests/derivation/utils/fusion/print/merger/010 three types two args/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/splitter/010 three types two args/derive.ipkg b/tests/derivation/utils/fusion/print/merger/010 three types two args/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/010 three types two args/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/010 three types two args/derive.ipkg diff --git a/tests/derivation/utils/fusion/merger/010 three types two args/expected b/tests/derivation/utils/fusion/print/merger/010 three types two args/expected similarity index 100% rename from tests/derivation/utils/fusion/merger/010 three types two args/expected rename to tests/derivation/utils/fusion/print/merger/010 three types two args/expected diff --git a/tests/derivation/utils/fusion/splitter/010 three types two args/run b/tests/derivation/utils/fusion/print/merger/010 three types two args/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/010 three types two args/run rename to tests/derivation/utils/fusion/print/merger/010 three types two args/run diff --git a/tests/derivation/utils/fusion/splitter/_common/derive.ipkg b/tests/derivation/utils/fusion/print/merger/_common/derive.ipkg similarity index 100% rename from tests/derivation/utils/fusion/splitter/_common/derive.ipkg rename to tests/derivation/utils/fusion/print/merger/_common/derive.ipkg diff --git a/tests/derivation/utils/fusion/splitter/_common/run b/tests/derivation/utils/fusion/print/merger/_common/run similarity index 100% rename from tests/derivation/utils/fusion/splitter/_common/run rename to tests/derivation/utils/fusion/print/merger/_common/run diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/001 one var match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/001 one var match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/001 one var match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/001 one var match/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/001 one var match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/001 one var match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/001 one var match/expected b/tests/derivation/utils/fusion/print/splitter/001 one var match/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/001 one var match/expected rename to tests/derivation/utils/fusion/print/splitter/001 one var match/expected diff --git a/tests/derivation/utils/fusion/print/splitter/001 one var match/run b/tests/derivation/utils/fusion/print/splitter/001 one var match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/001 one var match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/002 two var ordered match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/002 two var ordered match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/002 two var ordered match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/002 two var ordered match/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/002 two var ordered match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/002 two var ordered match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/002 two var ordered match/expected b/tests/derivation/utils/fusion/print/splitter/002 two var ordered match/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/002 two var ordered match/expected rename to tests/derivation/utils/fusion/print/splitter/002 two var ordered match/expected diff --git a/tests/derivation/utils/fusion/print/splitter/002 two var ordered match/run b/tests/derivation/utils/fusion/print/splitter/002 two var ordered match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/002 two var ordered match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/003 two var unordered match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/003 two var unordered match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/003 two var unordered match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/003 two var unordered match/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/003 two var unordered match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/003 two var unordered match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/003 two var unordered match/expected b/tests/derivation/utils/fusion/print/splitter/003 two var unordered match/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/003 two var unordered match/expected rename to tests/derivation/utils/fusion/print/splitter/003 two var unordered match/expected diff --git a/tests/derivation/utils/fusion/print/splitter/003 two var unordered match/run b/tests/derivation/utils/fusion/print/splitter/003 two var unordered match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/003 two var unordered match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/004 var-const match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/004 var-const match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/004 var-const match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/004 var-const match/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/004 var-const match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/004 var-const match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/004 var-const match/expected b/tests/derivation/utils/fusion/print/splitter/004 var-const match/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/004 var-const match/expected rename to tests/derivation/utils/fusion/print/splitter/004 var-const match/expected diff --git a/tests/derivation/utils/fusion/print/splitter/004 var-const match/run b/tests/derivation/utils/fusion/print/splitter/004 var-const match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/004 var-const match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/005 const-const match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/005 const-const match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/005 const-const match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/005 const-const match/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/005 const-const match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/005 const-const match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/005 const-const match/expected b/tests/derivation/utils/fusion/print/splitter/005 const-const match/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/005 const-const match/expected rename to tests/derivation/utils/fusion/print/splitter/005 const-const match/expected diff --git a/tests/derivation/utils/fusion/print/splitter/005 const-const match/run b/tests/derivation/utils/fusion/print/splitter/005 const-const match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/005 const-const match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/006 const-const no match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/006 const-const no match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/006 const-const no match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/006 const-const no match/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/006 const-const no match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/006 const-const no match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/006 const-const no match/expected b/tests/derivation/utils/fusion/print/splitter/006 const-const no match/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/006 const-const no match/expected rename to tests/derivation/utils/fusion/print/splitter/006 const-const no match/expected diff --git a/tests/derivation/utils/fusion/print/splitter/006 const-const no match/run b/tests/derivation/utils/fusion/print/splitter/006 const-const no match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/006 const-const no match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/007 prim-prim match/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/007 prim-prim match/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/007 prim-prim match/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/007 prim-prim match/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/007 prim-prim match/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/007 prim-prim match/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/007 prim-prim match/expected b/tests/derivation/utils/fusion/print/splitter/007 prim-prim match/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/007 prim-prim match/expected rename to tests/derivation/utils/fusion/print/splitter/007 prim-prim match/expected diff --git a/tests/derivation/utils/fusion/print/splitter/007 prim-prim match/run b/tests/derivation/utils/fusion/print/splitter/007 prim-prim match/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/007 prim-prim match/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/008 non-shared var/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/008 non-shared var/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/008 non-shared var/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/008 non-shared var/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/008 non-shared var/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/008 non-shared var/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/008 non-shared var/expected b/tests/derivation/utils/fusion/print/splitter/008 non-shared var/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/008 non-shared var/expected rename to tests/derivation/utils/fusion/print/splitter/008 non-shared var/expected diff --git a/tests/derivation/utils/fusion/print/splitter/008 non-shared var/run b/tests/derivation/utils/fusion/print/splitter/008 non-shared var/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/008 non-shared var/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/009 three types fusion/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/009 three types fusion/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/009 three types fusion/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/009 three types fusion/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/009 three types fusion/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/009 three types fusion/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/009 three types fusion/expected b/tests/derivation/utils/fusion/print/splitter/009 three types fusion/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/009 three types fusion/expected rename to tests/derivation/utils/fusion/print/splitter/009 three types fusion/expected diff --git a/tests/derivation/utils/fusion/print/splitter/009 three types fusion/run b/tests/derivation/utils/fusion/print/splitter/009 three types fusion/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/009 three types fusion/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/010 three types two args/DerivedGen.idr b/tests/derivation/utils/fusion/print/splitter/010 three types two args/DerivedGen.idr similarity index 100% rename from tests/derivation/utils/fusion/splitter/010 three types two args/DerivedGen.idr rename to tests/derivation/utils/fusion/print/splitter/010 three types two args/DerivedGen.idr diff --git a/tests/derivation/utils/fusion/print/splitter/010 three types two args/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/010 three types two args/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/010 three types two args/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/splitter/010 three types two args/expected b/tests/derivation/utils/fusion/print/splitter/010 three types two args/expected similarity index 100% rename from tests/derivation/utils/fusion/splitter/010 three types two args/expected rename to tests/derivation/utils/fusion/print/splitter/010 three types two args/expected diff --git a/tests/derivation/utils/fusion/print/splitter/010 three types two args/run b/tests/derivation/utils/fusion/print/splitter/010 three types two args/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/010 three types two args/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/fusion/print/splitter/_common/derive.ipkg b/tests/derivation/utils/fusion/print/splitter/_common/derive.ipkg new file mode 100644 index 000000000..762febf26 --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/_common/derive.ipkg @@ -0,0 +1,7 @@ +package derive-test + +authors = "Simon Tsirikov" + +opts = "--no-color --console-width 0" + +depends = deptycheck diff --git a/tests/derivation/utils/fusion/print/splitter/_common/run b/tests/derivation/utils/fusion/print/splitter/_common/run new file mode 100644 index 000000000..2a6b6401c --- /dev/null +++ b/tests/derivation/utils/fusion/print/splitter/_common/run @@ -0,0 +1,9 @@ +rm -rf build + +NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names + +flock "$1" pack -q install-deps derive.ipkg && \ +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg DerivedGen.idr && \ +pack exec DerivedGen.idr | "$NAMES_CLEANER" + +rm -rf build From 355f1b39f78380aff62085e396086118640bbe04 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Tue, 4 Jun 2024 22:35:46 +0300 Subject: [PATCH 10/53] fix tests --- src/Deriving/DepTyCheck/Util/Fusion.idr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index e34a5bc42..f08264618 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -237,9 +237,9 @@ deriveFusion l = do declareFusion : Vect (2 + n) (TypeInfo, List Name) -> Elab (Maybe FusionDecl) declareFusion l = do let derived = deriveFusion l - case derived of - Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef, fd.genFClaim, fd.genRClaim, fd.genRDef] - Nothing => declare [] + -- case derived of + -- Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef, fd.genFClaim, fd.genRClaim, fd.genRDef] + -- Nothing => declare [] pure $ derived From 28c354b3c752b6cc879e3dc11fea1d9566c8dad1 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Tue, 11 Jun 2024 11:32:36 +0300 Subject: [PATCH 11/53] WIP --- src/Deriving/DepTyCheck/Gen/Derive.idr | 2 +- src/Deriving/DepTyCheck/Util/Fusion.idr | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/Derive.idr b/src/Deriving/DepTyCheck/Gen/Derive.idr index a764d2bd9..6388446cb 100644 --- a/src/Deriving/DepTyCheck/Gen/Derive.idr +++ b/src/Deriving/DepTyCheck/Gen/Derive.idr @@ -17,7 +17,7 @@ import public Deriving.DepTyCheck.Util.Reflection public export record GenSignature where - constructor MkGenSignature + constructor MkGenSignature -- to use for genXY (later because you don't have TypeInfo before declare) targetType : TypeInfo {auto 0 targetTypeCorrect : AllTyArgsNamed targetType} givenParams : SortedSet $ Fin targetType.args.length diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index f08264618..9369f6093 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -205,7 +205,7 @@ deriveFusion l = do let fusedVarName = toLower $ nameStr fusionTypeName let typeVarNames = map (toLower . nameStr) typeNames let genRDef = def - `{genZ_ultimate} + `{genZ_ultimate} -- to pass a name of constructor [ var `{genZ_ultimate} .$ bindVar "fl" .= var `{(>>=)} @@ -213,7 +213,7 @@ deriveFusion l = do .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse `lam` iCase { - sc = var "{lamc:0}", + sc = var "{lamc:0}", -- to use a var with meaningful name ty = implicitFalse, clauses = [ genRMkDPair (bindVar fusedVarName) uniqueNames @@ -237,9 +237,9 @@ deriveFusion l = do declareFusion : Vect (2 + n) (TypeInfo, List Name) -> Elab (Maybe FusionDecl) declareFusion l = do let derived = deriveFusion l - -- case derived of - -- Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef, fd.genFClaim, fd.genRClaim, fd.genRDef] - -- Nothing => declare [] + case derived of + Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef, fd.genFClaim, fd.genRClaim, fd.genRDef] + Nothing => declare [] pure $ derived @@ -297,3 +297,14 @@ public export getGen : Maybe FusionDecl -> List Decl getGen Nothing = [] getGen (Just fd) = [fd.genFClaim, fd.genRClaim, fd.genRDef] + + +-- TODO: what happens with :doc +-- tests for order of dependent arguments +-- TODO: preserve order of args from left to right !!! IMPORTANT +-- solveDeps should be compatible with fuse (not to group what couldn't be fused) +-- TODO: declare fused type iff it does not exist (otherwise reuse) +-- TODO: highlevel name conventions resolving (pure) +-- TODO: remove declare stage from print tests (declare should be highlevel) +-- TODO: update to last compiler version and merge main +-- TODO: GenSignature -> Con -> genZ_ultimate(?) From 5d898b3644f1011cabfa7868e648230b9b62a483 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Tue, 18 Jun 2024 10:50:18 +0300 Subject: [PATCH 12/53] fix ordering of arguments according to original type constructor --- src/Deriving/DepTyCheck/Util/Fusion.idr | 74 ++++++++++++------- .../001 one var match/DerivedGen.idr | 2 +- .../002 two var ordered match/DerivedGen.idr | 2 +- .../DerivedGen.idr | 2 +- .../004 var-const match/DerivedGen.idr | 2 +- .../005 const-const match/DerivedGen.idr | 2 +- .../006 const-const no match/DerivedGen.idr | 2 +- .../007 prim-prim match/DerivedGen.idr | 2 +- .../008 non-shared var/DerivedGen.idr | 2 +- .../009 three types fusion/DerivedGen.idr | 2 +- .../010 three types two args/DerivedGen.idr | 2 +- .../print/merger/008 non-shared var/expected | 6 +- .../merger/010 three types two args/expected | 10 +-- .../splitter/008 non-shared var/expected | 2 +- .../010 three types two args/expected | 2 +- 15 files changed, 65 insertions(+), 49 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index 9369f6093..9aa017a71 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -118,7 +118,7 @@ record FusionDecl where splitDef : Decl genFClaim : Decl genRClaim : Decl - genRDef : Decl + genRDef : Name -> Name -> Name -> Decl prepareConArgs : TTImp -> List TTImp @@ -146,6 +146,17 @@ genFRhsClaim : Name -> List (Name, TTImp) -> TTImp genFRhsClaim n l = var `{Gen} .$ var `{MaybeEmpty} .$ genFDPair n l +public export +buildOrdering : Eq a => List (List a) -> List a +buildOrdering l = go l [] where + go : List (List a) -> List a -> List a + go [] res = reverse res + go (h::t) res = go t (merge h res) where + merge : List a -> List a -> List a + merge [] res = res + merge (h::t) res = if (elem h res) then merge t res else merge t (h::res) + + deriveFusion : Vect (2 + n) (TypeInfo, List Name) -> Maybe FusionDecl deriveFusion l = do let typeNames = toList $ map ((.name) . fst) l @@ -155,8 +166,8 @@ deriveFusion l = do let False = any isNothing typeArgs | True => Nothing - let uniqueArgs = nub $ (sortBy (comparing fst)) $ join $ catMaybes $ toList typeArgs -- arg types from type signature - let uniqueNames = nub $ sort $ join $ toList $ map snd l -- names from target type constructor + let uniqueNames = buildOrdering $ toList $ map snd l -- names from target type constructor + let uniqueArgs = nub $ (sortBy (comparing (\x => findIndex ((==) $ fst x) uniqueNames))) $ join $ catMaybes $ toList typeArgs -- arg types from type signature let True = length uniqueArgs == length uniqueNames -- same parameter name could not be associated with different types | False => Nothing @@ -192,7 +203,7 @@ deriveFusion l = do toList (map (toList . (map (nameStr . (.name) . fst))) consComb) else def splitName [impossibleClause (var splitName .$ implicitTrue)] - let stub = ILog Nothing + -- let stub = ILog Nothing let genFName = UN $ Basic ("gen" ++ (nameStr fusionTypeName)) let genFClaim = export' genFName $ (MkArg MW ExplicitArg Nothing (var `{Fuel})) .-> @@ -202,18 +213,21 @@ deriveFusion l = do (MkArg MW ExplicitArg Nothing (var `{Fuel})) .-> (var `{Gen} .$ var `{MaybeEmpty} .$ var `{Z}) + let lambdaHelpName = "{lamc:0}" + let fuelHelpName = "fl" + let fusedVarName = toLower $ nameStr fusionTypeName let typeVarNames = map (toLower . nameStr) typeNames - let genRDef = def - `{genZ_ultimate} -- to pass a name of constructor - [ var `{genZ_ultimate} - .$ bindVar "fl" + let genRDef = \ultimateGenName, fusedGenName, originalConsName => def + ultimateGenName + [ var ultimateGenName + .$ bindVar fuelHelpName .= var `{(>>=)} - .$ (var genFName .$ var `{fl}) + .$ (var fusedGenName .$ (var $ UN $ Basic fuelHelpName)) .$ ( - MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + MkArg MW ExplicitArg (Just lambdaHelpName) implicitFalse `lam` iCase { - sc = var "{lamc:0}", -- to use a var with meaningful name + sc = var lambdaHelpName, ty = implicitFalse, clauses = [ genRMkDPair (bindVar fusedVarName) uniqueNames @@ -223,7 +237,7 @@ deriveFusion l = do clauses = [ (splitRhsDef (map bindVar typeVarNames)) .= var `{pure} - .$ foldConstructor (var `{MkZ}) (map var uniqueNames ++ map (var . UN . Basic) typeVarNames) + .$ foldConstructor (var originalConsName) (map var uniqueNames ++ map (var . UN . Basic) typeVarNames) ] } ] @@ -234,13 +248,22 @@ deriveFusion l = do Just (MkFusionDecl dataDecl claimDecl defDecl genFClaim genRClaim genRDef) -declareFusion : Vect (2 + n) (TypeInfo, List Name) -> Elab (Maybe FusionDecl) -declareFusion l = do - let derived = deriveFusion l - case derived of - Just fd => declare [fd.dataType, fd.splitClaim, fd.splitDef, fd.genFClaim, fd.genRClaim, fd.genRDef] - Nothing => declare [] - pure $ derived +-- checkDeclared : Elaboration m => List Decl -> m (List Decl) +-- checkDeclared [] = pure [] +-- checkDeclared (x::xs) = do +-- tail <- checkDeclared xs +-- head <- case x of +-- IClaim _ _ _ _ (MkTy _ _ n _) => getInfo' n +-- IData _ _ _ (MkData _ n _ _ _) => getInfo' n +-- IDef _ n _ => getInfo' n +-- -- _ => pure [] +-- if null head then pure (x::tail) else pure tail + + +-- declareFusion : Elaboration m => List Decl -> m () +-- declareFusion l = do +-- notDeclaredYet <- checkDeclared l +-- declare notDeclaredYet prepareArgsSolve : Arg -> (Name, List String) @@ -271,14 +294,14 @@ runFusion x xArgs y yArgs = do xTI <- getInfo' x yTI <- getInfo' y let zipped = (xTI, xArgs) :: (yTI, yArgs) :: Nil - declareFusion zipped + pure $ deriveFusion zipped public export runFusionList : Vect (2 + n) (Name, List Name) -> Elab (Maybe FusionDecl) runFusionList l = do l' <- for l $ \(n, args) => (, args) <$> getInfo' n - declareFusion l' + pure $ deriveFusion l' public export @@ -294,17 +317,14 @@ getSplit (Just fd) = [fd.splitClaim, fd.splitDef] public export -getGen : Maybe FusionDecl -> List Decl -getGen Nothing = [] -getGen (Just fd) = [fd.genFClaim, fd.genRClaim, fd.genRDef] +getGen : Maybe FusionDecl -> Name -> Name -> Name -> List Decl +getGen Nothing _ _ _ = [] +getGen (Just fd) n1 n2 n3 = [fd.genFClaim, fd.genRClaim, fd.genRDef n1 n2 n3] -- TODO: what happens with :doc --- tests for order of dependent arguments --- TODO: preserve order of args from left to right !!! IMPORTANT -- solveDeps should be compatible with fuse (not to group what couldn't be fused) -- TODO: declare fused type iff it does not exist (otherwise reuse) -- TODO: highlevel name conventions resolving (pure) -- TODO: remove declare stage from print tests (declare should be highlevel) --- TODO: update to last compiler version and merge main -- TODO: GenSignature -> Con -> genZ_ultimate(?) diff --git a/tests/derivation/utils/fusion/print/generator/001 one var match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/001 one var match/DerivedGen.idr index 22ba774d4..eaa8c5901 100644 --- a/tests/derivation/utils/fusion/print/generator/001 one var match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/001 one var match/DerivedGen.idr @@ -20,4 +20,4 @@ decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXY} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/002 two var ordered match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/002 two var ordered match/DerivedGen.idr index 8923d1f73..e12a9609f 100644 --- a/tests/derivation/utils/fusion/print/generator/002 two var ordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/002 two var ordered match/DerivedGen.idr @@ -22,5 +22,5 @@ decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{m}, `{n}] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXY} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/003 two var unordered match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/003 two var unordered match/DerivedGen.idr index e3a3f5a11..e747cb703 100644 --- a/tests/derivation/utils/fusion/print/generator/003 two var unordered match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/003 two var unordered match/DerivedGen.idr @@ -21,4 +21,4 @@ decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{m}, `{n}] `{Y} [`{n}, `{m}] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXY} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/004 var-const match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/004 var-const match/DerivedGen.idr index 568e37ade..1c6961fab 100644 --- a/tests/derivation/utils/fusion/print/generator/004 var-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/004 var-const match/DerivedGen.idr @@ -21,4 +21,4 @@ decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXY} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/005 const-const match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/005 const-const match/DerivedGen.idr index 13f9f9b73..fb34f78d4 100644 --- a/tests/derivation/utils/fusion/print/generator/005 const-const match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/005 const-const match/DerivedGen.idr @@ -21,4 +21,4 @@ decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXY} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/006 const-const no match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/006 const-const no match/DerivedGen.idr index 1dbc529a2..184281f48 100644 --- a/tests/derivation/utils/fusion/print/generator/006 const-const no match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/006 const-const no match/DerivedGen.idr @@ -21,4 +21,4 @@ decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXY} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/007 prim-prim match/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/007 prim-prim match/DerivedGen.idr index c76c23c99..d6c574f03 100644 --- a/tests/derivation/utils/fusion/print/generator/007 prim-prim match/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/007 prim-prim match/DerivedGen.idr @@ -21,4 +21,4 @@ decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXY} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/008 non-shared var/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/008 non-shared var/DerivedGen.idr index 8fc1bf653..cc3bac84d 100644 --- a/tests/derivation/utils/fusion/print/generator/008 non-shared var/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/008 non-shared var/DerivedGen.idr @@ -21,4 +21,4 @@ decl : Maybe FusionDecl decl = %runElab runFusion `{X} [`{k}, `{m}] `{Y} [`{m}, `{n}] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXY} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/009 three types fusion/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/009 three types fusion/DerivedGen.idr index 447b29c5d..ebc0f227d 100644 --- a/tests/derivation/utils/fusion/print/generator/009 three types fusion/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/009 three types fusion/DerivedGen.idr @@ -24,4 +24,4 @@ decl : Maybe FusionDecl decl = %runElab runFusionList [(`{X}, [`{n}]), (`{Y}, [`{n}]), (`{W}, [`{n}])] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXYW} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/generator/010 three types two args/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/010 three types two args/DerivedGen.idr index 055dce567..971416408 100644 --- a/tests/derivation/utils/fusion/print/generator/010 three types two args/DerivedGen.idr +++ b/tests/derivation/utils/fusion/print/generator/010 three types two args/DerivedGen.idr @@ -23,4 +23,4 @@ decl : Maybe FusionDecl decl = %runElab runFusionList [(`{X}, [`{k}, `{m}]), (`{Y}, [`{m}, `{n}]), (`{W}, [`{n}, `{k}])] main : IO () -main = putPretty $ getGen decl +main = putPretty $ getGen decl `{genZ_ultimate} `{genXYW} `{MkZ} diff --git a/tests/derivation/utils/fusion/print/merger/008 non-shared var/expected b/tests/derivation/utils/fusion/print/merger/008 non-shared var/expected index 64dc6df32..399ab9d89 100644 --- a/tests/derivation/utils/fusion/print/merger/008 non-shared var/expected +++ b/tests/derivation/utils/fusion/print/merger/008 non-shared var/expected @@ -7,14 +7,14 @@ emptyFC "XY" (Just - ( MkArg MW ExplicitArg (Just "k") type - .-> MkArg MW ExplicitArg (Just "m") type + ( MkArg MW ExplicitArg (Just "m") type .-> MkArg MW ExplicitArg (Just "n") type + .-> MkArg MW ExplicitArg (Just "k") type .-> type)) [] [ mkTy { name = "MkX_MkY" - , type = var "XY" .$ bindVar "k" .$ bindVar "m" .$ bindVar "n" + , type = var "XY" .$ bindVar "m" .$ bindVar "n" .$ bindVar "k" } ]) ] diff --git a/tests/derivation/utils/fusion/print/merger/010 three types two args/expected b/tests/derivation/utils/fusion/print/merger/010 three types two args/expected index f8a219b84..86eaaba54 100644 --- a/tests/derivation/utils/fusion/print/merger/010 three types two args/expected +++ b/tests/derivation/utils/fusion/print/merger/010 three types two args/expected @@ -7,14 +7,10 @@ emptyFC "XYZ" (Just - ( MkArg MW ExplicitArg (Just "k") type + ( MkArg MW ExplicitArg (Just "n") type .-> MkArg MW ExplicitArg (Just "m") type - .-> MkArg MW ExplicitArg (Just "n") type + .-> MkArg MW ExplicitArg (Just "k") type .-> type)) [] - [ mkTy - { name = "MkX_MkY_MkZ" - , type = var "XYZ" .$ bindVar "k" .$ bindVar "m" .$ bindVar "n" - } - ]) + [mkTy {name = "MkX_MkY_MkZ", type = var "XYZ" .$ bindVar "k"}]) ] diff --git a/tests/derivation/utils/fusion/print/splitter/008 non-shared var/expected b/tests/derivation/utils/fusion/print/splitter/008 non-shared var/expected index 16abc6342..e106b4cee 100644 --- a/tests/derivation/utils/fusion/print/splitter/008 non-shared var/expected +++ b/tests/derivation/utils/fusion/print/splitter/008 non-shared var/expected @@ -11,7 +11,7 @@ MW ExplicitArg Nothing - (var "XY" .$ bindVar "k" .$ bindVar "m" .$ bindVar "n") + (var "XY" .$ bindVar "m" .$ bindVar "n" .$ bindVar "k") .-> var "Builtin.Pair" .$ (var "X" .$ bindVar "m" .$ bindVar "n") .$ (var "Y" .$ bindVar "n" .$ bindVar "k") diff --git a/tests/derivation/utils/fusion/print/splitter/010 three types two args/expected b/tests/derivation/utils/fusion/print/splitter/010 three types two args/expected index 653dfc9b2..dd6f66bdc 100644 --- a/tests/derivation/utils/fusion/print/splitter/010 three types two args/expected +++ b/tests/derivation/utils/fusion/print/splitter/010 three types two args/expected @@ -11,7 +11,7 @@ MW ExplicitArg Nothing - (var "XYZ" .$ bindVar "k" .$ bindVar "m" .$ bindVar "n") + (var "XYZ" .$ bindVar "n" .$ bindVar "m" .$ bindVar "k") .-> var "Builtin.Pair" .$ (var "X" .$ bindVar "n" .$ bindVar "m") .$ ( var "Builtin.Pair" From 8e5e328e9ecbaf1c56f4742d89c6092c834d7599 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Tue, 18 Jun 2024 12:01:12 +0300 Subject: [PATCH 13/53] fix fusion --- src/Deriving/DepTyCheck/Util/Fusion.idr | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index 9aa017a71..d330fe52c 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -6,7 +6,6 @@ import Language.Reflection.Derive import Language.Reflection.Pretty import Language.Reflection.Compat import public Deriving.DepTyCheck.Gen -import Deriving.DepTyCheck.Util.Collections import Deriving.DepTyCheck.Util.Reflection import Data.Nat From 9df33fa8d0dec521b9befa8364a0b898efcf5487 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 27 Mar 2023 13:40:49 +0300 Subject: [PATCH 14/53] [ new ] Add the default constructor derivator --- src/Deriving/DepTyCheck/Gen.idr | 5 +++++ tests/derivation/core/defaulthint/DerivedGen.idr | 10 ++++++++++ tests/derivation/core/defaulthint/derive.ipkg | 3 +++ tests/derivation/core/defaulthint/expected | 1 + tests/derivation/core/defaulthint/run | 6 ++++++ 5 files changed, 25 insertions(+) create mode 100644 tests/derivation/core/defaulthint/DerivedGen.idr create mode 100644 tests/derivation/core/defaulthint/derive.ipkg create mode 100644 tests/derivation/core/defaulthint/expected create mode 100755 tests/derivation/core/defaulthint/run diff --git a/src/Deriving/DepTyCheck/Gen.idr b/src/Deriving/DepTyCheck/Gen.idr index 7fe67428e..42307bce0 100644 --- a/src/Deriving/DepTyCheck/Gen.idr +++ b/src/Deriving/DepTyCheck/Gen.idr @@ -3,3 +3,8 @@ module Deriving.DepTyCheck.Gen import public Deriving.DepTyCheck.Gen.Entry %default total + +%defaulthint %inline +public export +DefaultConstructorDerivator : ConstructorDerivator +DefaultConstructorDerivator = LeastEffort diff --git a/tests/derivation/core/defaulthint/DerivedGen.idr b/tests/derivation/core/defaulthint/DerivedGen.idr new file mode 100644 index 000000000..d2b53d1e8 --- /dev/null +++ b/tests/derivation/core/defaulthint/DerivedGen.idr @@ -0,0 +1,10 @@ +module DerivedGen + +import Deriving.DepTyCheck + +%default total + +%language ElabReflection + +g : Fuel -> Gen MaybeEmpty Unit +g = deriveGen diff --git a/tests/derivation/core/defaulthint/derive.ipkg b/tests/derivation/core/defaulthint/derive.ipkg new file mode 100644 index 000000000..6acb1cc70 --- /dev/null +++ b/tests/derivation/core/defaulthint/derive.ipkg @@ -0,0 +1,3 @@ +package derive-test + +depends = deptycheck diff --git a/tests/derivation/core/defaulthint/expected b/tests/derivation/core/defaulthint/expected new file mode 100644 index 000000000..12294872c --- /dev/null +++ b/tests/derivation/core/defaulthint/expected @@ -0,0 +1 @@ +1/1: Building DerivedGen (DerivedGen.idr) diff --git a/tests/derivation/core/defaulthint/run b/tests/derivation/core/defaulthint/run new file mode 100755 index 000000000..cdaff1933 --- /dev/null +++ b/tests/derivation/core/defaulthint/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps derive.ipkg && \ +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg DerivedGen.idr + +rm -rf build From 5661fdfb75f5a005403cf7a411bb753dbfa9c7b9 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 27 Mar 2023 13:44:11 +0300 Subject: [PATCH 15/53] [ cleanup ] Remove now became useless hints of a constructor derivator --- README.md | 6 ------ deptycheck.ipkg | 2 +- examples/sorted-list/tests/gens/print/DerivedGen.idr | 2 -- tests/derivation/_common/PrintDerivation.idr | 2 +- tests/derivation/_common/RunDerivedGen.idr | 4 ---- .../distribution/dependent-rec-001/CheckDistribution.idr | 2 -- .../distribution/dependent-rec-002/CheckDistribution.idr | 2 -- .../distribution/list-nat-001/CheckDistribution.idr | 2 -- .../distribution/list-nat-002/CheckDistribution.idr | 2 -- .../derivation/distribution/nats-001/CheckDistribution.idr | 2 -- .../distribution/vect-nat-001/CheckDistribution.idr | 2 -- .../regression/unification-name-mismatch/DerivedGen.idr | 4 ---- tests/lib/coverage/ty-and-con-derived-001/PrintCoverage.idr | 4 ---- tests/lib/coverage/ty-and-con-derived-002/PrintCoverage.idr | 4 ---- tests/lib/coverage/ty-and-con-derived-003/PrintCoverage.idr | 4 ---- 15 files changed, 2 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 1d81b5803..177065fa1 100644 --- a/README.md +++ b/README.md @@ -301,12 +301,6 @@ You can read more on the design of generators in [documentation](https://deptych ## Derivation of generators - - DepTyCheck supports automatic derivation of generators using the datatype definition. For now, it is not tunable at all, however, it is planned to be added. diff --git a/deptycheck.ipkg b/deptycheck.ipkg index f4c05ea76..c06f92753 100644 --- a/deptycheck.ipkg +++ b/deptycheck.ipkg @@ -9,7 +9,7 @@ license = "MPL-2.0" sourcedir = "src" builddir = ".build" -version = 0.0.240616 +version = 0.0.240618 modules = Deriving.DepTyCheck , Deriving.DepTyCheck.Gen diff --git a/examples/sorted-list/tests/gens/print/DerivedGen.idr b/examples/sorted-list/tests/gens/print/DerivedGen.idr index 0c67db97a..aa7533642 100644 --- a/examples/sorted-list/tests/gens/print/DerivedGen.idr +++ b/examples/sorted-list/tests/gens/print/DerivedGen.idr @@ -8,6 +8,4 @@ import Data.List.Sorted %language ElabReflection -%hint LE : ConstructorDerivator; LE = LeastEffort - %runElab printDerived $ Fuel -> Gen MaybeEmpty SortedList diff --git a/tests/derivation/_common/PrintDerivation.idr b/tests/derivation/_common/PrintDerivation.idr index 75974dca9..df823d42f 100644 --- a/tests/derivation/_common/PrintDerivation.idr +++ b/tests/derivation/_common/PrintDerivation.idr @@ -1,6 +1,6 @@ module PrintDerivation -import public Deriving.DepTyCheck.Gen.Entry +import public Deriving.DepTyCheck.Gen %language ElabReflection diff --git a/tests/derivation/_common/RunDerivedGen.idr b/tests/derivation/_common/RunDerivedGen.idr index 612d88713..c7578e388 100644 --- a/tests/derivation/_common/RunDerivedGen.idr +++ b/tests/derivation/_common/RunDerivedGen.idr @@ -39,7 +39,3 @@ runGs checkedGens = do let genedValues = checkedGens <&> \(G gen) => map show $ unGenTryN 10 someStdGen $ gen $ limit 20 let delim = (putStrLn "-----" >>) for_ genedValues $ delim . Lazy.traverse_ (delim . putStrLn) - -export %hint -UsedConstructorDerivator : ConstructorDerivator -UsedConstructorDerivator = LeastEffort diff --git a/tests/derivation/distribution/dependent-rec-001/CheckDistribution.idr b/tests/derivation/distribution/dependent-rec-001/CheckDistribution.idr index 73c0034c0..37e9de804 100644 --- a/tests/derivation/distribution/dependent-rec-001/CheckDistribution.idr +++ b/tests/derivation/distribution/dependent-rec-001/CheckDistribution.idr @@ -6,8 +6,6 @@ import DistrCheckCommon %default total -%hint DA : ConstructorDerivator; DA = LeastEffort - data ListNat : Type data Constraint : ListNat -> Type diff --git a/tests/derivation/distribution/dependent-rec-002/CheckDistribution.idr b/tests/derivation/distribution/dependent-rec-002/CheckDistribution.idr index 9e6d20b9e..e9e899319 100644 --- a/tests/derivation/distribution/dependent-rec-002/CheckDistribution.idr +++ b/tests/derivation/distribution/dependent-rec-002/CheckDistribution.idr @@ -6,8 +6,6 @@ import DistrCheckCommon %default total -%hint DA : ConstructorDerivator; DA = LeastEffort - data ListNat : Type data Constraint : Nat -> ListNat -> Type diff --git a/tests/derivation/distribution/list-nat-001/CheckDistribution.idr b/tests/derivation/distribution/list-nat-001/CheckDistribution.idr index 0035f502a..44b09fec5 100644 --- a/tests/derivation/distribution/list-nat-001/CheckDistribution.idr +++ b/tests/derivation/distribution/list-nat-001/CheckDistribution.idr @@ -8,8 +8,6 @@ import DistrCheckCommon %language ElabReflection -%hint DA : ConstructorDerivator; DA = LeastEffort - data ListNat : Type where Nil : ListNat (::) : Nat -> ListNat -> ListNat diff --git a/tests/derivation/distribution/list-nat-002/CheckDistribution.idr b/tests/derivation/distribution/list-nat-002/CheckDistribution.idr index f2a62104c..802d10a1a 100644 --- a/tests/derivation/distribution/list-nat-002/CheckDistribution.idr +++ b/tests/derivation/distribution/list-nat-002/CheckDistribution.idr @@ -8,8 +8,6 @@ import DistrCheckCommon %language ElabReflection -%hint DA : ConstructorDerivator; DA = LeastEffort - data ListNat : Type where Nil : ListNat (::) : Nat -> ListNat -> ListNat diff --git a/tests/derivation/distribution/nats-001/CheckDistribution.idr b/tests/derivation/distribution/nats-001/CheckDistribution.idr index 268ab2b5a..53f7da95a 100644 --- a/tests/derivation/distribution/nats-001/CheckDistribution.idr +++ b/tests/derivation/distribution/nats-001/CheckDistribution.idr @@ -8,8 +8,6 @@ import DistrCheckCommon %language ElabReflection -%hint DA : ConstructorDerivator; DA = LeastEffort - nats : Fuel -> Gen MaybeEmpty Nat nats = deriveGen diff --git a/tests/derivation/distribution/vect-nat-001/CheckDistribution.idr b/tests/derivation/distribution/vect-nat-001/CheckDistribution.idr index fd2293465..1910d9140 100644 --- a/tests/derivation/distribution/vect-nat-001/CheckDistribution.idr +++ b/tests/derivation/distribution/vect-nat-001/CheckDistribution.idr @@ -8,8 +8,6 @@ import DistrCheckCommon %language ElabReflection -%hint DA : ConstructorDerivator; DA = LeastEffort - data VectNat : Nat -> Type where Nil : VectNat Z (::) : Nat -> VectNat n -> VectNat (S n) diff --git a/tests/derivation/least-effort/print/regression/unification-name-mismatch/DerivedGen.idr b/tests/derivation/least-effort/print/regression/unification-name-mismatch/DerivedGen.idr index e74d7450b..67cc352d7 100644 --- a/tests/derivation/least-effort/print/regression/unification-name-mismatch/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/unification-name-mismatch/DerivedGen.idr @@ -7,10 +7,6 @@ import PrintDerivation %language ElabReflection -%hint -UsedConstructorDerivator : ConstructorDerivator -UsedConstructorDerivator = LeastEffort - data X : Type where Nil : X (::) : Unit -> X -> X diff --git a/tests/lib/coverage/ty-and-con-derived-001/PrintCoverage.idr b/tests/lib/coverage/ty-and-con-derived-001/PrintCoverage.idr index 8834fedf2..d0d2e0b1f 100644 --- a/tests/lib/coverage/ty-and-con-derived-001/PrintCoverage.idr +++ b/tests/lib/coverage/ty-and-con-derived-001/PrintCoverage.idr @@ -15,10 +15,6 @@ export %hint smallStrs : Fuel -> Gen MaybeEmpty String smallStrs _ = elements ["", "a", "bc"] -export %hint -UsedConstructorDerivator : ConstructorDerivator -UsedConstructorDerivator = LeastEffort - data X = X1 | X2 Nat | X3 String data Y = Y1 | Y2 X | Y3 X X diff --git a/tests/lib/coverage/ty-and-con-derived-002/PrintCoverage.idr b/tests/lib/coverage/ty-and-con-derived-002/PrintCoverage.idr index 4f5807e08..41d346c6d 100644 --- a/tests/lib/coverage/ty-and-con-derived-002/PrintCoverage.idr +++ b/tests/lib/coverage/ty-and-con-derived-002/PrintCoverage.idr @@ -15,10 +15,6 @@ export %hint smallStrs : Fuel -> Gen MaybeEmpty String smallStrs _ = elements ["", "a", "bc"] -export %hint -UsedConstructorDerivator : ConstructorDerivator -UsedConstructorDerivator = LeastEffort - data X = X1 | X2 Nat | X3 String data Y : Nat -> Type where diff --git a/tests/lib/coverage/ty-and-con-derived-003/PrintCoverage.idr b/tests/lib/coverage/ty-and-con-derived-003/PrintCoverage.idr index 6bc4905f7..77bbac0dd 100644 --- a/tests/lib/coverage/ty-and-con-derived-003/PrintCoverage.idr +++ b/tests/lib/coverage/ty-and-con-derived-003/PrintCoverage.idr @@ -11,10 +11,6 @@ import System.Random.Pure.StdGen %language ElabReflection -export %hint -UsedConstructorDerivator : ConstructorDerivator -UsedConstructorDerivator = LeastEffort - data X : Bool -> Type where XT : X True XF : X False From 59307c42e57f5e8fe51e9fc842ab284d07a9ad08 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Tue, 25 Jun 2024 13:49:25 +0300 Subject: [PATCH 16/53] [ upstream ] Use precise variant for distributions checking --- deptycheck.ipkg | 2 +- tests/lib/distribution/_common/DistrCheckCommon.idr | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deptycheck.ipkg b/deptycheck.ipkg index c06f92753..99c97e6a7 100644 --- a/deptycheck.ipkg +++ b/deptycheck.ipkg @@ -9,7 +9,7 @@ license = "MPL-2.0" sourcedir = "src" builddir = ".build" -version = 0.0.240618 +version = 0.0.240624 modules = Deriving.DepTyCheck , Deriving.DepTyCheck.Gen diff --git a/tests/lib/distribution/_common/DistrCheckCommon.idr b/tests/lib/distribution/_common/DistrCheckCommon.idr index 3f4421c44..6029809f3 100644 --- a/tests/lib/distribution/_common/DistrCheckCommon.idr +++ b/tests/lib/distribution/_common/DistrCheckCommon.idr @@ -4,6 +4,7 @@ import Data.List.Lazy import public Test.DepTyCheck.Gen +import public Statistics.Norm.Precise import public Statistics.Confidence import System.Random.Pure.StdGen From 5fdf6a846e744a23f1ba7a34f24fbe6342446cc3 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 3 Jul 2024 08:36:37 +0300 Subject: [PATCH 17/53] [ upstream ] Fix one test, compiler now is smarter than it was --- deptycheck.ipkg | 2 +- .../utils/up-to-renaming-ttimp-eq/_common/Infra.idr | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/deptycheck.ipkg b/deptycheck.ipkg index 99c97e6a7..b5c23599c 100644 --- a/deptycheck.ipkg +++ b/deptycheck.ipkg @@ -9,7 +9,7 @@ license = "MPL-2.0" sourcedir = "src" builddir = ".build" -version = 0.0.240624 +version = 0.0.240702 modules = Deriving.DepTyCheck , Deriving.DepTyCheck.Gen diff --git a/tests/derivation/utils/up-to-renaming-ttimp-eq/_common/Infra.idr b/tests/derivation/utils/up-to-renaming-ttimp-eq/_common/Infra.idr index 236029a07..f7250f965 100644 --- a/tests/derivation/utils/up-to-renaming-ttimp-eq/_common/Infra.idr +++ b/tests/derivation/utils/up-to-renaming-ttimp-eq/_common/Infra.idr @@ -23,16 +23,6 @@ export So (NotTTImp a) => GivesTTImp a where toTTImp x = quote x --- `NotTTImp` does not reduce on `Type` and functions - -export -GivesTTImp Type where - toTTImp x = quote x - -export -GivesTTImp a => GivesTTImp b => GivesTTImp (a -> b) where - toTTImp x = quote x - export checkEq : GivesTTImp expr1 => GivesTTImp expr2 => String -> Bool -> expr1 -> expr2 -> Elab Unit checkEq desc res e1 e2 = do From f788ebb3d74817b663ce753e99be38f076dd71a5 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Thu, 25 Jul 2024 12:40:42 +0300 Subject: [PATCH 18/53] [ docs ] Make the natural language linter happier --- deptycheck.ipkg | 2 +- docs/source/explanation/derivation/design/single-con.md | 2 +- .../explanation/derivation/design/when-derivation-happens.md | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/deptycheck.ipkg b/deptycheck.ipkg index b5c23599c..5d15e2737 100644 --- a/deptycheck.ipkg +++ b/deptycheck.ipkg @@ -9,7 +9,7 @@ license = "MPL-2.0" sourcedir = "src" builddir = ".build" -version = 0.0.240702 +version = 0.0.240724 modules = Deriving.DepTyCheck , Deriving.DepTyCheck.Gen diff --git a/docs/source/explanation/derivation/design/single-con.md b/docs/source/explanation/derivation/design/single-con.md index 21d8a6d95..2cc555948 100644 --- a/docs/source/explanation/derivation/design/single-con.md +++ b/docs/source/explanation/derivation/design/single-con.md @@ -298,7 +298,7 @@ genD_idx_generated @{data_Nat} @{data_String} fuel b = data_D_giv_b fuel b --> In this case, generation of non-recursive constructors `JJ` and `TL` is straightforward, -the only difference is that `b` is a function argument, not a result of subgeneration. +the only difference is that `b` is a function parameter, not a result of subgeneration. Recursive cases are not so easy. Surely, we can first generate value `b` using derived `data_Bool` generator (as we did before for `JJ` constructor) diff --git a/docs/source/explanation/derivation/design/when-derivation-happens.md b/docs/source/explanation/derivation/design/when-derivation-happens.md index c2a655ff3..54abce1e6 100644 --- a/docs/source/explanation/derivation/design/when-derivation-happens.md +++ b/docs/source/explanation/derivation/design/when-derivation-happens.md @@ -62,7 +62,9 @@ thus inapplicable directly for dependent types. Since, we focus on total generators for dependent types, we cannot rely on common hybrid approach. Considering all said above, it is decided to go the hard way and to do derivation of generators directly, using metaprogramming facility if Idris called *elaboration scripts*. -% TODO to add a link to Idris documentation as soon as elaboration scripts are documented. + Thus, DepTyCheck's derivation mechanism is a fully compile-time metaprogram that analyses generated datatype and produces generator's code which is checked for type correctness and totality right after. From 1a5b6ee9913629fbc23a2c5ae38f87292315bf7f Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Tue, 13 Aug 2024 11:58:23 +0300 Subject: [PATCH 19/53] [ example ] Fix and refine a `pil-fun`'s test --- examples/pil-fun/tests/lang/usage/UsePil.idr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/pil-fun/tests/lang/usage/UsePil.idr b/examples/pil-fun/tests/lang/usage/UsePil.idr index 65f35d52b..aa416077f 100644 --- a/examples/pil-fun/tests/lang/usage/UsePil.idr +++ b/examples/pil-fun/tests/lang/usage/UsePil.idr @@ -35,7 +35,7 @@ program = do Call Print [< V 1] Nop -failing -- "Mismatch between: Int' and Bool'" +failing "Can't find an implementation for AtIndex" -- "Mismatch between: Int' and Bool'" bad : Stmts StdF [<] Nothing bad = do NewV Int' {- 0 -} Mutable $ C 5 @@ -43,15 +43,15 @@ failing -- "Mismatch between: Int' and Bool'" 1 #= F Plus [< V 0, C 1] Nop -failing -- "Mismatch between: [<] and [ Date: Wed, 14 Aug 2024 14:11:17 +0300 Subject: [PATCH 20/53] [ upstream ] Make one error message to be produced faster --- src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index c86098f12..b9fddff74 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -65,7 +65,7 @@ namespace NonObligatoryExts maybe e pure $ lookupType lhsName -- TODO to support `lhsName` to be a type parameter of type `Type` IPrimVal _ (PrT t) => pure $ typeInfoForPrimType t IType _ => pure typeInfoForTypeOfTypes - lhs => failAt (getFC lhs) "Only applications to a name is supported, given \{lhs}" + lhs => failAt (getFC lhs) "Only applications to a name is supported, given \{show lhs}" let Yes lengthCorrect = decEq ty.args.length args.length | No _ => failAt (getFC lhs) "INTERNAL ERROR: wrong count of unapp when analysing type application" _ <- ensureTyArgsNamed ty From 299f8371472dfac91542970f3dcee169a206f994 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 14 Aug 2024 20:21:07 +0300 Subject: [PATCH 21/53] [ derive ] Clean up repeating orders and log finally used ones --- src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index b9fddff74..cbd40160a 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -195,6 +195,10 @@ namespace NonObligatoryExts pure $ leftmost ++ leftToRightArgs ++ rightmost let allOrders = if simplificationHack then take 1 allOrders else allOrders + let allOrders = List.nub $ nub <$> allOrders + + for_ allOrders $ \order => + logPoint {level=10} "least-effort.order" [sig, con] "- one of used final orders: \{show order}" -------------------------- -- Producing the result -- From 3f618a27dd4abbe96b5f723bb396e5c11f266f59 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 14 Aug 2024 18:33:17 +0300 Subject: [PATCH 22/53] [ example ] Add the covering sequence example --- examples/README.md | 1 + examples/covering-seq/covering-seq.ipkg | 13 + .../covering-seq/src/Data/List/Covering.idr | 64 ++ .../src/Data/List/Covering/Gen.idr | 14 + examples/covering-seq/tests/.clean-names | 1 + examples/covering-seq/tests/Tests.idr | 9 + .../tests/data/simple-seqs/Main.idr | 35 + .../tests/data/simple-seqs/expected | 1 + .../covering-seq/tests/data/simple-seqs/run | 6 + .../tests/data/simple-seqs/test.ipkg | 3 + .../tests/gens/covering-seqs/Main.idr | 27 + .../tests/gens/covering-seqs/expected | 52 ++ .../covering-seq/tests/gens/covering-seqs/run | 6 + .../tests/gens/covering-seqs/test.ipkg | 6 + .../tests/gens/print/DerivedGen.idr | 11 + .../tests/gens/print/PrintDerivation.idr | 1 + .../covering-seq/tests/gens/print/derive.ipkg | 6 + .../covering-seq/tests/gens/print/expected | 734 ++++++++++++++++++ examples/covering-seq/tests/gens/print/run | 1 + examples/covering-seq/tests/tests.ipkg | 8 + pack.toml | 6 + 21 files changed, 1005 insertions(+) create mode 100644 examples/covering-seq/covering-seq.ipkg create mode 100644 examples/covering-seq/src/Data/List/Covering.idr create mode 100644 examples/covering-seq/src/Data/List/Covering/Gen.idr create mode 120000 examples/covering-seq/tests/.clean-names create mode 100644 examples/covering-seq/tests/Tests.idr create mode 100644 examples/covering-seq/tests/data/simple-seqs/Main.idr create mode 100644 examples/covering-seq/tests/data/simple-seqs/expected create mode 100755 examples/covering-seq/tests/data/simple-seqs/run create mode 100644 examples/covering-seq/tests/data/simple-seqs/test.ipkg create mode 100644 examples/covering-seq/tests/gens/covering-seqs/Main.idr create mode 100644 examples/covering-seq/tests/gens/covering-seqs/expected create mode 100755 examples/covering-seq/tests/gens/covering-seqs/run create mode 100644 examples/covering-seq/tests/gens/covering-seqs/test.ipkg create mode 100644 examples/covering-seq/tests/gens/print/DerivedGen.idr create mode 120000 examples/covering-seq/tests/gens/print/PrintDerivation.idr create mode 100644 examples/covering-seq/tests/gens/print/derive.ipkg create mode 100644 examples/covering-seq/tests/gens/print/expected create mode 120000 examples/covering-seq/tests/gens/print/run create mode 100644 examples/covering-seq/tests/tests.ipkg diff --git a/examples/README.md b/examples/README.md index 480b1c219..5e75a3aa3 100644 --- a/examples/README.md +++ b/examples/README.md @@ -16,6 +16,7 @@ The examples are the following: - [sorted lists](sorted-list/) of natural numbers - list and vector of strings, [both with unique elements](uniq-list/) implemented using `So` and usual `Eq` comparison +- a sequence of [unique mentions of a given subset](covering-seq/) of elements interleaved with unrelated elements - naive possibly empty [sorted binary trees](sorted-tree-naive/) of natural numbers, implemented as if without dependent types with added limitations on sortedness - [indexed non-empty sorted binary trees](sorted-tree-indexed/) of natural numbers, with type indices for value bounds diff --git a/examples/covering-seq/covering-seq.ipkg b/examples/covering-seq/covering-seq.ipkg new file mode 100644 index 000000000..ceb69a6e9 --- /dev/null +++ b/examples/covering-seq/covering-seq.ipkg @@ -0,0 +1,13 @@ +package covering-seq + +version = 0.1 + +authors = "Denis Buzdalov" + +sourcedir = "src" +builddir = ".build" + +depends = deptycheck + +modules = Data.List.Covering + , Data.List.Covering.Gen diff --git a/examples/covering-seq/src/Data/List/Covering.idr b/examples/covering-seq/src/Data/List/Covering.idr new file mode 100644 index 000000000..e7feeb68f --- /dev/null +++ b/examples/covering-seq/src/Data/List/Covering.idr @@ -0,0 +1,64 @@ +module Data.List.Covering + +import public Data.Fin +import Data.String + +%default total + +namespace BitMask + + -- BitMask n ~~ Vect n Bool + public export + data BitMask : (bits : Nat) -> Type where + Nil : BitMask 0 + (::) : Bool -> BitMask n -> BitMask (S n) + + export + Interpolation (BitMask n) where + interpolate [] = "" + interpolate (True ::bs) = "1\{bs}" + interpolate (False::bs) = "0\{bs}" + + public export + update : Fin n -> (newValue : Bool) -> BitMask n -> BitMask n + update FZ v (_::bs) = v::bs + update (FS n) v (b::bs) = b :: update n v bs + + namespace Index + + public export + data AtIndex : (n : Nat) -> Fin n -> BitMask n -> Bool -> Type where + Here : AtIndex (S n) FZ (b::bs) b + There : AtIndex n i bs v -> AtIndex (S n) (FS i) (b::bs) v + + public export + data AllBitsAre : (n : Nat) -> Bool -> BitMask n -> Type where + Finish : AllBitsAre Z b [] + Continue : AllBitsAre n b bs -> AllBitsAre (S n) b (b::bs) + + export + setBits : BitMask n -> List $ Fin n + setBits [] = [] + setBits $ True ::bs = FZ :: (FS <$> setBits bs) + setBits $ False::bs = FS <$> setBits bs + +-- Contains all and only mentions (hits) of values enabled in the given bitmask in any order interleaved with some arbitrary numbers (misses). +public export +data CoveringSequence : (n : Nat) -> BitMask n -> Type where + End : AllBitsAre n False bs => CoveringSequence n bs + Miss : Nat -> CoveringSequence n bs -> CoveringSequence n bs + Hit : (i : Fin n) -> AtIndex n i bs True => CoveringSequence n (update i False bs) -> CoveringSequence n bs + +public export +hits : CoveringSequence n bs -> List $ Fin n +hits End = [] +hits $ Miss k xs = hits xs +hits $ Hit i xs = i :: hits xs + +export +Interpolation (CoveringSequence n bs) where + interpolate = joinBy " " . asList where + asList : forall n, bs. CoveringSequence n bs -> List String + asList End = [] + asList $ Miss k xs = show k :: asList xs + asList $ Hit i xs = "[\{show i}]" :: asList xs diff --git a/examples/covering-seq/src/Data/List/Covering/Gen.idr b/examples/covering-seq/src/Data/List/Covering/Gen.idr new file mode 100644 index 000000000..6a5ced416 --- /dev/null +++ b/examples/covering-seq/src/Data/List/Covering/Gen.idr @@ -0,0 +1,14 @@ +module Data.List.Covering.Gen + +import public Data.List.Covering + +import public Test.DepTyCheck.Gen +import Deriving.DepTyCheck.Gen + +%default total + +%logging "deptycheck.derive" 5 + +export +genCoveringSequence : Fuel -> {n : Nat} -> (bs : BitMask n) -> Gen MaybeEmpty $ CoveringSequence n bs +genCoveringSequence = deriveGen diff --git a/examples/covering-seq/tests/.clean-names b/examples/covering-seq/tests/.clean-names new file mode 120000 index 000000000..205c45381 --- /dev/null +++ b/examples/covering-seq/tests/.clean-names @@ -0,0 +1 @@ +../../../tests/.clean-names \ No newline at end of file diff --git a/examples/covering-seq/tests/Tests.idr b/examples/covering-seq/tests/Tests.idr new file mode 100644 index 000000000..0460c48fc --- /dev/null +++ b/examples/covering-seq/tests/Tests.idr @@ -0,0 +1,9 @@ +module Tests + +import Test.Golden.RunnerHelper + +main : IO () +main = goldenRunner + [ "Covering sequence data structure" `atDir` "data" + , "Generator for covering sequences" `atDir` "gens" + ] diff --git a/examples/covering-seq/tests/data/simple-seqs/Main.idr b/examples/covering-seq/tests/data/simple-seqs/Main.idr new file mode 100644 index 000000000..de9cfb0b8 --- /dev/null +++ b/examples/covering-seq/tests/data/simple-seqs/Main.idr @@ -0,0 +1,35 @@ +import Data.List.Covering + +%default total + +MaskIIII : BitMask ? +MaskIIII = [True, True, True, True] + +x0123 : CoveringSequence ? MaskIIII +x0123 = Hit 0 $ Hit 1 $ Hit 2 $ Hit 3 $ End + +x0123' : CoveringSequence ? MaskIIII +x0123' = Hit 0 $ Hit 1 $ Miss 20 $ Hit 2 $ Hit 3 $ Miss 30 $ End + +x2301 : CoveringSequence ? MaskIIII +x2301 = Hit 2 $ Hit 3 $ Hit 0 $ Hit 1 $ End + +x2301' : CoveringSequence ? MaskIIII +x2301' = Hit 2 $ Hit 3 $ Miss 20 $ Hit 0 $ Hit 1 $ Miss 30 $ End + +failing "Can't find an implementation for AtIndex" + x23012 : CoveringSequence ? MaskIIII + x23012 = Hit 2 $ Hit 3 $ Hit 0 $ Hit 1 $ Hit 2 $ End + +MaskIIOI : BitMask ? +MaskIIOI = [True, True, False, True] + +x013 : CoveringSequence ? MaskIIOI +x013 = Hit 0 $ Hit 1 $ Hit 3 $ End + +x103 : CoveringSequence ? MaskIIOI +x103 = Hit 1 $ Hit 0 $ Hit 3 $ End + +failing "Can't find an implementation for AtIndex" + badx0123 : CoveringSequence ? MaskIIOI + badx0123 = Hit 0 $ Hit 1 $ Hit 2 $ Hit 3 $ End diff --git a/examples/covering-seq/tests/data/simple-seqs/expected b/examples/covering-seq/tests/data/simple-seqs/expected new file mode 100644 index 000000000..b2b84aa45 --- /dev/null +++ b/examples/covering-seq/tests/data/simple-seqs/expected @@ -0,0 +1 @@ +1/1: Building Main (Main.idr) diff --git a/examples/covering-seq/tests/data/simple-seqs/run b/examples/covering-seq/tests/data/simple-seqs/run new file mode 100755 index 000000000..e95d24fbc --- /dev/null +++ b/examples/covering-seq/tests/data/simple-seqs/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps test.ipkg && \ +idris2 --find-ipkg --check Main.idr + +rm -rf build diff --git a/examples/covering-seq/tests/data/simple-seqs/test.ipkg b/examples/covering-seq/tests/data/simple-seqs/test.ipkg new file mode 100644 index 000000000..cadc7efca --- /dev/null +++ b/examples/covering-seq/tests/data/simple-seqs/test.ipkg @@ -0,0 +1,3 @@ +package a-test + +depends = covering-seq diff --git a/examples/covering-seq/tests/gens/covering-seqs/Main.idr b/examples/covering-seq/tests/gens/covering-seqs/Main.idr new file mode 100644 index 000000000..ef26d8b81 --- /dev/null +++ b/examples/covering-seq/tests/gens/covering-seqs/Main.idr @@ -0,0 +1,27 @@ +import Data.Fuel +import Data.List +import Data.List.Lazy +import Data.List.Covering.Gen +import Data.String + +import System.Random.Pure.StdGen + +%default total + +submain : {n : _} -> BitMask n -> IO () +submain bs = do + putStrLn "-----------------------" + putStrLn "bitmask: \{bs}" + putStrLn "-----------------------" + let vals = unGenTryN 10 someStdGen $ genCoveringSequence (limit $ 2 * n) bs + Lazy.for_ vals $ \v => do + let hits = hits v + let verdict = if sort hits == setBits bs then "ok" else "fail, hits are: \{show hits}, expected: \{show $ setBits bs}" + putStrLn "\{v} (\{verdict})" + +main : IO () +main = do + submain [True, True, True, True] + submain [True, False, True, True] + submain [False, False, True, False] + submain [False, False, False, False] diff --git a/examples/covering-seq/tests/gens/covering-seqs/expected b/examples/covering-seq/tests/gens/covering-seqs/expected new file mode 100644 index 000000000..19014a5c4 --- /dev/null +++ b/examples/covering-seq/tests/gens/covering-seqs/expected @@ -0,0 +1,52 @@ +----------------------- +bitmask: 1111 +----------------------- +3 3 [1] [3] [2] [0] 5 (ok) +[2] [3] [1] [0] (ok) +[3] [2] [1] 1 [0] 2 (ok) +5 3 3 4 [3] [2] [1] [0] (ok) +1 6 4 2 [3] [0] [2] [1] (ok) +0 1 [3] [2] 7 [1] [0] (ok) +8 5 [3] 5 [2] 7 [1] [0] (ok) +[3] 7 [2] [1] 5 [0] 6 (ok) +[3] [2] 5 [1] [0] (ok) +[3] 4 [2] 3 [1] [0] 2 8 (ok) +----------------------- +bitmask: 1011 +----------------------- +3 3 [3] 4 [2] [0] 5 (ok) +[2] [3] [0] (ok) +8 6 [0] [3] 2 [2] 6 (ok) +[3] 3 4 6 1 8 [2] [0] (ok) +[3] 5 0 [2] [0] 3 (ok) +[3] 7 7 [2] [0] (ok) +7 [3] 8 3 7 [2] [0] 7 (ok) +[3] 8 [2] 0 0 5 [0] (ok) +7 [3] [2] 3 8 8 [0] 4 (ok) +[3] 4 [2] 5 [0] 4 2 6 (ok) +----------------------- +bitmask: 0010 +----------------------- +3 3 [2] 1 4 (ok) +8 7 5 2 [2] 0 3 8 (ok) +[2] 0 4 (ok) +0 8 [2] (ok) +[2] 4 (ok) +6 1 8 1 6 4 2 [2] (ok) +7 1 [2] 5 7 (ok) +8 5 [2] 7 8 7 3 (ok) +8 5 7 8 [2] 8 6 (ok) +[2] 7 5 5 (ok) +----------------------- +bitmask: 0000 +----------------------- +3 3 1 4 4 (ok) +8 7 5 2 2 1 3 8 (ok) +0 4 6 8 5 (ok) +3 4 (ok) +6 1 8 (ok) +4 2 1 2 5 1 2 7 (ok) +5 7 7 7 0 (ok) +7 5 8 6 7 5 (ok) +8 7 6 2 (ok) +8 7 3 5 (ok) diff --git a/examples/covering-seq/tests/gens/covering-seqs/run b/examples/covering-seq/tests/gens/covering-seqs/run new file mode 100755 index 000000000..3445c95bf --- /dev/null +++ b/examples/covering-seq/tests/gens/covering-seqs/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps test.ipkg && \ +pack run test.ipkg + +rm -rf build diff --git a/examples/covering-seq/tests/gens/covering-seqs/test.ipkg b/examples/covering-seq/tests/gens/covering-seqs/test.ipkg new file mode 100644 index 000000000..a094bbec5 --- /dev/null +++ b/examples/covering-seq/tests/gens/covering-seqs/test.ipkg @@ -0,0 +1,6 @@ +package a-test + +depends = covering-seq + +executable = a-test +main = Main diff --git a/examples/covering-seq/tests/gens/print/DerivedGen.idr b/examples/covering-seq/tests/gens/print/DerivedGen.idr new file mode 100644 index 000000000..1d7d38705 --- /dev/null +++ b/examples/covering-seq/tests/gens/print/DerivedGen.idr @@ -0,0 +1,11 @@ +module DerivedGen + +import PrintDerivation + +import Data.List.Covering + +%default total + +%language ElabReflection + +%runElab printDerived $ Fuel -> {n : Nat} -> (bs : BitMask n) -> Gen MaybeEmpty $ CoveringSequence n bs diff --git a/examples/covering-seq/tests/gens/print/PrintDerivation.idr b/examples/covering-seq/tests/gens/print/PrintDerivation.idr new file mode 120000 index 000000000..af4998fcf --- /dev/null +++ b/examples/covering-seq/tests/gens/print/PrintDerivation.idr @@ -0,0 +1 @@ +../../../../../tests/derivation/_common/PrintDerivation.idr \ No newline at end of file diff --git a/examples/covering-seq/tests/gens/print/derive.ipkg b/examples/covering-seq/tests/gens/print/derive.ipkg new file mode 100644 index 000000000..dd2f3cc24 --- /dev/null +++ b/examples/covering-seq/tests/gens/print/derive.ipkg @@ -0,0 +1,6 @@ +package derive-test + +authors = "Denis Buzdalov" + +depends = deptycheck + , covering-seq diff --git a/examples/covering-seq/tests/gens/print/expected b/examples/covering-seq/tests/gens/print/expected new file mode 100644 index 000000000..9899c0753 --- /dev/null +++ b/examples/covering-seq/tests/gens/print/expected @@ -0,0 +1,734 @@ +1/2: Building PrintDerivation (PrintDerivation.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (bs : BitMask n) -> Gen MaybeEmpty (CoveringSequence n bs) +LOG gen.auto.derive.infra:0: + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ImplicitArg (Just "outer^") implicitTrue +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.List.Covering.CoveringSequence" .$ var "n" .$ var "{arg:1}") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1, 2, 3]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Data.Fin.Fin" .$ var "n") + .-> MkArg MW ExplicitArg (Just "{arg:3}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> MkArg MW ExplicitArg (Just "{arg:4}") (var "Prelude.Basics.Bool") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.List.Covering.BitMask.Index.AtIndex" .$ var "n" .$ var "{arg:2}" .$ var "{arg:3}" .$ var "{arg:4}") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1, 2]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:5}") (var "Prelude.Basics.Bool") + .-> MkArg MW ExplicitArg (Just "{arg:6}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.List.Covering.BitMask.Index.AllBitsAre" .$ var "n" .$ var "{arg:5}" .$ var "{arg:6}") + }) + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.List.Covering.CoveringSequence" .$ var "n" .$ var "{arg:1}") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.List.Covering.CoveringSequence" .$ var "n" .$ var "{arg:1}") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.List.Covering.CoveringSequence" .$ var "n" .$ var "{arg:1}") + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" .$ bindVar "bs" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.End (orders)")) + .$ ( var ">>=" + .$ ( var "[0, 1, 2]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "Prelude.Basics.False" + .$ var "bs") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{conArg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.List.Covering.End" .! ("n", var "n") .! ("bs", var "bs") .@ var "^bnd^{conArg:1}"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" .$ bindVar "bs" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.Miss (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:7}") implicitFalse + .=> var ">>=" + .$ (var "[0, 1]" .$ var "^cons_fuel^" .$ var "n" .$ var "bs") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:8}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Data.List.Covering.Miss" + .! ("n", var "n") + .! ("bs", var "bs") + .$ var "^bnd^{arg:7}" + .$ var "^bnd^{arg:8}")))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" .$ bindVar "bs" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.Hit (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n") + .$ ( MkArg MW ExplicitArg (Just "i") implicitFalse + .=> var ">>=" + .$ ( var "[0, 1, 2, 3]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "i" + .$ var "bs" + .$ var "Prelude.Basics.True") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{conArg:2}") implicitFalse + .=> var ">>=" + .$ ( var "[0, 1]" + .$ var "^cons_fuel^" + .$ var "n" + .$ ( var "Data.List.Covering.BitMask.update" + .! ("n", var "n") + .$ var "i" + .$ var "Prelude.Basics.False" + .$ var "bs")) + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:9}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Data.List.Covering.Hit" + .! ("n", var "n") + .! ("bs", var "bs") + .$ var "i" + .@ var "^bnd^{conArg:2}" + .$ var "^bnd^{arg:9}"))))) + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.CoveringSequence[0, 1] (dry fuel)")) + .$ (var "<>" .$ var "Data.Fuel.Dry" .$ var "inter^" .$ var "inter^<{arg:1}>") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.CoveringSequence[0, 1] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:1}>")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:1}>")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:1}>")) + .$ var "Nil")))) + ] + } + } + ] + , IDef + emptyFC + "[0, 1, 2, 3]" + [ var "[0, 1, 2, 3]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^<{arg:2}>" + .$ bindVar "inter^<{arg:3}>" + .$ bindVar "inter^<{arg:4}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Data.Fin.Fin" .$ var "n") + .-> MkArg MW ExplicitArg (Just "{arg:3}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> MkArg MW ExplicitArg (Just "{arg:4}") (var "Prelude.Basics.Bool") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Data.List.Covering.BitMask.Index.AtIndex" + .$ var "n" + .$ var "{arg:2}" + .$ var "{arg:3}" + .$ var "{arg:4}") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Data.Fin.Fin" .$ var "n") + .-> MkArg MW ExplicitArg (Just "{arg:3}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> MkArg MW ExplicitArg (Just "{arg:4}") (var "Prelude.Basics.Bool") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Data.List.Covering.BitMask.Index.AtIndex" + .$ var "n" + .$ var "{arg:2}" + .$ var "{arg:3}" + .$ var "{arg:4}") + }) + , IDef + emptyFC + "<>" + [ withClause + { lhs = + var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ (var "Data.Fin.FZ" .! ("k", implicitTrue)) + .$ (var "Data.List.Covering.BitMask.(::)" .! ("n", implicitTrue) .$ bindVar "b" .$ bindVar "bs") + .$ bindVar "to_be_deceqed^^b0" + , rig = MW + , wval = var "Decidable.Equality.decEq" .$ var "to_be_deceqed^^b0" .$ var "b" + , prf = Nothing + , flags = [] + , clauses = + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ (var "Data.Fin.FZ" .! ("k", implicitTrue)) + .$ (var "Data.List.Covering.BitMask.(::)" .! ("n", implicitTrue) .$ bindVar "b" .$ bindVar "bs") + .$ bindVar "b" + .$ (var "Prelude.Yes" .$ var "Builtin.Refl") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.Here (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.List.Covering.BitMask.Index.Here" .! ("n", var "n") .! ("bs", var "bs") .! ("b", var "b"))) + , var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ (var "Data.Fin.FZ" .! ("k", implicitTrue)) + .$ (var "Data.List.Covering.BitMask.(::)" .! ("n", implicitTrue) .$ bindVar "b" .$ bindVar "bs") + .$ bindVar "to_be_deceqed^^b0" + .$ (var "Prelude.No" .$ implicitTrue) + .= var "empty" + ] + } + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ bindVar "i") + .$ (var "Data.List.Covering.BitMask.(::)" .! ("n", implicitTrue) .$ bindVar "b" .$ bindVar "bs") + .$ bindVar "v" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.There (orders)")) + .$ ( var ">>=" + .$ ( var "[0, 1, 2, 3]" + .$ var "^cons_fuel^" + .$ var "n" + .$ var "i" + .$ var "bs" + .$ var "v") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:10}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Data.List.Covering.BitMask.Index.There" + .! ("b", var "b") + .! ("v", var "v") + .! ("n", var "n") + .! ("bs", var "bs") + .! ("i", var "i") + .$ var "^bnd^{arg:10}"))) + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue + .= var "empty" + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.AtIndex[0, 1, 2, 3] (dry fuel)")) + .$ ( var "<>" + .$ var "Data.Fuel.Dry" + .$ var "inter^" + .$ var "inter^<{arg:2}>" + .$ var "inter^<{arg:3}>" + .$ var "inter^<{arg:4}>") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.AtIndex[0, 1, 2, 3] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:2}>" + .$ var "inter^<{arg:3}>" + .$ var "inter^<{arg:4}>")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:2}>" + .$ var "inter^<{arg:3}>" + .$ var "inter^<{arg:4}>")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.Fin.Fin" .$ var "n") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.Fin.Fin" .$ var "n") + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.FZ (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FZ" .! ("k", var "k"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:11}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", var "k") .$ var "^bnd^{arg:11}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0] (dry fuel)")) + .$ (var "<>" .$ var "Data.Fuel.Dry" .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Z (orders)")) + .$ (var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ var "Prelude.Types.Z") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:12}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "^bnd^{arg:12}"))) + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (dry fuel)")) + .$ (var "<>" .$ var "Data.Fuel.Dry") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[0, 1, 2]" + [ var "[0, 1, 2]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^<{arg:5}>" + .$ bindVar "inter^<{arg:6}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:5}") (var "Prelude.Basics.Bool") + .-> MkArg MW ExplicitArg (Just "{arg:6}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.List.Covering.BitMask.Index.AllBitsAre" .$ var "n" .$ var "{arg:5}" .$ var "{arg:6}") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:5}") (var "Prelude.Basics.Bool") + .-> MkArg MW ExplicitArg (Just "{arg:6}") (var "Data.List.Covering.BitMask.BitMask" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.List.Covering.BitMask.Index.AllBitsAre" .$ var "n" .$ var "{arg:5}" .$ var "{arg:6}") + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" + .$ bindVar "b" + .$ var "Data.List.Covering.BitMask.Nil" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.Finish (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.List.Covering.BitMask.Index.Finish" .! ("b", var "b"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ withClause + { lhs = + var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ bindVar "b" + .$ (var "Data.List.Covering.BitMask.(::)" .! ("n", implicitTrue) .$ bindVar "to_be_deceqed^^b0" .$ bindVar "bs") + , rig = MW + , wval = var "Decidable.Equality.decEq" .$ var "to_be_deceqed^^b0" .$ var "b" + , prf = Nothing + , flags = [] + , clauses = + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ bindVar "b" + .$ (var "Data.List.Covering.BitMask.(::)" .! ("n", implicitTrue) .$ bindVar "b" .$ bindVar "bs") + .$ (var "Prelude.Yes" .$ var "Builtin.Refl") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.Continue (orders)")) + .$ ( var ">>=" + .$ ( var "[0, 1, 2]" + .$ var "^cons_fuel^" + .$ var "n" + .$ var "b" + .$ var "bs") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:13}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Data.List.Covering.BitMask.Index.Continue" + .! ("n", var "n") + .! ("bs", var "bs") + .! ("b", var "b") + .$ var "^bnd^{arg:13}"))) + , var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ bindVar "b" + .$ ( var "Data.List.Covering.BitMask.(::)" + .! ("n", implicitTrue) + .$ bindVar "to_be_deceqed^^b0" + .$ bindVar "bs") + .$ (var "Prelude.No" .$ implicitTrue) + .= var "empty" + ] + } + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.AllBitsAre[0, 1, 2] (dry fuel)")) + .$ ( var "<>" + .$ var "Data.Fuel.Dry" + .$ var "inter^" + .$ var "inter^<{arg:5}>" + .$ var "inter^<{arg:6}>") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.AllBitsAre[0, 1, 2] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:5}>" + .$ var "inter^<{arg:6}>")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:5}>" + .$ var "inter^<{arg:6}>")) + .$ var "Nil"))) + ] + } + } + ] + ] + , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/examples/covering-seq/tests/gens/print/run b/examples/covering-seq/tests/gens/print/run new file mode 120000 index 000000000..d47546361 --- /dev/null +++ b/examples/covering-seq/tests/gens/print/run @@ -0,0 +1 @@ +../../../../../tests/derivation/_common/run \ No newline at end of file diff --git a/examples/covering-seq/tests/tests.ipkg b/examples/covering-seq/tests/tests.ipkg new file mode 100644 index 000000000..5f0f1f0de --- /dev/null +++ b/examples/covering-seq/tests/tests.ipkg @@ -0,0 +1,8 @@ +package covering-seq-tests + +main = Tests +executable = runtests + +builddir = ".build" + +depends = golden-runner-helper diff --git a/pack.toml b/pack.toml index 79612aaf0..aa47fa769 100644 --- a/pack.toml +++ b/pack.toml @@ -30,6 +30,12 @@ path = "examples/sorted-list" ipkg = "sorted-list.ipkg" test = "tests/tests.ipkg" +[custom.all.covering-seq] +type = "local" +path = "examples/covering-seq" +ipkg = "covering-seq.ipkg" +test = "tests/tests.ipkg" + [custom.all.uniq-list] type = "local" path = "examples/uniq-list" From 2a8f63ddf75d08b62626280362dfd3bf01934957 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 14 Aug 2024 23:36:32 +0300 Subject: [PATCH 23/53] [ ux, derive ] Improve an error message of a function in a constructor --- .../DepTyCheck/Gen/Core/ConsDerive.idr | 3 ++- .../function-in-cons/DerivedGen.idr | 21 ++++++++++++++++ .../function-in-cons/RunDerivedGen.idr | 1 + .../regression/function-in-cons/derive.ipkg | 1 + .../run/regression/function-in-cons/expected | 25 +++++++++++++++++++ .../run/regression/function-in-cons/run | 1 + 6 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 tests/derivation/least-effort/run/regression/function-in-cons/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/function-in-cons/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/function-in-cons/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/function-in-cons/expected create mode 120000 tests/derivation/least-effort/run/regression/function-in-cons/run diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index cbd40160a..2dbe763da 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -65,7 +65,8 @@ namespace NonObligatoryExts maybe e pure $ lookupType lhsName -- TODO to support `lhsName` to be a type parameter of type `Type` IPrimVal _ (PrT t) => pure $ typeInfoForPrimType t IType _ => pure typeInfoForTypeOfTypes - lhs => failAt (getFC lhs) "Only applications to a name is supported, given \{show lhs}" + lhs@(IPi {}) => failAt (getFC lhs) "Fields with function types are not supported in constructors" + lhs => failAt (getFC lhs) "Unsupported type of a constructor field: \{show lhs}" let Yes lengthCorrect = decEq ty.args.length args.length | No _ => failAt (getFC lhs) "INTERNAL ERROR: wrong count of unapp when analysing type application" _ <- ensureTyArgsNamed ty diff --git a/tests/derivation/least-effort/run/regression/function-in-cons/DerivedGen.idr b/tests/derivation/least-effort/run/regression/function-in-cons/DerivedGen.idr new file mode 100644 index 000000000..1336a5090 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/function-in-cons/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data X : Type where + MkX : (Unit -> Unit) -> X + +Show X where + show (MkX f) = "MkX f" + +%language ElabReflection + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl + ] diff --git a/tests/derivation/least-effort/run/regression/function-in-cons/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/function-in-cons/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/function-in-cons/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/function-in-cons/derive.ipkg b/tests/derivation/least-effort/run/regression/function-in-cons/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/function-in-cons/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/function-in-cons/expected b/tests/derivation/least-effort/run/regression/function-in-cons/expected new file mode 100644 index 000000000..5cb6cd77c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/function-in-cons/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Error: While processing right hand side of checkedGen. Sorry, I can't find any elaboration which works. All errors: +Possible error: + Error during reflection: Fields with function types are not supported in constructors + + DerivedGen:8:10--8:22 + 4 | + 5 | %default total + 6 | + 7 | data X : Type where + 8 | MkX : (Unit -> Unit) -> X + ^^^^^^^^^^^^ + +Possible error: + Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present + + DerivedGen:16:14--16:23 + 12 | + 13 | %language ElabReflection + 14 | + 15 | checkedGen : Fuel -> Gen MaybeEmpty X + 16 | checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + ^^^^^^^^^ + diff --git a/tests/derivation/least-effort/run/regression/function-in-cons/run b/tests/derivation/least-effort/run/regression/function-in-cons/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/function-in-cons/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 3fa6e53f9687a57d072b2ce2e1340170dd492b9e Mon Sep 17 00:00:00 2001 From: Daniil Date: Fri, 16 Aug 2024 18:46:43 +0300 Subject: [PATCH 24/53] [ mcov ] Add remaining generator runners with ModelCoverage --- src/Test/DepTyCheck/Gen/Coverage.idr | 18 +++++- .../ty-and-con-withCov-010/PrintCoverage.idr | 43 ++++++++++++++ .../coverage/ty-and-con-withCov-010/expected | 16 ++++++ tests/lib/coverage/ty-and-con-withCov-010/run | 8 +++ .../coverage/ty-and-con-withCov-010/test.ipkg | 6 ++ .../ty-and-con-withCov-011/PrintCoverage.idr | 57 +++++++++++++++++++ .../coverage/ty-and-con-withCov-011/expected | 48 ++++++++++++++++ tests/lib/coverage/ty-and-con-withCov-011/run | 8 +++ .../coverage/ty-and-con-withCov-011/test.ipkg | 6 ++ 9 files changed, 207 insertions(+), 3 deletions(-) create mode 100644 tests/lib/coverage/ty-and-con-withCov-010/PrintCoverage.idr create mode 100644 tests/lib/coverage/ty-and-con-withCov-010/expected create mode 100755 tests/lib/coverage/ty-and-con-withCov-010/run create mode 100644 tests/lib/coverage/ty-and-con-withCov-010/test.ipkg create mode 100644 tests/lib/coverage/ty-and-con-withCov-011/PrintCoverage.idr create mode 100644 tests/lib/coverage/ty-and-con-withCov-011/expected create mode 100755 tests/lib/coverage/ty-and-con-withCov-011/run create mode 100644 tests/lib/coverage/ty-and-con-withCov-011/test.ipkg diff --git a/src/Test/DepTyCheck/Gen/Coverage.idr b/src/Test/DepTyCheck/Gen/Coverage.idr index 148d0bdff..f4661d966 100644 --- a/src/Test/DepTyCheck/Gen/Coverage.idr +++ b/src/Test/DepTyCheck/Gen/Coverage.idr @@ -41,10 +41,22 @@ MonadWriter ModelCoverage m => CanManageLabels m where manageLabel l x = tell (MkModelCoverage $ singleton l 1) >> x export -unGenTryAllD : RandomGen g => (seed : g) -> Gen em a -> Stream $ Maybe (ModelCoverage, a) -unGenTryAllD seed gen = do +unGenD : MonadRandom m => MonadError () m => Gen em a -> m (ModelCoverage, a) +unGenD = map swap . runWriterT . unGen {m = WriterT ModelCoverage $ m} + +export %inline +unGenD' : MonadRandom m => Gen em a -> m $ Maybe (ModelCoverage, a) +unGenD' = runMaybeT . unGenD {m = MaybeT m} + +export +unGenTryAllD' : RandomGen g => (seed : g) -> Gen em a -> Stream (g, Maybe (ModelCoverage, a)) +unGenTryAllD' seed gen = do let (seed, sv) = runRandom seed $ runMaybeT $ runWriterT $ unGen {m=WriterT ModelCoverage $ MaybeT Rand} gen - map swap sv :: unGenTryAllD seed gen + (seed, map swap sv) :: unGenTryAllD' seed gen + +export +unGenTryAllD : RandomGen g => (seed : g) -> Gen em a -> Stream $ Maybe (ModelCoverage, a) +unGenTryAllD = map snd .: unGenTryAllD' export unGenTryND : RandomGen g => (n : Nat) -> g -> Gen em a -> LazyList (ModelCoverage, a) diff --git a/tests/lib/coverage/ty-and-con-withCov-010/PrintCoverage.idr b/tests/lib/coverage/ty-and-con-withCov-010/PrintCoverage.idr new file mode 100644 index 000000000..f2086d6f8 --- /dev/null +++ b/tests/lib/coverage/ty-and-con-withCov-010/PrintCoverage.idr @@ -0,0 +1,43 @@ +module PrintCoverage + +import Test.DepTyCheck.Gen +import Test.DepTyCheck.Gen.Coverage + +import Deriving.DepTyCheck.Gen + +import Control.Monad.Random +import System.Random.Pure.StdGen + +%default total + +%language ElabReflection + +export +smallStrs : Fuel -> Gen NonEmpty String +smallStrs _ = elements ["", "a", "bc"] + +data X = X1 | X2 Nat | X3 String + +genX : Fuel -> Gen NonEmpty X +genX fl = oneOf + [ pure X1 + , X3 <$> smallStrs fl + ] + +data Y = Y1 | Y2 X | Y3 X X + +genY : Fuel -> Gen NonEmpty Y +genY fl = withCoverage $ oneOf + [ [| Y1 |] + , [| Y3 (genX fl) (genX fl) |] + ] + +main : IO () +main = do + let ci = initCoverageInfo genY + (Right v) <- runEitherT {e = ()} {m = IO} $ evalRandomT someStdGen $ unGenD $ genY $ limit 5 + | Left err => putStrLn "Impossible!" + let mc = fst v + let ci = registerCoverage mc ci + putStrLn $ show ci + diff --git a/tests/lib/coverage/ty-and-con-withCov-010/expected b/tests/lib/coverage/ty-and-con-withCov-010/expected new file mode 100644 index 000000000..3413cf1ef --- /dev/null +++ b/tests/lib/coverage/ty-and-con-withCov-010/expected @@ -0,0 +1,16 @@ +1/1: Building PrintCoverage (PrintCoverage.idr) + +Prelude.Types.Nat not covered + - S: not covered + - Z: not covered + +PrintCoverage.X not covered + - X1: not covered + - X2: not covered + - X3: not covered + +PrintCoverage.Y covered partially (1 time) + - Y1: not covered + - Y2: not covered + - Y3: covered (1 time) + diff --git a/tests/lib/coverage/ty-and-con-withCov-010/run b/tests/lib/coverage/ty-and-con-withCov-010/run new file mode 100755 index 000000000..9706b3375 --- /dev/null +++ b/tests/lib/coverage/ty-and-con-withCov-010/run @@ -0,0 +1,8 @@ +rm -rf build + +flock "$1" pack -q install-deps test.ipkg && \ +idris2 --no-color --console-width 0 --no-banner --find-ipkg --check PrintCoverage.idr && \ +echo && \ +pack exec PrintCoverage.idr + +rm -rf build diff --git a/tests/lib/coverage/ty-and-con-withCov-010/test.ipkg b/tests/lib/coverage/ty-and-con-withCov-010/test.ipkg new file mode 100644 index 000000000..879278361 --- /dev/null +++ b/tests/lib/coverage/ty-and-con-withCov-010/test.ipkg @@ -0,0 +1,6 @@ +package a-test +executable = a-test + +depends = deptycheck + +main = PrintCoverage diff --git a/tests/lib/coverage/ty-and-con-withCov-011/PrintCoverage.idr b/tests/lib/coverage/ty-and-con-withCov-011/PrintCoverage.idr new file mode 100644 index 000000000..dc7c17521 --- /dev/null +++ b/tests/lib/coverage/ty-and-con-withCov-011/PrintCoverage.idr @@ -0,0 +1,57 @@ +module PrintCoverage + +import Test.DepTyCheck.Gen +import Test.DepTyCheck.Gen.Coverage + +import Deriving.DepTyCheck.Gen + +import Control.Monad.Random +import System.Random.Pure.StdGen + +%default total + +%language ElabReflection + +export +smallStrs : Fuel -> Gen NonEmpty String +smallStrs _ = elements ["", "a", "bc"] + +data X = X1 | X2 Nat | X3 String + +genX : Fuel -> Gen NonEmpty X +genX fl = withCoverage $ oneOf + [ pure X1 + , X3 <$> smallStrs fl + ] + +data Y : Nat -> Type where + Y1 : Y 0 + Y2 : X -> Y 1 + Y3 : X -> X -> Y n + +genY : Fuel -> (n : _) -> Gen NonEmpty $ Y n +genY fl Z = withCoverage $ oneOf + [ [| Y1 |] + , [| Y3 (genX fl) (genX fl) |] + ] +genY fl 1 = withCoverage [| Y2 (genX fl) |] +genY fl n = withCoverage [| Y3 (genX fl) (genX fl) |] + +try : (CoverageGenInfo g) -> (n : Nat) -> IO () +try ci n = do + (Right v) <- runEitherT {e = ()} {m = IO} $ evalRandomT someStdGen $ unGenD $ genY (limit 5) n + | Left err => putStrLn "Impossible!" + let mc = fst v + let ci = registerCoverage mc ci + putStrLn $ show ci + + +main : IO () +main = do + let ci = initCoverageInfo genY + try ci 0 + putStrLn "--------\n" + try ci 1 + putStrLn "--------\n" + try ci 3 + diff --git a/tests/lib/coverage/ty-and-con-withCov-011/expected b/tests/lib/coverage/ty-and-con-withCov-011/expected new file mode 100644 index 000000000..040d63c93 --- /dev/null +++ b/tests/lib/coverage/ty-and-con-withCov-011/expected @@ -0,0 +1,48 @@ +1/1: Building PrintCoverage (PrintCoverage.idr) + +Prelude.Types.Nat not covered + - S: not covered + - Z: not covered + +PrintCoverage.X covered partially (2 times) + - X1: covered (2 times) + - X2: not covered + - X3: not covered + +PrintCoverage.Y covered partially (1 time) + - Y1: not covered + - Y2: not covered + - Y3: covered (1 time) + +-------- + +Prelude.Types.Nat not covered + - S: not covered + - Z: not covered + +PrintCoverage.X covered partially (1 time) + - X1: not covered + - X2: not covered + - X3: covered (1 time) + +PrintCoverage.Y covered partially (1 time) + - Y1: not covered + - Y2: covered (1 time) + - Y3: not covered + +-------- + +Prelude.Types.Nat not covered + - S: not covered + - Z: not covered + +PrintCoverage.X covered partially (2 times) + - X1: covered (1 time) + - X2: not covered + - X3: covered (1 time) + +PrintCoverage.Y covered partially (1 time) + - Y1: not covered + - Y2: not covered + - Y3: covered (1 time) + diff --git a/tests/lib/coverage/ty-and-con-withCov-011/run b/tests/lib/coverage/ty-and-con-withCov-011/run new file mode 100755 index 000000000..9706b3375 --- /dev/null +++ b/tests/lib/coverage/ty-and-con-withCov-011/run @@ -0,0 +1,8 @@ +rm -rf build + +flock "$1" pack -q install-deps test.ipkg && \ +idris2 --no-color --console-width 0 --no-banner --find-ipkg --check PrintCoverage.idr && \ +echo && \ +pack exec PrintCoverage.idr + +rm -rf build diff --git a/tests/lib/coverage/ty-and-con-withCov-011/test.ipkg b/tests/lib/coverage/ty-and-con-withCov-011/test.ipkg new file mode 100644 index 000000000..879278361 --- /dev/null +++ b/tests/lib/coverage/ty-and-con-withCov-011/test.ipkg @@ -0,0 +1,6 @@ +package a-test +executable = a-test + +depends = deptycheck + +main = PrintCoverage From 1b7dd33f1b9834531ce15cd01caa25b7d300a337 Mon Sep 17 00:00:00 2001 From: Daniil Maximov Date: Fri, 16 Aug 2024 18:47:28 +0300 Subject: [PATCH 25/53] [ fix ] Fix typo in 'acquire' word --- .github/workflows/ci-deptycheck.yml | 4 ++-- src/Deriving/DepTyCheck/Gen/Core/Util.idr | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-deptycheck.yml b/.github/workflows/ci-deptycheck.yml index 198ebf008..7d2954c2b 100644 --- a/.github/workflows/ci-deptycheck.yml +++ b/.github/workflows/ci-deptycheck.yml @@ -138,7 +138,7 @@ jobs: ################### get-test-sets: - name: Aquire test sets + name: Acquire test sets needs: - deptycheck-build-lib runs-on: ubuntu-latest @@ -187,7 +187,7 @@ jobs: ################# get-examples: - name: Aquire examples + name: Acquire examples needs: - deptycheck-build-lib runs-on: ubuntu-latest diff --git a/src/Deriving/DepTyCheck/Gen/Core/Util.idr b/src/Deriving/DepTyCheck/Gen/Core/Util.idr index b4272db97..58118ee7a 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/Util.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/Util.idr @@ -85,7 +85,7 @@ analyseDeepConsApp ccdi freeNames = isD where let Just con = lookupCon lhsName | Nothing => Left "name `\{lhsName}` is not a constructor" - -- Aquire type-determination info, if needed + -- Acquire type-determination info, if needed typeDetermInfo <- if ccdi then assert_total {- `ccdi` is `True` here when `False` inside -} $ typeDeterminedArgs con else pure neutral let _ : Vect con.args.length (MaybeConsDetermInfo ccdi) := typeDetermInfo From 2c5f73ca4e7de8a590545d90b43d5437c0d43fa0 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Fri, 16 Aug 2024 23:34:11 +0300 Subject: [PATCH 26/53] [ derive ] Log used order using argument names too --- src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr | 9 +++++++-- src/Deriving/DepTyCheck/Util/Reflection.idr | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index 2dbe763da..8e134f159 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -42,7 +42,12 @@ namespace NonObligatoryExts [LeastEffort] {default False simplificationHack : Bool} -> ConstructorDerivator where consGenExpr sig con givs fuel = do - let niit : NamesInfoInTypes = %search -- I don't why it won't be found without this + -- Prepare local search context + let _ : NamesInfoInTypes = %search -- I don't why it won't be found without this + let _ : ({0 f : _} -> Foldable f => Interpolation $ f _) = WithNames {con} + + -- Log all arguments' position and their names (if they have some) + logPoint {level=15} "least-effort" [sig, con] "- con args: \{List.allFins con.args.length}" ------------------------------------------------------------- -- Prepare intermediate data and functions using this data -- @@ -199,7 +204,7 @@ namespace NonObligatoryExts let allOrders = List.nub $ nub <$> allOrders for_ allOrders $ \order => - logPoint {level=10} "least-effort.order" [sig, con] "- one of used final orders: \{show order}" + logPoint {level=10} "least-effort" [sig, con] "- used final order: \{order}" -------------------------- -- Producing the result -- diff --git a/src/Deriving/DepTyCheck/Util/Reflection.idr b/src/Deriving/DepTyCheck/Util/Reflection.idr index f2329f4a1..374fb89bf 100644 --- a/src/Deriving/DepTyCheck/Util/Reflection.idr +++ b/src/Deriving/DepTyCheck/Util/Reflection.idr @@ -56,6 +56,16 @@ SingleLogPosition Con where let fullName' = unpack fullName maybe fullName (pack . flip drop fullName' . S . finToNat) $ findLastIndex (== '.') fullName' +export +[WithName] {con : Con} -> Interpolation (Fin con.args.length) where + interpolate i = case name $ index' con.args i of + Just (UN n) => "#\{show i} (\{show n})" + _ => "#\{show i}" + +export +[WithNames] {con : Con} -> Foldable f => Interpolation (f $ Fin con.args.length) where + interpolate = ("[" ++) . (++ "]") . joinBy ", " . map (interpolate @{WithName}) . toList + ---------------------------------------------- --- Compiler-based `TTImp` transformations --- ---------------------------------------------- From fe5a08949db283b19cc4455e437e91e22840f7c3 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Thu, 22 Aug 2024 20:13:18 +0300 Subject: [PATCH 27/53] [ refactor ] Move special interpolations to be local implementations --- src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr | 9 ++++++++- src/Deriving/DepTyCheck/Util/Reflection.idr | 10 ---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index 8e134f159..0b0154d8d 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -44,7 +44,6 @@ namespace NonObligatoryExts -- Prepare local search context let _ : NamesInfoInTypes = %search -- I don't why it won't be found without this - let _ : ({0 f : _} -> Foldable f => Interpolation $ f _) = WithNames {con} -- Log all arguments' position and their names (if they have some) logPoint {level=15} "least-effort" [sig, con] "- con args: \{List.allFins con.args.length}" @@ -214,6 +213,14 @@ namespace NonObligatoryExts where + Interpolation (Fin con.args.length) where + interpolate i = case name $ index' con.args i of + Just (UN n) => "#\{show i} (\{show n})" + _ => "#\{show i}" + + Foldable f => Interpolation (f $ Fin con.args.length) where + interpolate = ("[" ++) . (++ "]") . joinBy ", " . map interpolate . toList + -- TODO make this to be a `record` as soon as #2177 is fixed data TypeApp : Type where MkTypeApp : diff --git a/src/Deriving/DepTyCheck/Util/Reflection.idr b/src/Deriving/DepTyCheck/Util/Reflection.idr index 374fb89bf..f2329f4a1 100644 --- a/src/Deriving/DepTyCheck/Util/Reflection.idr +++ b/src/Deriving/DepTyCheck/Util/Reflection.idr @@ -56,16 +56,6 @@ SingleLogPosition Con where let fullName' = unpack fullName maybe fullName (pack . flip drop fullName' . S . finToNat) $ findLastIndex (== '.') fullName' -export -[WithName] {con : Con} -> Interpolation (Fin con.args.length) where - interpolate i = case name $ index' con.args i of - Just (UN n) => "#\{show i} (\{show n})" - _ => "#\{show i}" - -export -[WithNames] {con : Con} -> Foldable f => Interpolation (f $ Fin con.args.length) where - interpolate = ("[" ++) . (++ "]") . joinBy ", " . map (interpolate @{WithName}) . toList - ---------------------------------------------- --- Compiler-based `TTImp` transformations --- ---------------------------------------------- From 7750039ecdf5df34004a4fb06f0d6fb357c4d897 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 28 Aug 2024 13:22:34 +0300 Subject: [PATCH 28/53] [ fix, ux ] Fix error message when type of con's param is not accessible --- src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr | 9 ++++++--- src/Deriving/DepTyCheck/Util/Reflection.idr | 4 ++++ tests/derivation/core/norec part noext 003/expected | 2 +- tests/derivation/core/norec part noext 004/expected | 2 +- tests/derivation/core/norec part noext 005/expected | 2 +- tests/derivation/core/norec part w_ext 001/expected | 2 +- tests/derivation/core/norec part w_ext 002/expected | 2 +- tests/derivation/core/norec part w_ext 003/expected | 2 +- tests/derivation/core/typealias con 003-neg/expected | 2 +- 9 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index 0b0154d8d..9a2b712ea 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -64,9 +64,12 @@ namespace NonObligatoryExts analyseTypeApp expr = do let (lhs, args) = unAppAny expr ty <- case lhs of - IVar _ lhsName => do let e = failAt (getFC lhs) $ "Only applications to non-polymorphic type constructors are supported" - ++ " at the moment, we found `\{lhsName}`" - maybe e pure $ lookupType lhsName -- TODO to support `lhsName` to be a type parameter of type `Type` + IVar _ lhsName => do let Nothing = lookupType lhsName -- TODO to support `lhsName` to be a type parameter of type `Type` + | Just found => pure found + -- we didn't found, failing, there are at least two reasons + failAt (getFC lhs) $ if isNamespaced lhsName + then "Data type `\{lhsName}` is unavailable at the site of derivation (forgotten import?)" + else "Usupported applications to a non-concrete type `\{lhsName}`" IPrimVal _ (PrT t) => pure $ typeInfoForPrimType t IType _ => pure typeInfoForTypeOfTypes lhs@(IPi {}) => failAt (getFC lhs) "Fields with function types are not supported in constructors" diff --git a/src/Deriving/DepTyCheck/Util/Reflection.idr b/src/Deriving/DepTyCheck/Util/Reflection.idr index f2329f4a1..30fbb9eb0 100644 --- a/src/Deriving/DepTyCheck/Util/Reflection.idr +++ b/src/Deriving/DepTyCheck/Util/Reflection.idr @@ -261,6 +261,10 @@ allNameSuffixes nm = do [] => n ns => NS (MkNS $ reverse ns) n +export +isNamespaced : Name -> Bool +isNamespaced = not . null . fst . unNS + --------------------------------------------------- --- Working around primitive and special values --- --------------------------------------------------- diff --git a/tests/derivation/core/norec part noext 003/expected b/tests/derivation/core/norec part noext 003/expected index efb21c56e..71c7da0f9 100644 --- a/tests/derivation/core/norec part noext 003/expected +++ b/tests/derivation/core/norec part noext 003/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Only applications to non-polymorphic type constructors are supported at the moment, we found `ty` +Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `ty` DerivedGen:16:14--16:23 12 | XShow : Show X diff --git a/tests/derivation/core/norec part noext 004/expected b/tests/derivation/core/norec part noext 004/expected index 8f35a0ac4..bb472c03b 100644 --- a/tests/derivation/core/norec part noext 004/expected +++ b/tests/derivation/core/norec part noext 004/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Only applications to non-polymorphic type constructors are supported at the moment, we found `a` +Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` DerivedGen:17:14--17:23 13 | XShow = %runElab derive diff --git a/tests/derivation/core/norec part noext 005/expected b/tests/derivation/core/norec part noext 005/expected index 8f35a0ac4..bb472c03b 100644 --- a/tests/derivation/core/norec part noext 005/expected +++ b/tests/derivation/core/norec part noext 005/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Only applications to non-polymorphic type constructors are supported at the moment, we found `a` +Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` DerivedGen:17:14--17:23 13 | XShow = %runElab derive diff --git a/tests/derivation/core/norec part w_ext 001/expected b/tests/derivation/core/norec part w_ext 001/expected index 72ccc77a2..299b55a66 100644 --- a/tests/derivation/core/norec part w_ext 001/expected +++ b/tests/derivation/core/norec part w_ext 001/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Only applications to non-polymorphic type constructors are supported at the moment, we found `ty` +Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `ty` DerivedGen:17:14--17:23 13 | XShow = %runElab derive diff --git a/tests/derivation/core/norec part w_ext 002/expected b/tests/derivation/core/norec part w_ext 002/expected index 8f7835b38..ce57cd5c7 100644 --- a/tests/derivation/core/norec part w_ext 002/expected +++ b/tests/derivation/core/norec part w_ext 002/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Only applications to non-polymorphic type constructors are supported at the moment, we found `a` +Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` DerivedGen:17:14--17:23 13 | XShow = %runElab derive diff --git a/tests/derivation/core/norec part w_ext 003/expected b/tests/derivation/core/norec part w_ext 003/expected index 8f7835b38..ce57cd5c7 100644 --- a/tests/derivation/core/norec part w_ext 003/expected +++ b/tests/derivation/core/norec part w_ext 003/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Only applications to non-polymorphic type constructors are supported at the moment, we found `a` +Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` DerivedGen:17:14--17:23 13 | XShow = %runElab derive diff --git a/tests/derivation/core/typealias con 003-neg/expected b/tests/derivation/core/typealias con 003-neg/expected index 98eba5a17..643a680c3 100644 --- a/tests/derivation/core/typealias con 003-neg/expected +++ b/tests/derivation/core/typealias con 003-neg/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Only applications to non-polymorphic type constructors are supported at the moment, we found `DerivedGen.NonReducibleUseTypeAlias` +Error: While processing right hand side of checkedGen. Error during reflection: Data type `DerivedGen.NonReducibleUseTypeAlias` is unavailable at the site of derivation (forgotten import?) DerivedGen:16:22--16:46 12 | From 01e4512ab6896fd289ae7c56e10fe21e3d5b2393 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Sun, 25 Aug 2024 11:41:02 +0300 Subject: [PATCH 29/53] [ example ] Implement CLI options in the pil-fun example --- examples/pil-fun/pil-fun.ipkg | 1 + .../pil-fun/src/Language/PilFun/Pretty.idr | 8 + .../src/Language/PilFun/Pretty/Scala3.idr | 6 +- examples/pil-fun/src/Runner.idr | 140 ++++++++++++++++-- 4 files changed, 137 insertions(+), 18 deletions(-) diff --git a/examples/pil-fun/pil-fun.ipkg b/examples/pil-fun/pil-fun.ipkg index 8f2119842..29134011d 100644 --- a/examples/pil-fun/pil-fun.ipkg +++ b/examples/pil-fun/pil-fun.ipkg @@ -10,6 +10,7 @@ builddir = ".build" prebuild = "sh .derive-in-parallel" depends = deptycheck + , getopts , prettier executable = "pil-fun" diff --git a/examples/pil-fun/src/Language/PilFun/Pretty.idr b/examples/pil-fun/src/Language/PilFun/Pretty.idr index d581ae336..0d1d280b8 100644 --- a/examples/pil-fun/src/Language/PilFun/Pretty.idr +++ b/examples/pil-fun/src/Language/PilFun/Pretty.idr @@ -102,3 +102,11 @@ getExprs (sx: (indeed : Bool) -> Doc opts -> Doc opts -> Doc opts wrapBrIf False pre x = pre `vappend` indent' 2 x wrapBrIf True pre x = ifMultiline (pre <++> "{" <++> x <++> "}") (vsep [pre <++> "{", indent' 2 x, "}"]) + +public export +0 PP : Type +PP = {funs : _} -> {vars : _} -> {retTy : _} -> {opts : _} -> + (names : UniqNames funs vars) => + (newNames : Gen0 String) => + Fuel -> + Stmts funs vars retTy -> Gen0 $ Doc opts diff --git a/examples/pil-fun/src/Language/PilFun/Pretty/Scala3.idr b/examples/pil-fun/src/Language/PilFun/Pretty/Scala3.idr index 567a42d0d..b61fec4dc 100644 --- a/examples/pil-fun/src/Language/PilFun/Pretty/Scala3.idr +++ b/examples/pil-fun/src/Language/PilFun/Pretty/Scala3.idr @@ -170,9 +170,5 @@ printStmts fl tl $ Ret x = wrapMain {funs} {vars} fl tl Nothing $ printExpr Open printStmts fl tl $ Nop = wrapMain {funs} {vars} fl tl Nothing $ pure empty export -printScala3 : {funs : _} -> {vars : _} -> {retTy : _} -> {opts : _} -> - (names : UniqNames funs vars) => - (newNames : Gen0 String) => - Fuel -> - Stmts funs vars retTy -> Gen0 $ Doc opts +printScala3 : PP printScala3 fl = printStmts {names} {newNames} fl True diff --git a/examples/pil-fun/src/Runner.idr b/examples/pil-fun/src/Runner.idr index 7dc5aa9f6..4e8c1412b 100644 --- a/examples/pil-fun/src/Runner.idr +++ b/examples/pil-fun/src/Runner.idr @@ -2,6 +2,9 @@ module Runner import Data.Fuel import Data.List.Lazy +import Data.List1 +import Data.SortedMap +import Data.String import Language.PilFun.Derived import Language.PilFun.Pretty.Derived @@ -12,12 +15,110 @@ import Test.DepTyCheck.Gen import Text.PrettyPrint.Bernardy +import System +import System.GetOpts import System.Random.Pure.StdGen %default total -stdFuns : NamedCtxt -stdFuns = do +------------------- +--- CLI options --- +------------------- + +record Config where + constructor MkConfig + usedSeed : IO StdGen + layoutOpts : LayoutOpts + testsCnt : Nat + modelFuel : Fuel + ppFuel : Fuel + +defaultConfig : Config +defaultConfig = MkConfig + { usedSeed = initSeed + , layoutOpts = Opts 152 + , testsCnt = 10 + , modelFuel = limit 8 + , ppFuel = limit 1000000 + } + +parseSeed : String -> Either String $ Config -> Config +parseSeed str = do + let n1:::n2::[] = trim <$> split (== ',') str + | _ => Left "we expect two numbers divided by a comma" + let Just n1 = parsePositive n1 + | Nothing => Left "expected a positive number at the first component, given `\{n1}`" + let Just n2 = parsePositive {a=Bits64} n2 + | Nothing => Left "expected a positive number at the second component, given `\{n2}`" + let Yes prf = decSo $ testBit n2 0 + | No _ => Left "second component must be odd" + Right {usedSeed := pure $ rawStdGen n1 n2} + +parsePPWidth : String -> Either String $ Config -> Config +parsePPWidth str = case parsePositive str of + Just n => Right {layoutOpts := Opts n} + Nothing => Left "can't parse max width for the pretty-printer" + +parseTestsCount : String -> Either String $ Config -> Config +parseTestsCount str = case parsePositive str of + Just n => Right {testsCnt := n} + Nothing => Left "can't parse given count of tests" + +parseModelFuel : String -> Either String $ Config -> Config +parseModelFuel str = case parsePositive str of + Just n => Right {modelFuel := limit n} + Nothing => Left "can't parse given model fuel" + +parsePPFuel : String -> Either String $ Config -> Config +parsePPFuel str = case parsePositive str of + Just n => Right {ppFuel := limit n} + Nothing => Left "can't parse given pretty-printer fuel" + +cliOpts : List $ OptDescr $ Config -> Config +cliOpts = + [ MkOpt [] ["seed"] + (ReqArg' parseSeed ",") + "Sets particular random seed to start with." + , MkOpt ['w'] ["pp-width"] + (ReqArg' parsePPWidth "") + "Sets the max length for the pretty-printer." + , MkOpt ['n'] ["tests-count"] + (ReqArg' parseTestsCount "") + "Sets the count of tests to generate." + , MkOpt [] ["model-fuel"] + (ReqArg' parseModelFuel "") + "Sets how much fuel there is for generation of the model." + , MkOpt [] ["pp-fuel"] + (ReqArg' parsePPFuel "") + "Sets how much fuel there is for pretty-printing." + ] + +--------------- +--- Running --- +--------------- + +namesGen : Gen0 String +namesGen = pack <$> listOf {length = choose (1,10)} (choose ('a', 'z')) + +run : Config -> + NamedCtxt -> + (pp : PP) -> + IO () +run conf ctxt pp = do + seed <- conf.usedSeed + let vals = unGenTryN conf.testsCnt seed $ + genStmts conf.modelFuel ctxt.functions ctxt.variables Nothing >>= + pp @{ctxt.fvNames} @{namesGen} conf.ppFuel + Lazy.for_ vals $ \val => do + putStrLn "-------------------\n" + putStr $ render conf.layoutOpts val + +----------------------- +--- Language config --- +----------------------- + +scala3StdFuns : NamedCtxt +scala3StdFuns = do AddFun True "+" $ [< Int', Int'] ==> Just Int' AddFun True "<" $ [< Int', Int'] ==> Just Bool' AddFun True "<=" $ [< Int', Int'] ==> Just Bool' @@ -28,19 +129,32 @@ stdFuns = do AddFun False "Console.println" $ [< Int'] ==> Nothing Enough -prettyOpts : LayoutOpts -prettyOpts = Opts 152 +supportedLanguages : SortedMap String (NamedCtxt, PP) +supportedLanguages = fromList + [ ("scala3", scala3StdFuns, printScala3) + ] -namesGen : Gen0 String -namesGen = pack <$> listOf {length = choose (1,10)} (choose ('a', 'z')) +--------------- +--- Startup --- +--------------- export main : IO () main = do - let modelFuel = limit 8 - let ppFuel = limit 1000000 - let vals = unGenTryN 10 someStdGen $ - genStmts modelFuel stdFuns.functions stdFuns.variables Nothing >>= printScala3 @{stdFuns.fvNames} @{namesGen} ppFuel - Lazy.for_ vals $ \val => do - putStrLn "///////////////////\n" - putStr $ render prettyOpts val + args <- getArgs + let usage : Lazy String := usageInfo "Usage: \{fromMaybe "pil-fun" $ head' args} [options] " cliOpts + let langs : Lazy String := joinBy ", " $ SortedSet.toList $ keySet supportedLanguages + let MkResult options nonOptions [] [] = getOpt Permute cliOpts $ drop 1 args + | MkResult {unrecognized=unrecOpts@(_::_), _} => if "help" `elem` unrecOpts + then putStrLn usage + else die "unrecodnised options \{show unrecOpts}\n\{usage}" + | MkResult {errors=es@(_::_), _} => die "arguments parse errors \{show es}\n\{usage}" + let [lang] = nonOptions + | [] => die "no language is given, supported languages: \{langs}\n\{usage}" + | many => die "too many languages are given\n\{usage}" + let Just (ctxt, pp) = lookup lang supportedLanguages + | Nothing => die "unknown language \{lang}, supported languages \{langs}\n\{usage}" + + let config = foldl (flip apply) defaultConfig options + + run config ctxt pp From 1f32bb7ccef645a7616510bee71141e0a6c87d2d Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Thu, 22 Aug 2024 20:14:11 +0300 Subject: [PATCH 30/53] [ test, perf ] Add couple of kinda-performance tests --- examples/pil-fun/tests/gens/scala3/expected | 167 ++++++++++++++++++ examples/pil-fun/tests/gens/scala3/run | 6 + .../core/big con 001/DerivedGen.idr | 28 +++ .../core/big con 001/RunDerivedGen.idr | 1 + tests/derivation/core/big con 001/derive.ipkg | 1 + tests/derivation/core/big con 001/expected | 24 +++ tests/derivation/core/big con 001/run | 1 + .../core/big con 002/DerivedGen.idr | 32 ++++ .../core/big con 002/RunDerivedGen.idr | 1 + tests/derivation/core/big con 002/derive.ipkg | 1 + tests/derivation/core/big con 002/expected | 24 +++ tests/derivation/core/big con 002/run | 1 + 12 files changed, 287 insertions(+) create mode 100644 examples/pil-fun/tests/gens/scala3/expected create mode 100755 examples/pil-fun/tests/gens/scala3/run create mode 100644 tests/derivation/core/big con 001/DerivedGen.idr create mode 120000 tests/derivation/core/big con 001/RunDerivedGen.idr create mode 120000 tests/derivation/core/big con 001/derive.ipkg create mode 100644 tests/derivation/core/big con 001/expected create mode 120000 tests/derivation/core/big con 001/run create mode 100644 tests/derivation/core/big con 002/DerivedGen.idr create mode 120000 tests/derivation/core/big con 002/RunDerivedGen.idr create mode 120000 tests/derivation/core/big con 002/derive.ipkg create mode 100644 tests/derivation/core/big con 002/expected create mode 120000 tests/derivation/core/big con 002/run diff --git a/examples/pil-fun/tests/gens/scala3/expected b/examples/pil-fun/tests/gens/scala3/expected new file mode 100644 index 000000000..7e594f27c --- /dev/null +++ b/examples/pil-fun/tests/gens/scala3/expected @@ -0,0 +1,167 @@ +------------------- + + +@main +def tvlt(): Unit = { + if (5.+(0)) < (2.+(2)) then { + var lybokfpr = (4.+(5)).+(4.+(5)) + lybokfpr = lybokfpr + lybokfpr = 4.+(lybokfpr + 1) + lybokfpr = lybokfpr + var uo: Boolean = (lybokfpr + lybokfpr).==(3 + 0) + + } else { + val qemiujv = (jjh: Int, gxdtmng: Int, zdkvk: Int, n: Int, zadrbgu: Boolean) => { + if (jjh + n) == zdkvk then + extension (cuohsl: Int) + def zmuqm(lnevjvz: Boolean, ssl: Int, ltiv: Int): Int = { + if (true.&&(true)).||(zadrbgu) then + if lnevjvz.&&(false && (!(zadrbgu))) then + {} + + else + if (ltiv.==(zdkvk)) || (ssl.<(4)) then + {} + else + {} + + (ssl.+(5)) + (n.+(6)) + } : Int + + else + extension (r: Int) + def mrew(nbasrya: Int, jqaak: Boolean, jpinulqg: Boolean, kazmm: Boolean) = + {} + def qsokaogqmr() = { } + + val mbn = jjh.+(1) + val ltpicdael: Int = 6 + var woyvgazf: Int = (4 + 0).+(6 + n) + + } : Unit + if (3 == 1) && (0.==(4)) then + if (2 + 1).==(1 + 2) then + extension (r: Int) def naqxvjgxmb() = { 4 <= (r + 1) } + qemiujv(1, 6, 5.+(4), 4.+(0), (1.naqxvjgxmb()).||(false.||(true))) + + else + if false then + {} + else + if true.||(false && false) then { + + } + + var wf: Boolean = (2.+(2)).<(2 + 2) + + extension (xmfo: Boolean) + def qnog(jg: Boolean, tzmk: Int, ogkzgnyugn: Int, bzyegcnug: Int) = { + qemiujv(3, 0, 0, tzmk.+(6), 5 < (tzmk + 6)) + + } + + else + var yqavod = false && true + qemiujv(6, 0, 0.+(4), 4.+(1), yqavod || (yqavod && yqavod)) + val sxfdzhrrh = (zbdd: Boolean, acoykh: Boolean, cbde: Boolean, dngc: Boolean, bqf: Boolean, drzqpmieuq: Boolean) => + {} + + if false || (2 <= 4) then + val obaztbbz: Boolean = (1.+(2)).==(2 + 6) + + else + val ji: Boolean = (2 + 4).==(0.+(1)) + val xsjzzhjk = (rbjd: Boolean, msoanazo: Int, dbbygddcsy: Boolean, j: Int, ots: Boolean, axwjjdtw: Boolean) => { } + + + } + val jrqa: Boolean = !(false) + extension (yannoshffy: Int) + def kwc(qnbouij: Int, mtsapbnquq: Int): Unit = + var k: Boolean = true + k = !(!(!(jrqa))) + + val llqkzrga = (deszncso: Boolean, dtwbodm: Boolean, wvqqvju: Boolean) => { + var x = (wvqqvju.&&(true)).||(4 == 5) + x = true + (6.+(3)).+(0.+(1)) + } + +} +------------------- + +val kwyflaeizb = (0.+(5)).+(3.+(5)) +val wfjunn = kwyflaeizb.+(kwyflaeizb + kwyflaeizb) +var lisrdrrgc: Int = 4.+(1) +val bh = (agieo: Boolean, qazggfrct: Int) => + if (0.<=(3)) && (!(false)) then { + var fwiklya = lisrdrrgc + + } else { + extension (psmyvssee: Int) def kmcysd(mc: Boolean, m: Int, kpwfobj: Int, g: Boolean, sk: Boolean) = { } + + } + lisrdrrgc = (kwyflaeizb + qazggfrct).+(kwyflaeizb.+(5)) + 6 +val qrnqnfy = (yovn: Boolean, t: Boolean) => { + if (true.||(yovn)) || yovn then { + + } + yovn +} + +@main +def chojxe(): Unit = { + if 1 < (kwyflaeizb.+(5)) then + {} + else + {} + +} +------------------- + +extension (xirzqm: Boolean) + def efqu(): Unit = + val tmxsbu = (5 == 6) && (!(false)) + var xnzeyxyo: Boolean = 4 == (3 + 4) + extension (kg: Boolean) + def doxdnly() = { + if (1.+(5)).<=(5 + 4) then { + xnzeyxyo = true + + } + if true then + {} + else + {} + + } + var drjp: Boolean = (0 == 0).||(xirzqm && false) + if tmxsbu && (tmxsbu && false) then { + + } + +var cstczqacp = (0 + 3) == (5 + 5) + +@main +def japky(): Unit = { + if cstczqacp then { + (4 < (0.+(1))).efqu() + extension (faco: Boolean) + def f(vunluob: Int, xgriaerel: Boolean, rhn: Boolean, ffmlvduuc: Boolean, l: Boolean): Unit = { + (5.==(vunluob)).efqu() + + } : Unit + val tkhyrdnc = () => { (0.+(0)).==(3) } : Boolean + + } else { + var gfknyi: Int = (1.+(3)) + (5.+(6)) + var quusqeb = (4 + 4) + (gfknyi.+(2)) + cstczqacp.efqu() + + } + var cyopq: Int = (0 + 2) + (3 + 2) + cstczqacp = cstczqacp && (true.&&(cstczqacp)) + val ycchap: Boolean = false + +} diff --git a/examples/pil-fun/tests/gens/scala3/run b/examples/pil-fun/tests/gens/scala3/run new file mode 100755 index 000000000..7307aaedb --- /dev/null +++ b/examples/pil-fun/tests/gens/scala3/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps pil-fun && \ +pack run pil-fun scala3 --seed 0,3 --tests 3 --model-fuel 6 + +rm -rf build diff --git a/tests/derivation/core/big con 001/DerivedGen.idr b/tests/derivation/core/big con 001/DerivedGen.idr new file mode 100644 index 000000000..da85e783f --- /dev/null +++ b/tests/derivation/core/big con 001/DerivedGen.idr @@ -0,0 +1,28 @@ +module DerivedGen + +import RunDerivedGen + +import Deriving.Show + +%default total + +%language ElabReflection + +record X where + constructor MkX + field1 : Nat + field2 : Nat + field3 : Nat + field4 : Nat + field5 : Nat + field6 : Nat + field7 : Nat + field8 : Nat + +%hint ShowX : Show X; ShowX = %runElab derive + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen + +main : IO () +main = runGs [ G checkedGen ] diff --git a/tests/derivation/core/big con 001/RunDerivedGen.idr b/tests/derivation/core/big con 001/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/big con 001/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/big con 001/derive.ipkg b/tests/derivation/core/big con 001/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/big con 001/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/big con 001/expected b/tests/derivation/core/big con 001/expected new file mode 100644 index 000000000..699cbef9a --- /dev/null +++ b/tests/derivation/core/big con 001/expected @@ -0,0 +1,24 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +MkX 16 4 17 10 10 17 5 4 +----- +MkX 12 11 8 15 4 14 7 4 +----- +MkX 10 1 15 20 0 17 13 17 +----- +MkX 17 12 2 18 13 10 14 16 +----- +MkX 16 11 1 3 3 10 12 17 +----- +MkX 19 7 3 16 6 12 18 2 +----- +MkX 8 1 18 15 1 7 0 5 +----- +MkX 15 19 3 19 9 6 4 0 +----- +MkX 3 13 19 5 20 3 1 13 +----- +MkX 9 5 0 7 4 7 6 16 diff --git a/tests/derivation/core/big con 001/run b/tests/derivation/core/big con 001/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/big con 001/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/core/big con 002/DerivedGen.idr b/tests/derivation/core/big con 002/DerivedGen.idr new file mode 100644 index 000000000..5db00aa16 --- /dev/null +++ b/tests/derivation/core/big con 002/DerivedGen.idr @@ -0,0 +1,32 @@ +module DerivedGen + +import RunDerivedGen + +import Deriving.Show + +%default total + +%language ElabReflection + +record X where + constructor MkX + field0 : Nat + field1 : Nat + field2 : Nat + field3 : Nat + field4 : Nat + field5 : Nat + field6 : Nat + field7 : Nat + field8 : Nat + field9 : Nat + field10 : Nat + field11 : Nat + +%hint ShowX : Show X; ShowX = %runElab derive + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen + +main : IO () +main = runGs [ G checkedGen ] diff --git a/tests/derivation/core/big con 002/RunDerivedGen.idr b/tests/derivation/core/big con 002/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/big con 002/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/big con 002/derive.ipkg b/tests/derivation/core/big con 002/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/big con 002/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/big con 002/expected b/tests/derivation/core/big con 002/expected new file mode 100644 index 000000000..7cb77e0d7 --- /dev/null +++ b/tests/derivation/core/big con 002/expected @@ -0,0 +1,24 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +MkX 16 4 17 10 10 17 5 4 12 11 8 15 +----- +MkX 4 14 7 4 10 1 15 20 0 17 13 17 +----- +MkX 17 12 2 18 13 10 14 16 16 11 1 3 +----- +MkX 3 10 12 17 19 7 3 16 6 12 18 2 +----- +MkX 8 1 18 15 1 7 0 5 15 19 3 19 +----- +MkX 9 6 4 0 3 13 19 5 20 3 1 13 +----- +MkX 9 5 0 7 4 7 6 16 3 6 4 5 +----- +MkX 10 11 2 11 12 13 19 15 5 7 10 18 +----- +MkX 2 14 9 7 20 13 3 10 17 7 6 20 +----- +MkX 19 13 5 1 20 12 19 17 2 12 20 14 diff --git a/tests/derivation/core/big con 002/run b/tests/derivation/core/big con 002/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/big con 002/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 36792e7d07bccf08d418d86ec517a6e223469b18 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 28 Aug 2024 16:04:48 +0300 Subject: [PATCH 31/53] [ test ] Add some simpler tests with implicit args of derived types --- .../norec t-pi->.. noext 005/DerivedGen.idr | 34 +++++++++++++++ .../RunDerivedGen.idr | 1 + .../core/norec t-pi->.. noext 005/derive.ipkg | 1 + .../core/norec t-pi->.. noext 005/expected | 12 ++++++ .../core/norec t-pi->.. noext 005/run | 1 + .../norec t-pi->.. w_ext 003/DerivedGen.idr | 41 +++++++++++++++++++ .../RunDerivedGen.idr | 1 + .../core/norec t-pi->.. w_ext 003/derive.ipkg | 1 + .../core/norec t-pi->.. w_ext 003/expected | 12 ++++++ .../core/norec t-pi->.. w_ext 003/run | 1 + 10 files changed, 105 insertions(+) create mode 100644 tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr create mode 120000 tests/derivation/core/norec t-pi->.. noext 005/RunDerivedGen.idr create mode 120000 tests/derivation/core/norec t-pi->.. noext 005/derive.ipkg create mode 100644 tests/derivation/core/norec t-pi->.. noext 005/expected create mode 120000 tests/derivation/core/norec t-pi->.. noext 005/run create mode 100644 tests/derivation/core/norec t-pi->.. w_ext 003/DerivedGen.idr create mode 120000 tests/derivation/core/norec t-pi->.. w_ext 003/RunDerivedGen.idr create mode 120000 tests/derivation/core/norec t-pi->.. w_ext 003/derive.ipkg create mode 100644 tests/derivation/core/norec t-pi->.. w_ext 003/expected create mode 120000 tests/derivation/core/norec t-pi->.. w_ext 003/run diff --git a/tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr b/tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr new file mode 100644 index 000000000..284af74cb --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr @@ -0,0 +1,34 @@ +module DerivedGen + +import Data.Fin + +import Deriving.Show + +import RunDerivedGen + +%default total + +%language ElabReflection + +data FinEq : Fin n -> Fin n -> Type where + Here : FinEq FZ FZ + These : FinEq n m -> FinEq (FS n) (FS m) + +data X : (n : Nat) -> Fin n -> Fin n -> Type where + MkX : (i1, i2 : Fin n) -> (i1 `FinEq` i2) -> X n i1 i2 + +%hint ShowFinEq : {0 a, b : Fin n} -> Show (FinEq a b); ShowFinEq = %runElab derive + +Show (X n i1 i2) where + show $ MkX i1 i2 prf = "MkX \{show i1} \{show i2} \{show prf}" + +checkedGen : Fuel -> (n : Nat) -> (i1 : Fin n) -> (i2 : Fin n) -> Gen MaybeEmpty (X n i1 i2) +checkedGen = deriveGen + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl 3 0 1 + , G $ \fl => checkedGen fl 3 1 1 + , G $ \fl => checkedGen fl 3 2 1 + , G $ \fl => checkedGen fl 3 2 2 + ] diff --git a/tests/derivation/core/norec t-pi->.. noext 005/RunDerivedGen.idr b/tests/derivation/core/norec t-pi->.. noext 005/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. noext 005/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/norec t-pi->.. noext 005/derive.ipkg b/tests/derivation/core/norec t-pi->.. noext 005/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. noext 005/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/norec t-pi->.. noext 005/expected b/tests/derivation/core/norec t-pi->.. noext 005/expected new file mode 100644 index 000000000..0bbb77a96 --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. noext 005/expected @@ -0,0 +1,12 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Error: While processing right hand side of checkedGen. Error during reflection: Named implicit applications (like to `DerivedGen.FinEq`) are not supported yet + +DerivedGen:14:11--14:22 + 10 | + 11 | %language ElabReflection + 12 | + 13 | data FinEq : Fin n -> Fin n -> Type where + 14 | Here : FinEq FZ FZ + ^^^^^^^^^^^ + diff --git a/tests/derivation/core/norec t-pi->.. noext 005/run b/tests/derivation/core/norec t-pi->.. noext 005/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. noext 005/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/DerivedGen.idr b/tests/derivation/core/norec t-pi->.. w_ext 003/DerivedGen.idr new file mode 100644 index 000000000..292c17f63 --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. w_ext 003/DerivedGen.idr @@ -0,0 +1,41 @@ +module DerivedGen + +import Data.Fin + +import Deriving.Show + +import RunDerivedGen + +%default total + +%language ElabReflection + +data FinEq : Fin n -> Fin n -> Type where + Here : FinEq FZ FZ + These : FinEq n m -> FinEq (FS n) (FS m) + +data X : (n : Nat) -> Fin n -> Fin n -> Type where + MkX : (i1, i2 : Fin n) -> (i1 `FinEq` i2) -> X n i1 i2 + +%hint ShowFinEq : {0 a, b : Fin n} -> Show (FinEq a b); ShowFinEq = %runElab derive + +Show (X n i1 i2) where + show $ MkX i1 i2 prf = "MkX \{show i1} \{show i2} \{show prf}" + +checkedGen : Fuel -> (Fuel -> {n : Nat} -> (i1, i2 : Fin n) -> Gen MaybeEmpty $ FinEq i1 i2) => + (n : Nat) -> (i1 : Fin n) -> (i2 : Fin n) -> Gen MaybeEmpty (X n i1 i2) +checkedGen = deriveGen + +genFinEq : Fuel -> {n : Nat} -> (i1, i2 : Fin n) -> Gen MaybeEmpty $ FinEq i1 i2 +genFinEq _ FZ FZ = pure Here +genFinEq fl (FS y) (FS z) = These <$> genFinEq fl y z +genFinEq _ FZ (FS _) = empty +genFinEq _ (FS _) FZ = empty + +main : IO () +main = runGs + [ G $ \fl => checkedGen @{genFinEq} fl 3 0 1 + , G $ \fl => checkedGen @{genFinEq} fl 3 1 1 + , G $ \fl => checkedGen @{genFinEq} fl 3 2 1 + , G $ \fl => checkedGen @{genFinEq} fl 3 2 2 + ] diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/RunDerivedGen.idr b/tests/derivation/core/norec t-pi->.. w_ext 003/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. w_ext 003/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/derive.ipkg b/tests/derivation/core/norec t-pi->.. w_ext 003/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. w_ext 003/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/expected b/tests/derivation/core/norec t-pi->.. w_ext 003/expected new file mode 100644 index 000000000..37b409bfc --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. w_ext 003/expected @@ -0,0 +1,12 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Error: While processing right hand side of checkedGen. Error during reflection: Target types with implicit type parameters are not supported yet + +DerivedGen:25:81--25:92 + 21 | + 22 | Show (X n i1 i2) where + 23 | show $ MkX i1 i2 prf = "MkX \{show i1} \{show i2} \{show prf}" + 24 | + 25 | checkedGen : Fuel -> (Fuel -> {n : Nat} -> (i1, i2 : Fin n) -> Gen MaybeEmpty $ FinEq i1 i2) => + ^^^^^^^^^^^ + diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/run b/tests/derivation/core/norec t-pi->.. w_ext 003/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/norec t-pi->.. w_ext 003/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 3568653d6f70172d566c0d851f8512999b2ca664 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Thu, 29 Aug 2024 11:45:59 +0300 Subject: [PATCH 32/53] [ upstream ] Work around `IHole`s in type signatures --- src/Language/Reflection/Compat.idr | 9 +- .../regression/fin-inc/AlternativeCore.idr | 1 + .../print/regression/fin-inc/DerivedGen.idr | 15 + .../regression/fin-inc/PrintDerivation.idr | 1 + .../regression/fin-inc/RunDerivedGen.idr | 1 + .../print/regression/fin-inc/derive.ipkg | 1 + .../print/regression/fin-inc/expected | 297 ++++++++++++++++++ .../least-effort/print/regression/fin-inc/run | 1 + .../run/regression/fin-inc/DerivedGen.idr | 21 ++ .../run/regression/fin-inc/RunDerivedGen.idr | 1 + .../run/regression/fin-inc/derive.ipkg | 1 + .../run/regression/fin-inc/expected | 24 ++ .../least-effort/run/regression/fin-inc/run | 1 + 13 files changed, 372 insertions(+), 2 deletions(-) create mode 120000 tests/derivation/least-effort/print/regression/fin-inc/AlternativeCore.idr create mode 100644 tests/derivation/least-effort/print/regression/fin-inc/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/fin-inc/PrintDerivation.idr create mode 120000 tests/derivation/least-effort/print/regression/fin-inc/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/fin-inc/derive.ipkg create mode 100644 tests/derivation/least-effort/print/regression/fin-inc/expected create mode 120000 tests/derivation/least-effort/print/regression/fin-inc/run create mode 100644 tests/derivation/least-effort/run/regression/fin-inc/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/fin-inc/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/fin-inc/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/fin-inc/expected create mode 120000 tests/derivation/least-effort/run/regression/fin-inc/run diff --git a/src/Language/Reflection/Compat.idr b/src/Language/Reflection/Compat.idr index e61b339e4..13aec7428 100644 --- a/src/Language/Reflection/Compat.idr +++ b/src/Language/Reflection/Compat.idr @@ -24,6 +24,11 @@ public export argName : Arg -> Name argName = stname . (.name) +cleanupNamedHoles : TTImp -> TTImp +cleanupNamedHoles = mapTTImp $ \case + IHole {} => implicitFalse + e => e + -------------------------------------------------------------------------------- -- General Types -------------------------------------------------------------------------------- @@ -40,7 +45,7 @@ record Con where export getCon : Elaboration m => Name -> m Con getCon n = do (n', tt) <- lookupName n - let (args, tpe) = unPi tt + let (args, tpe) = unPi $ cleanupNamedHoles tt pure $ MkCon n' args tpe ||| Information about a data type @@ -64,7 +69,7 @@ export getInfo' : Elaboration m => Name -> m TypeInfo getInfo' n = do (n',tt) <- lookupName n - let (args,IType _) = unPi tt + let (args,IType _) = unPi $ cleanupNamedHoles tt | (_,_) => fail "Type declaration does not end in IType" conNames <- getCons n' cons <- traverse getCon conNames diff --git a/tests/derivation/least-effort/print/regression/fin-inc/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/fin-inc/AlternativeCore.idr new file mode 120000 index 000000000..6da8d83f9 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/fin-inc/AlternativeCore.idr @@ -0,0 +1 @@ +../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/fin-inc/DerivedGen.idr b/tests/derivation/least-effort/print/regression/fin-inc/DerivedGen.idr new file mode 100644 index 000000000..a06aa8d8c --- /dev/null +++ b/tests/derivation/least-effort/print/regression/fin-inc/DerivedGen.idr @@ -0,0 +1,15 @@ +module DerivedGen + +import AlternativeCore +import PrintDerivation + +%default total + +record FinInc n where + constructor MkFinInc + val : Nat + prf : LTE val n + +%language ElabReflection + +%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** FinInc n) diff --git a/tests/derivation/least-effort/print/regression/fin-inc/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/fin-inc/PrintDerivation.idr new file mode 120000 index 000000000..3724a195a --- /dev/null +++ b/tests/derivation/least-effort/print/regression/fin-inc/PrintDerivation.idr @@ -0,0 +1 @@ +../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/fin-inc/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/fin-inc/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/print/regression/fin-inc/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/fin-inc/derive.ipkg b/tests/derivation/least-effort/print/regression/fin-inc/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/regression/fin-inc/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/fin-inc/expected b/tests/derivation/least-effort/print/regression/fin-inc/expected new file mode 100644 index 000000000..6704d9098 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/fin-inc/expected @@ -0,0 +1,297 @@ +1/3: Building AlternativeCore (AlternativeCore.idr) +2/3: Building PrintDerivation (PrintDerivation.idr) +3/3: Building DerivedGen (DerivedGen.idr) +LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** FinInc n) +LOG gen.auto.derive.infra:0: + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ implicitFalse + .$ (MkArg MW ExplicitArg (Just "n") implicitFalse .=> var "DerivedGen.FinInc" .$ var "n")) + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ (MkArg MW ExplicitArg (Just "m") (var "Prelude.Types.Nat") .=> var "Data.Nat.LTE" .$ var "n" .$ var "m"))) + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ implicitFalse + .$ (MkArg MW ExplicitArg (Just "n") implicitFalse .=> var "DerivedGen.FinInc" .$ var "n")) + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkFinInc (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" + .$ bindVar "val" + .$ (var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "prf") + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkFinInc" .! ("n", var "n") .$ var "val" .$ var "prf")) + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.FinInc[] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "m") (var "Prelude.Types.Nat") + .=> var "Data.Nat.LTE" .$ var "n" .$ var "m"))) + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "m") (var "Prelude.Types.Nat") + .=> var "Data.Nat.LTE" .$ var "n" .$ var "m"))) + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Nat.LTEZero (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "right") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "Data.Nat.LTEZero" .! ("right", var "right")))))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Nat.LTESucc (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" + .$ bindVar "left" + .$ (var "Builtin.DPair.MkDPair" .$ bindVar "right" .$ bindVar "^bnd^{arg:1}") + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Data.Nat.LTESucc" + .! ("right", var "right") + .! ("left", var "left") + .$ var "^bnd^{arg:1}"))) + ] + })) + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Nat.LTE[] (dry fuel)")) + .$ (var "<>" .$ var "Data.Fuel.Dry") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Nat.LTE[] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Z (orders)")) + .$ (var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ var "Prelude.Types.Z") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "^bnd^{arg:2}"))) + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (dry fuel)")) + .$ (var "<>" .$ var "Data.Fuel.Dry") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/regression/fin-inc/run b/tests/derivation/least-effort/print/regression/fin-inc/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/fin-inc/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/fin-inc/DerivedGen.idr b/tests/derivation/least-effort/run/regression/fin-inc/DerivedGen.idr new file mode 100644 index 000000000..4d656ea01 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/fin-inc/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +record FinInc n where + constructor MkFinInc + val : Nat + prf : LTE val n + +Show (FinInc n) where + show (MkFinInc v p) = "MkFinInc \{show v} prf" + +checkedGen : Fuel -> Gen MaybeEmpty (n ** FinInc n) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl + ] diff --git a/tests/derivation/least-effort/run/regression/fin-inc/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/fin-inc/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/fin-inc/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/fin-inc/derive.ipkg b/tests/derivation/least-effort/run/regression/fin-inc/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/fin-inc/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/fin-inc/expected b/tests/derivation/least-effort/run/regression/fin-inc/expected new file mode 100644 index 000000000..f7ab5c74a --- /dev/null +++ b/tests/derivation/least-effort/run/regression/fin-inc/expected @@ -0,0 +1,24 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +(20 ** MkFinInc 16 prf) +----- +(27 ** MkFinInc 17 prf) +----- +(27 ** MkFinInc 10 prf) +----- +(9 ** MkFinInc 5 prf) +----- +(23 ** MkFinInc 12 prf) +----- +(23 ** MkFinInc 8 prf) +----- +(18 ** MkFinInc 4 prf) +----- +(11 ** MkFinInc 7 prf) +----- +(11 ** MkFinInc 10 prf) +----- +(35 ** MkFinInc 15 prf) diff --git a/tests/derivation/least-effort/run/regression/fin-inc/run b/tests/derivation/least-effort/run/regression/fin-inc/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/fin-inc/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 463841b24296fdcf8719cf79ea36c8a23f7632bc Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Thu, 29 Aug 2024 15:30:05 +0300 Subject: [PATCH 33/53] [ derive, test ] Move generator's printer to the main lib + cleanup --- .../tests/gens/print/DerivedGen.idr | 7 +- .../tests/gens/print/PrintDerivation.idr | 1 - .../covering-seq/tests/gens/print/expected | 6 +- .../tests/gens/print/DerivedGen.idr | 7 +- .../tests/gens/print/PrintDerivation.idr | 1 - .../sorted-list/tests/gens/print/expected | 6 +- src/Deriving/DepTyCheck/Gen/Entry.idr | 15 + tests/derivation/_common/PrintDerivation.idr | 20 -- .../infra/empty-body print 001/DerivedGen.idr | 6 +- .../empty-body print 001/PrintDerivation.idr | 1 - .../infra/empty-body print 001/expected | 8 +- .../infra/empty-body print 002/DerivedGen.idr | 6 +- .../empty-body print 002/PrintDerivation.idr | 1 - .../infra/empty-body print 002/expected | 8 +- .../infra/empty-body print 003/DerivedGen.idr | 6 +- .../empty-body print 003/PrintDerivation.idr | 1 - .../infra/empty-body print 003/expected | 8 +- .../infra/empty-body print 004/DerivedGen.idr | 6 +- .../empty-body print 004/PrintDerivation.idr | 1 - .../infra/empty-body print 004/expected | 8 +- .../infra/empty-body print 005/DerivedGen.idr | 6 +- .../empty-body print 005/PrintDerivation.idr | 1 - .../infra/empty-body print 005/expected | 8 +- .../infra/empty-body print 006/DerivedGen.idr | 6 +- .../empty-body print 006/PrintDerivation.idr | 1 - .../infra/empty-body print 006/expected | 8 +- .../infra/empty-body print 007/DerivedGen.idr | 6 +- .../empty-body print 007/PrintDerivation.idr | 1 - .../infra/empty-body print 007/expected | 8 +- .../infra/empty-body print 008/DerivedGen.idr | 6 +- .../empty-body print 008/PrintDerivation.idr | 1 - .../infra/empty-body print 008/expected | 8 +- .../infra/empty-body run 001/DerivedGen.idr | 2 + .../infra/empty-body run 002/DerivedGen.idr | 2 + .../infra/empty-body run 003/DerivedGen.idr | 2 + .../infra/empty-body run 004/DerivedGen.idr | 2 + .../infra/empty-body run 005/DerivedGen.idr | 2 + .../infra/empty-body run 006/DerivedGen.idr | 2 + .../infra/empty-body run 007/DerivedGen.idr | 2 + .../infra/empty-body run 008/DerivedGen.idr | 2 + .../infra/empty-body run 009/DerivedGen.idr | 2 + .../infra/empty-body run 010/DerivedGen.idr | 2 + .../infra/empty-cons print 001/DerivedGen.idr | 6 +- .../empty-cons print 001/PrintDerivation.idr | 1 - .../infra/empty-cons print 001/expected | 8 +- .../infra/empty-cons print 002/DerivedGen.idr | 6 +- .../empty-cons print 002/PrintDerivation.idr | 1 - .../infra/empty-cons print 002/expected | 8 +- .../infra/empty-cons print 003/DerivedGen.idr | 6 +- .../empty-cons print 003/PrintDerivation.idr | 1 - .../infra/empty-cons print 003/expected | 8 +- .../infra/empty-cons print 004/DerivedGen.idr | 6 +- .../empty-cons print 004/PrintDerivation.idr | 1 - .../infra/empty-cons print 004/expected | 8 +- .../infra/empty-cons print 005/DerivedGen.idr | 6 +- .../empty-cons print 005/PrintDerivation.idr | 1 - .../infra/empty-cons print 005/expected | 8 +- .../infra/empty-cons print 006/DerivedGen.idr | 6 +- .../empty-cons print 006/PrintDerivation.idr | 1 - .../infra/empty-cons print 006/expected | 8 +- .../infra/empty-cons print 007/DerivedGen.idr | 6 +- .../empty-cons print 007/PrintDerivation.idr | 1 - .../infra/empty-cons print 007/expected | 8 +- .../infra/empty-cons print 008/DerivedGen.idr | 6 +- .../empty-cons print 008/PrintDerivation.idr | 1 - .../infra/empty-cons print 008/expected | 8 +- .../infra/empty-cons print 009/DerivedGen.idr | 6 +- .../empty-cons print 009/PrintDerivation.idr | 1 - .../infra/empty-cons print 009/expected | 8 +- .../infra/empty-cons print 010/DerivedGen.idr | 6 +- .../empty-cons print 010/PrintDerivation.idr | 1 - .../infra/empty-cons print 010/expected | 8 +- .../infra/empty-cons print 011/DerivedGen.idr | 6 +- .../empty-cons print 011/PrintDerivation.idr | 1 - .../infra/empty-cons print 011/expected | 8 +- .../infra/empty-cons print 012/DerivedGen.idr | 6 +- .../empty-cons print 012/PrintDerivation.idr | 1 - .../infra/empty-cons print 012/expected | 8 +- .../infra/empty-cons print 013/DerivedGen.idr | 6 +- .../empty-cons print 013/PrintDerivation.idr | 1 - .../infra/empty-cons print 013/expected | 8 +- .../infra/empty-cons print 014/DerivedGen.idr | 6 +- .../empty-cons print 014/PrintDerivation.idr | 1 - .../infra/empty-cons print 014/expected | 8 +- .../infra/empty-cons run 001/DerivedGen.idr | 2 + .../infra/empty-cons run 002/DerivedGen.idr | 2 + .../infra/empty-cons run 003/DerivedGen.idr | 2 + .../infra/empty-cons run 004/DerivedGen.idr | 2 + .../infra/empty-cons run 005/DerivedGen.idr | 2 + .../infra/empty-cons run 006/DerivedGen.idr | 2 + .../infra/empty-cons run 007/DerivedGen.idr | 2 + .../infra/empty-cons run 008/DerivedGen.idr | 2 + .../infra/empty-cons run 009/DerivedGen.idr | 2 + .../infra/empty-cons run 010/DerivedGen.idr | 2 + .../infra/empty-cons run 011/DerivedGen.idr | 2 + .../infra/empty-cons run 012/DerivedGen.idr | 2 + .../infra/empty-cons run 013/DerivedGen.idr | 2 + .../infra/empty-cons run 014/DerivedGen.idr | 2 + .../infra/ext print 001/DerivedGen.idr | 6 +- .../infra/ext print 001/PrintDerivation.idr | 1 - tests/derivation/infra/ext print 001/expected | 8 +- .../infra/ext print 002/DerivedGen.idr | 6 +- .../infra/ext print 002/PrintDerivation.idr | 1 - tests/derivation/infra/ext print 002/expected | 8 +- .../infra/ext print 003/DerivedGen.idr | 6 +- .../infra/ext print 003/PrintDerivation.idr | 1 - tests/derivation/infra/ext print 003/expected | 8 +- .../infra/ext print 004/DerivedGen.idr | 6 +- .../infra/ext print 004/PrintDerivation.idr | 1 - tests/derivation/infra/ext print 004/expected | 8 +- .../infra/ext run 001/DerivedGen.idr | 2 + .../infra/ext run 002/DerivedGen.idr | 2 + .../infra/ext run 003/DerivedGen.idr | 2 + .../infra/ext run 004/DerivedGen.idr | 2 + .../infra/self print 001/DerivedGen.idr | 6 +- .../infra/self print 001/PrintDerivation.idr | 1 - .../derivation/infra/self print 001/expected | 8 +- .../infra/self print 002/DerivedGen.idr | 6 +- .../infra/self print 002/PrintDerivation.idr | 1 - .../derivation/infra/self print 002/expected | 8 +- .../infra/self print 003/DerivedGen.idr | 6 +- .../infra/self print 003/PrintDerivation.idr | 1 - .../derivation/infra/self print 003/expected | 8 +- .../infra/self print 004/DerivedGen.idr | 6 +- .../infra/self print 004/PrintDerivation.idr | 1 - .../derivation/infra/self print 004/expected | 8 +- .../infra/self print 005/DerivedGen.idr | 6 +- .../infra/self print 005/PrintDerivation.idr | 1 - .../derivation/infra/self print 005/expected | 8 +- .../infra/self print 006/DerivedGen.idr | 6 +- .../infra/self print 006/PrintDerivation.idr | 1 - .../derivation/infra/self print 006/expected | 8 +- .../infra/self print 007/DerivedGen.idr | 6 +- .../infra/self print 007/PrintDerivation.idr | 1 - .../derivation/infra/self print 007/expected | 8 +- .../infra/self print 008/DerivedGen.idr | 6 +- .../infra/self print 008/PrintDerivation.idr | 1 - .../derivation/infra/self print 008/expected | 8 +- .../infra/self run 001/DerivedGen.idr | 2 + .../infra/self run 002/DerivedGen.idr | 2 + .../infra/self run 003/DerivedGen.idr | 2 + .../infra/self run 004/DerivedGen.idr | 2 + .../infra/self run 005/DerivedGen.idr | 2 + .../infra/self run 006/DerivedGen.idr | 2 + .../infra/self run 007/DerivedGen.idr | 2 + .../infra/self run 008/DerivedGen.idr | 2 + .../infra/self run 009/DerivedGen.idr | 2 + .../infra/self run 010/DerivedGen.idr | 2 + .../print/adt/001 trivial/AlternativeCore.idr | 1 - .../print/adt/001 trivial/DerivedGen.idr | 6 +- .../print/adt/001 trivial/PrintDerivation.idr | 1 - .../print/adt/001 trivial/expected | 7 +- .../print/adt/002 noparam/AlternativeCore.idr | 1 - .../print/adt/002 noparam/DerivedGen.idr | 6 +- .../print/adt/002 noparam/PrintDerivation.idr | 1 - .../print/adt/002 noparam/expected | 7 +- .../print/adt/003 noparam/AlternativeCore.idr | 1 - .../print/adt/003 noparam/DerivedGen.idr | 6 +- .../print/adt/003 noparam/PrintDerivation.idr | 1 - .../print/adt/003 noparam/expected | 7 +- .../print/adt/004 noparam/AlternativeCore.idr | 1 - .../print/adt/004 noparam/DerivedGen.idr | 6 +- .../print/adt/004 noparam/PrintDerivation.idr | 1 - .../print/adt/004 noparam/expected | 7 +- .../print/adt/005 param/AlternativeCore.idr | 1 - .../print/adt/005 param/DerivedGen.idr | 6 +- .../print/adt/005 param/PrintDerivation.idr | 1 - .../least-effort/print/adt/005 param/expected | 7 +- .../print/adt/006 param/AlternativeCore.idr | 1 - .../print/adt/006 param/DerivedGen.idr | 6 +- .../print/adt/006 param/PrintDerivation.idr | 1 - .../least-effort/print/adt/006 param/expected | 7 +- .../AlternativeCore.idr | 1 - .../007 right-to-left simple/DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../adt/007 right-to-left simple/expected | 7 +- .../AlternativeCore.idr | 1 - .../008 right-to-left simple/DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../adt/008 right-to-left simple/expected | 7 +- .../adt/009 left-to-right/AlternativeCore.idr | 1 - .../adt/009 left-to-right/DerivedGen.idr | 6 +- .../adt/009 left-to-right/PrintDerivation.idr | 1 - .../print/adt/009 left-to-right/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../adt/010 right-to-left long-dpair/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../adt/011 right-to-left long-dpair/expected | 7 +- .../AlternativeCore.idr | 1 - .../012 right-to-left chained/DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../adt/012 right-to-left chained/expected | 7 +- .../AlternativeCore.idr | 1 - .../013 right-to-left nondet/DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../adt/013 right-to-left nondet/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 7 +- .../PrintDerivation.idr | 1 - .../adt/014 right-to-left nondet ext/expected | 7 +- .../print/gadt/001 gadt/AlternativeCore.idr | 1 - .../print/gadt/001 gadt/DerivedGen.idr | 6 +- .../print/gadt/001 gadt/PrintDerivation.idr | 1 - .../least-effort/print/gadt/001 gadt/expected | 7 +- .../print/gadt/002 gadt/AlternativeCore.idr | 1 - .../print/gadt/002 gadt/DerivedGen.idr | 6 +- .../print/gadt/002 gadt/PrintDerivation.idr | 1 - .../least-effort/print/gadt/002 gadt/expected | 7 +- .../AlternativeCore.idr | 1 - .../003 right-to-left nondet/DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../gadt/003 right-to-left nondet/expected | 7 +- .../004 right-to-left det/AlternativeCore.idr | 1 - .../gadt/004 right-to-left det/DerivedGen.idr | 6 +- .../004 right-to-left det/PrintDerivation.idr | 1 - .../print/gadt/004 right-to-left det/expected | 7 +- .../print/gadt/005 gadt/AlternativeCore.idr | 1 - .../print/gadt/005 gadt/DerivedGen.idr | 6 +- .../print/gadt/005 gadt/PrintDerivation.idr | 1 - .../least-effort/print/gadt/005 gadt/expected | 7 +- .../print/gadt/006 gadt/AlternativeCore.idr | 1 - .../print/gadt/006 gadt/DerivedGen.idr | 6 +- .../print/gadt/006 gadt/PrintDerivation.idr | 1 - .../least-effort/print/gadt/006 gadt/expected | 7 +- .../print/gadt/007 eq-n/AlternativeCore.idr | 1 - .../print/gadt/007 eq-n/DerivedGen.idr | 6 +- .../print/gadt/007 eq-n/PrintDerivation.idr | 1 - .../least-effort/print/gadt/007 eq-n/expected | 7 +- .../print/gadt/008 eq-n/AlternativeCore.idr | 1 - .../print/gadt/008 eq-n/DerivedGen.idr | 6 +- .../print/gadt/008 eq-n/PrintDerivation.idr | 1 - .../least-effort/print/gadt/008 eq-n/expected | 7 +- .../print/gadt/009 eq-n/AlternativeCore.idr | 1 - .../print/gadt/009 eq-n/DerivedGen.idr | 6 +- .../print/gadt/009 eq-n/PrintDerivation.idr | 1 - .../least-effort/print/gadt/009 eq-n/expected | 7 +- .../print/gadt/010 eq-n/AlternativeCore.idr | 1 - .../print/gadt/010 eq-n/DerivedGen.idr | 6 +- .../print/gadt/010 eq-n/PrintDerivation.idr | 1 - .../least-effort/print/gadt/010 eq-n/expected | 7 +- .../gadt/011 eq deepcons/AlternativeCore.idr | 1 - .../print/gadt/011 eq deepcons/DerivedGen.idr | 6 +- .../gadt/011 eq deepcons/PrintDerivation.idr | 1 - .../print/gadt/011 eq deepcons/expected | 7 +- .../gadt/012 eq deepcons/AlternativeCore.idr | 1 - .../print/gadt/012 eq deepcons/DerivedGen.idr | 6 +- .../gadt/012 eq deepcons/PrintDerivation.idr | 1 - .../print/gadt/012 eq deepcons/expected | 7 +- .../gadt/013 eq deepcons/AlternativeCore.idr | 1 - .../print/gadt/013 eq deepcons/DerivedGen.idr | 6 +- .../gadt/013 eq deepcons/PrintDerivation.idr | 1 - .../print/gadt/013 eq deepcons/expected | 7 +- .../gadt/014 eq deepcons/AlternativeCore.idr | 1 - .../print/gadt/014 eq deepcons/DerivedGen.idr | 6 +- .../gadt/014 eq deepcons/PrintDerivation.idr | 1 - .../print/gadt/014 eq deepcons/expected | 7 +- .../dependent-givens-big/AlternativeCore.idr | 1 - .../dependent-givens-big/DerivedGen.idr | 7 +- .../dependent-givens-big/PrintDerivation.idr | 1 - .../regression/dependent-givens-big/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../dependent-givens-small-deep/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../dependent-givens-small-shallow/expected | 7 +- .../regression/fin-inc/AlternativeCore.idr | 1 - .../print/regression/fin-inc/DerivedGen.idr | 6 +- .../regression/fin-inc/PrintDerivation.idr | 1 - .../print/regression/fin-inc/expected | 7 +- .../AlternativeCore.idr | 1 - .../lost-deceq-four-occurences/DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../lost-deceq-four-occurences/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../lost-deceq-three-occurences/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../too-early-rename-multiple-simple/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../expected | 7 +- .../type-alias-gen-itself/AlternativeCore.idr | 1 - .../type-alias-gen-itself/DerivedGen.idr | 6 +- .../type-alias-gen-itself/PrintDerivation.idr | 1 - .../regression/type-alias-gen-itself/expected | 7 +- .../AlternativeCore.idr | 1 - .../type-alias-target-type/DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../type-alias-target-type/expected | 7 +- .../AlternativeCore.idr | 1 - .../DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../unification-mismatch-dependent/expected | 7 +- .../AlternativeCore.idr | 1 - .../unification-name-mismatch/DerivedGen.idr | 6 +- .../PrintDerivation.idr | 1 - .../unification-name-mismatch/expected | 7 +- .../unnamed-auto-implicit/AlternativeCore.idr | 1 - .../unnamed-auto-implicit/DerivedGen.idr | 6 +- .../unnamed-auto-implicit/PrintDerivation.idr | 1 - .../regression/unnamed-auto-implicit/expected | 7 +- .../utils/arg-deps/_common/Infra.idr | 4 +- .../utils/arg-deps/deps-001-simple/expected | 16 +- .../deps-002-longer-transitive/expected | 36 +-- .../deps-003-lambda-shadowing/expected | 12 +- .../utils/arg-deps/deps-004-case/expected | 8 +- .../utils/canonicsig/_common/Infra.idr | 2 +- .../utils/canonicsig/dep-params/expected | 12 +- .../canonicsig/nondep-expl-params/expected | 8 +- .../canonicsig/nondep-mixed-params/expected | 8 +- .../utils/canonicsig/trivial/expected | 2 +- .../_common-deep-cons-app/Infra.idr | 18 +- .../cons-analysis/deep-cons-app-001/expected | 84 ++--- .../deep-cons-app-002-neg/expected | 108 +++---- .../cons-analysis/deep-cons-app-003/expected | 84 ++--- .../cons-analysis/deep-cons-app-004/expected | 126 ++++---- .../deep-cons-app-005-neg/expected | 96 +++--- .../cons-analysis/deep-cons-app-006/expected | 124 ++++---- .../_common-involved-types/Infra.idr | 8 +- .../utils/involved-types/norec-001/expected | 16 +- .../utils/involved-types/rec-001/expected | 8 +- .../utils/involved-types/rec-002/expected | 4 +- .../up-to-renaming-ttimp-eq/_common/Infra.idr | 2 +- .../up-to-renaming-ttimp-eq/renaming/expected | 256 ++++++++-------- .../up-to-renaming-ttimp-eq/simple/expected | 288 +++++++++--------- 340 files changed, 1218 insertions(+), 1393 deletions(-) delete mode 120000 examples/covering-seq/tests/gens/print/PrintDerivation.idr delete mode 120000 examples/sorted-list/tests/gens/print/PrintDerivation.idr delete mode 100644 tests/derivation/_common/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-body print 001/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-body print 002/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-body print 003/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-body print 004/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-body print 005/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-body print 006/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-body print 007/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-body print 008/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 001/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 002/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 003/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 004/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 005/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 006/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 007/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 008/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 009/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 010/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 011/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 012/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 013/PrintDerivation.idr delete mode 120000 tests/derivation/infra/empty-cons print 014/PrintDerivation.idr delete mode 120000 tests/derivation/infra/ext print 001/PrintDerivation.idr delete mode 120000 tests/derivation/infra/ext print 002/PrintDerivation.idr delete mode 120000 tests/derivation/infra/ext print 003/PrintDerivation.idr delete mode 120000 tests/derivation/infra/ext print 004/PrintDerivation.idr delete mode 120000 tests/derivation/infra/self print 001/PrintDerivation.idr delete mode 120000 tests/derivation/infra/self print 002/PrintDerivation.idr delete mode 120000 tests/derivation/infra/self print 003/PrintDerivation.idr delete mode 120000 tests/derivation/infra/self print 004/PrintDerivation.idr delete mode 120000 tests/derivation/infra/self print 005/PrintDerivation.idr delete mode 120000 tests/derivation/infra/self print 006/PrintDerivation.idr delete mode 120000 tests/derivation/infra/self print 007/PrintDerivation.idr delete mode 120000 tests/derivation/infra/self print 008/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/001 trivial/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/001 trivial/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/002 noparam/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/002 noparam/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/003 noparam/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/003 noparam/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/004 noparam/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/004 noparam/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/005 param/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/005 param/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/006 param/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/006 param/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/007 right-to-left simple/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/007 right-to-left simple/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/008 right-to-left simple/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/008 right-to-left simple/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/009 left-to-right/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/009 left-to-right/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/012 right-to-left chained/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/012 right-to-left chained/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/013 right-to-left nondet/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/013 right-to-left nondet/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/001 gadt/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/001 gadt/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/002 gadt/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/002 gadt/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/003 right-to-left nondet/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/003 right-to-left nondet/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/004 right-to-left det/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/004 right-to-left det/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/005 gadt/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/005 gadt/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/006 gadt/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/006 gadt/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/007 eq-n/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/007 eq-n/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/008 eq-n/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/008 eq-n/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/009 eq-n/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/009 eq-n/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/010 eq-n/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/010 eq-n/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/011 eq deepcons/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/011 eq deepcons/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/012 eq deepcons/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/012 eq deepcons/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/013 eq deepcons/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/013 eq deepcons/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/gadt/014 eq deepcons/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/gadt/014 eq deepcons/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/dependent-givens-big/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/dependent-givens-big/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/dependent-givens-small-deep/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/dependent-givens-small-deep/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/fin-inc/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/fin-inc/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/type-alias-gen-itself/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/type-alias-gen-itself/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/type-alias-target-type/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/type-alias-target-type/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/unification-mismatch-dependent/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/unification-mismatch-dependent/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/unification-name-mismatch/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/unification-name-mismatch/PrintDerivation.idr delete mode 120000 tests/derivation/least-effort/print/regression/unnamed-auto-implicit/AlternativeCore.idr delete mode 120000 tests/derivation/least-effort/print/regression/unnamed-auto-implicit/PrintDerivation.idr diff --git a/examples/covering-seq/tests/gens/print/DerivedGen.idr b/examples/covering-seq/tests/gens/print/DerivedGen.idr index 1d7d38705..fa3a36e6d 100644 --- a/examples/covering-seq/tests/gens/print/DerivedGen.idr +++ b/examples/covering-seq/tests/gens/print/DerivedGen.idr @@ -1,11 +1,12 @@ module DerivedGen -import PrintDerivation - import Data.List.Covering +import Deriving.DepTyCheck.Gen + %default total %language ElabReflection -%runElab printDerived $ Fuel -> {n : Nat} -> (bs : BitMask n) -> Gen MaybeEmpty $ CoveringSequence n bs +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter $ Fuel -> {n : Nat} -> (bs : BitMask n) -> Gen MaybeEmpty $ CoveringSequence n bs diff --git a/examples/covering-seq/tests/gens/print/PrintDerivation.idr b/examples/covering-seq/tests/gens/print/PrintDerivation.idr deleted file mode 120000 index af4998fcf..000000000 --- a/examples/covering-seq/tests/gens/print/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../../../../../tests/derivation/_common/PrintDerivation.idr \ No newline at end of file diff --git a/examples/covering-seq/tests/gens/print/expected b/examples/covering-seq/tests/gens/print/expected index 9899c0753..5c91b882b 100644 --- a/examples/covering-seq/tests/gens/print/expected +++ b/examples/covering-seq/tests/gens/print/expected @@ -1,7 +1,5 @@ -1/2: Building PrintDerivation (PrintDerivation.idr) -2/2: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (bs : BitMask n) -> Gen MaybeEmpty (CoveringSequence n bs) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (bs : BitMask n) -> Gen MaybeEmpty (CoveringSequence n bs) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ImplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/examples/sorted-list/tests/gens/print/DerivedGen.idr b/examples/sorted-list/tests/gens/print/DerivedGen.idr index aa7533642..36dc705d8 100644 --- a/examples/sorted-list/tests/gens/print/DerivedGen.idr +++ b/examples/sorted-list/tests/gens/print/DerivedGen.idr @@ -1,11 +1,12 @@ module DerivedGen -import PrintDerivation - import Data.List.Sorted +import Deriving.DepTyCheck.Gen + %default total %language ElabReflection -%runElab printDerived $ Fuel -> Gen MaybeEmpty SortedList +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter $ Fuel -> Gen MaybeEmpty SortedList diff --git a/examples/sorted-list/tests/gens/print/PrintDerivation.idr b/examples/sorted-list/tests/gens/print/PrintDerivation.idr deleted file mode 120000 index af4998fcf..000000000 --- a/examples/sorted-list/tests/gens/print/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../../../../../tests/derivation/_common/PrintDerivation.idr \ No newline at end of file diff --git a/examples/sorted-list/tests/gens/print/expected b/examples/sorted-list/tests/gens/print/expected index 66f4e31ee..898ce62cf 100644 --- a/examples/sorted-list/tests/gens/print/expected +++ b/examples/sorted-list/tests/gens/print/expected @@ -1,7 +1,5 @@ -1/2: Building PrintDerivation (PrintDerivation.idr) -2/2: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty SortedList -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty SortedList MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/src/Deriving/DepTyCheck/Gen/Entry.idr b/src/Deriving/DepTyCheck/Gen/Entry.idr index a593f75fb..299598bc7 100644 --- a/src/Deriving/DepTyCheck/Gen/Entry.idr +++ b/src/Deriving/DepTyCheck/Gen/Entry.idr @@ -371,3 +371,18 @@ deriveGenFor a = do sig <- quote a tt <- deriveGenExpr sig check tt + +||| Declares `main : IO Unit` function that prints derived generator for the given generator's signature +export +deriveGenPrinter : DerivatorCore => Type -> Elab Unit +deriveGenPrinter ty = do + ty <- quote ty + logSugaredTerm "deptycheck.derive.print" DefaultLogLevel "type" ty + expr <- deriveGenExpr ty + expr <- quote expr + declare `[ + main : IO Unit + main = do + putStr $ interpolate ~(expr) + putStrLn "" + ] diff --git a/tests/derivation/_common/PrintDerivation.idr b/tests/derivation/_common/PrintDerivation.idr deleted file mode 100644 index df823d42f..000000000 --- a/tests/derivation/_common/PrintDerivation.idr +++ /dev/null @@ -1,20 +0,0 @@ -module PrintDerivation - -import public Deriving.DepTyCheck.Gen - -%language ElabReflection - -export covering -printDerived : DerivatorCore => Type -> Elab Unit -printDerived ty = do - ty <- quote ty - logSugaredTerm "gen.auto.derive.infra" 0 "type" ty - expr <- deriveGenExpr ty - expr <- quote expr - declare `[ - main : IO Unit - main = do - putStrLn "LOG gen.auto.derive.infra:0: " -- mimic the original logging behaviour - putStr $ interpolate ~(expr) - putStrLn "" - ] diff --git a/tests/derivation/infra/empty-body print 001/DerivedGen.idr b/tests/derivation/infra/empty-body print 001/DerivedGen.idr index 707762202..4a128870f 100644 --- a/tests/derivation/infra/empty-body print 001/DerivedGen.idr +++ b/tests/derivation/infra/empty-body print 001/DerivedGen.idr @@ -1,10 +1,12 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{EmptyBody} $ Fuel -> Gen MaybeEmpty Unit +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyBody} $ Fuel -> Gen MaybeEmpty Unit diff --git a/tests/derivation/infra/empty-body print 001/PrintDerivation.idr b/tests/derivation/infra/empty-body print 001/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-body print 001/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-body print 001/expected b/tests/derivation/infra/empty-body print 001/expected index c81b9d826..71e4419a3 100644 --- a/tests/derivation/infra/empty-body print 001/expected +++ b/tests/derivation/infra/empty-body print 001/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty () -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty () MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-body print 002/DerivedGen.idr b/tests/derivation/infra/empty-body print 002/DerivedGen.idr index 6ccb1ca49..608697535 100644 --- a/tests/derivation/infra/empty-body print 002/DerivedGen.idr +++ b/tests/derivation/infra/empty-body print 002/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{EmptyBody} $ Fuel -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyBody} $ Fuel -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) diff --git a/tests/derivation/infra/empty-body print 002/PrintDerivation.idr b/tests/derivation/infra/empty-body print 002/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-body print 002/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-body print 002/expected b/tests/derivation/infra/empty-body print 002/expected index 8f69d0170..1fcb35f76 100644 --- a/tests/derivation/infra/empty-body print 002/expected +++ b/tests/derivation/infra/empty-body print 002/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/infra/empty-body print 003/DerivedGen.idr b/tests/derivation/infra/empty-body print 003/DerivedGen.idr index 338a29b65..4736fff83 100644 --- a/tests/derivation/infra/empty-body print 003/DerivedGen.idr +++ b/tests/derivation/infra/empty-body print 003/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{EmptyBody} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty Bool +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyBody} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty Bool diff --git a/tests/derivation/infra/empty-body print 003/PrintDerivation.idr b/tests/derivation/infra/empty-body print 003/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-body print 003/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-body print 003/expected b/tests/derivation/infra/empty-body print 003/expected index 53dd5fcfe..bc50b25ec 100644 --- a/tests/derivation/infra/empty-body print 003/expected +++ b/tests/derivation/infra/empty-body print 003/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty Bool -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty Bool MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/infra/empty-body print 004/DerivedGen.idr b/tests/derivation/infra/empty-body print 004/DerivedGen.idr index 00548c40b..6c981ad1d 100644 --- a/tests/derivation/infra/empty-body print 004/DerivedGen.idr +++ b/tests/derivation/infra/empty-body print 004/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +11,5 @@ import PrintDerivation data X : Nat -> Type where MkX : X n -%runElab printDerived @{EmptyBody} $ Fuel -> (n : Nat) -> Gen MaybeEmpty (X n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyBody} $ Fuel -> (n : Nat) -> Gen MaybeEmpty (X n) diff --git a/tests/derivation/infra/empty-body print 004/PrintDerivation.idr b/tests/derivation/infra/empty-body print 004/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-body print 004/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-body print 004/expected b/tests/derivation/infra/empty-body print 004/expected index 6998286dc..3656c1094 100644 --- a/tests/derivation/infra/empty-body print 004/expected +++ b/tests/derivation/infra/empty-body print 004/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/infra/empty-body print 005/DerivedGen.idr b/tests/derivation/infra/empty-body print 005/DerivedGen.idr index 697beb796..3ee2ecbd5 100644 --- a/tests/derivation/infra/empty-body print 005/DerivedGen.idr +++ b/tests/derivation/infra/empty-body print 005/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +11,5 @@ import PrintDerivation data X : Nat -> Type where MkX : X n -%runElab printDerived @{EmptyBody} $ Fuel -> Gen MaybeEmpty (n : Nat ** X n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyBody} $ Fuel -> Gen MaybeEmpty (n : Nat ** X n) diff --git a/tests/derivation/infra/empty-body print 005/PrintDerivation.idr b/tests/derivation/infra/empty-body print 005/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-body print 005/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-body print 005/expected b/tests/derivation/infra/empty-body print 005/expected index 899db2799..7bc0c78ca 100644 --- a/tests/derivation/infra/empty-body print 005/expected +++ b/tests/derivation/infra/empty-body print 005/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-body print 006/DerivedGen.idr b/tests/derivation/infra/empty-body print 006/DerivedGen.idr index 000763bd5..3cc007dfe 100644 --- a/tests/derivation/infra/empty-body print 006/DerivedGen.idr +++ b/tests/derivation/infra/empty-body print 006/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{EmptyBody} $ Fuel -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyBody} $ Fuel -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) diff --git a/tests/derivation/infra/empty-body print 006/PrintDerivation.idr b/tests/derivation/infra/empty-body print 006/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-body print 006/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-body print 006/expected b/tests/derivation/infra/empty-body print 006/expected index 04ad08858..e5c8b0818 100644 --- a/tests/derivation/infra/empty-body print 006/expected +++ b/tests/derivation/infra/empty-body print 006/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/infra/empty-body print 007/DerivedGen.idr b/tests/derivation/infra/empty-body print 007/DerivedGen.idr index 5e89f1f16..e331d8454 100644 --- a/tests/derivation/infra/empty-body print 007/DerivedGen.idr +++ b/tests/derivation/infra/empty-body print 007/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +12,5 @@ data X : Nat -> Bool -> Type where X0 : X 0 True X1 : X 1 False -%runElab printDerived @{EmptyBody} $ Fuel -> Gen MaybeEmpty (n : Nat ** b : Bool ** X n b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyBody} $ Fuel -> Gen MaybeEmpty (n : Nat ** b : Bool ** X n b) diff --git a/tests/derivation/infra/empty-body print 007/PrintDerivation.idr b/tests/derivation/infra/empty-body print 007/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-body print 007/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-body print 007/expected b/tests/derivation/infra/empty-body print 007/expected index 964edff1e..6414736b2 100644 --- a/tests/derivation/infra/empty-body print 007/expected +++ b/tests/derivation/infra/empty-body print 007/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (b : Bool ** X n b)) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (b : Bool ** X n b)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-body print 008/DerivedGen.idr b/tests/derivation/infra/empty-body print 008/DerivedGen.idr index ffc8df140..7a5dc3b10 100644 --- a/tests/derivation/infra/empty-body print 008/DerivedGen.idr +++ b/tests/derivation/infra/empty-body print 008/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{EmptyBody} $ Fuel -> Gen MaybeEmpty (n : Nat ** a : Type ** Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyBody} $ Fuel -> Gen MaybeEmpty (n : Nat ** a : Type ** Vect n a) diff --git a/tests/derivation/infra/empty-body print 008/PrintDerivation.idr b/tests/derivation/infra/empty-body print 008/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-body print 008/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-body print 008/expected b/tests/derivation/infra/empty-body print 008/expected index ad829c609..6aa83e147 100644 --- a/tests/derivation/infra/empty-body print 008/expected +++ b/tests/derivation/infra/empty-body print 008/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (a : Type ** Vect n a)) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (a : Type ** Vect n a)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-body run 001/DerivedGen.idr b/tests/derivation/infra/empty-body run 001/DerivedGen.idr index 179fb5889..11601bc34 100644 --- a/tests/derivation/infra/empty-body run 001/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 001/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-body run 002/DerivedGen.idr b/tests/derivation/infra/empty-body run 002/DerivedGen.idr index a183f8a1d..aa30d7074 100644 --- a/tests/derivation/infra/empty-body run 002/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 002/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-body run 003/DerivedGen.idr b/tests/derivation/infra/empty-body run 003/DerivedGen.idr index ec915a6e1..31454d85f 100644 --- a/tests/derivation/infra/empty-body run 003/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 003/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-body run 004/DerivedGen.idr b/tests/derivation/infra/empty-body run 004/DerivedGen.idr index 08d11cf91..7b0724d27 100644 --- a/tests/derivation/infra/empty-body run 004/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 004/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-body run 005/DerivedGen.idr b/tests/derivation/infra/empty-body run 005/DerivedGen.idr index 4255d61e0..52b09c0ec 100644 --- a/tests/derivation/infra/empty-body run 005/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 005/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-body run 006/DerivedGen.idr b/tests/derivation/infra/empty-body run 006/DerivedGen.idr index 3bdc005f3..19feea850 100644 --- a/tests/derivation/infra/empty-body run 006/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 006/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-body run 007/DerivedGen.idr b/tests/derivation/infra/empty-body run 007/DerivedGen.idr index 2bf934cf6..39c78a5f5 100644 --- a/tests/derivation/infra/empty-body run 007/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 007/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-body run 008/DerivedGen.idr b/tests/derivation/infra/empty-body run 008/DerivedGen.idr index 223e89e4e..9794ffbdf 100644 --- a/tests/derivation/infra/empty-body run 008/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 008/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-body run 009/DerivedGen.idr b/tests/derivation/infra/empty-body run 009/DerivedGen.idr index 72970a807..7a4c97d2f 100644 --- a/tests/derivation/infra/empty-body run 009/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 009/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-body run 010/DerivedGen.idr b/tests/derivation/infra/empty-body run 010/DerivedGen.idr index 6ba0dafe0..03af4c547 100644 --- a/tests/derivation/infra/empty-body run 010/DerivedGen.idr +++ b/tests/derivation/infra/empty-body run 010/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-cons print 001/DerivedGen.idr b/tests/derivation/infra/empty-cons print 001/DerivedGen.idr index 174aa2f99..812400639 100644 --- a/tests/derivation/infra/empty-cons print 001/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 001/DerivedGen.idr @@ -1,10 +1,12 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{EmptyCons} $ Fuel -> Gen MaybeEmpty Unit +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> Gen MaybeEmpty Unit diff --git a/tests/derivation/infra/empty-cons print 001/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 001/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 001/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 001/expected b/tests/derivation/infra/empty-cons print 001/expected index 5d0b89f05..780b1b949 100644 --- a/tests/derivation/infra/empty-cons print 001/expected +++ b/tests/derivation/infra/empty-cons print 001/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty () -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty () MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-cons print 002/DerivedGen.idr b/tests/derivation/infra/empty-cons print 002/DerivedGen.idr index ec8ff714d..48a020982 100644 --- a/tests/derivation/infra/empty-cons print 002/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 002/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{EmptyCons} $ Fuel -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) diff --git a/tests/derivation/infra/empty-cons print 002/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 002/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 002/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 002/expected b/tests/derivation/infra/empty-cons print 002/expected index 0d83db953..5af4ddcc8 100644 --- a/tests/derivation/infra/empty-cons print 002/expected +++ b/tests/derivation/infra/empty-cons print 002/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/infra/empty-cons print 003/DerivedGen.idr b/tests/derivation/infra/empty-cons print 003/DerivedGen.idr index 8ffcbb66b..9394df3e2 100644 --- a/tests/derivation/infra/empty-cons print 003/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 003/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{EmptyCons} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty Bool +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty Bool diff --git a/tests/derivation/infra/empty-cons print 003/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 003/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 003/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 003/expected b/tests/derivation/infra/empty-cons print 003/expected index 77bfb10c5..63fdc9f12 100644 --- a/tests/derivation/infra/empty-cons print 003/expected +++ b/tests/derivation/infra/empty-cons print 003/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty Bool -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty Bool MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/infra/empty-cons print 004/DerivedGen.idr b/tests/derivation/infra/empty-cons print 004/DerivedGen.idr index 666594b7d..60695cfbc 100644 --- a/tests/derivation/infra/empty-cons print 004/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 004/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +11,5 @@ import PrintDerivation data X : Nat -> Type where MkX : X n -%runElab printDerived @{EmptyCons} $ Fuel -> (n : Nat) -> Gen MaybeEmpty (X n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> (n : Nat) -> Gen MaybeEmpty (X n) diff --git a/tests/derivation/infra/empty-cons print 004/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 004/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 004/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 004/expected b/tests/derivation/infra/empty-cons print 004/expected index fc8338a92..564735447 100644 --- a/tests/derivation/infra/empty-cons print 004/expected +++ b/tests/derivation/infra/empty-cons print 004/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/infra/empty-cons print 005/DerivedGen.idr b/tests/derivation/infra/empty-cons print 005/DerivedGen.idr index de81a51cf..d65e5bb8f 100644 --- a/tests/derivation/infra/empty-cons print 005/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 005/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +11,5 @@ import PrintDerivation data X : Nat -> Type where MkX : X n -%runElab printDerived @{EmptyCons} $ Fuel -> Gen MaybeEmpty (n : Nat ** X n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> Gen MaybeEmpty (n : Nat ** X n) diff --git a/tests/derivation/infra/empty-cons print 005/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 005/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 005/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 005/expected b/tests/derivation/infra/empty-cons print 005/expected index 38f31f476..ac6ef9ca3 100644 --- a/tests/derivation/infra/empty-cons print 005/expected +++ b/tests/derivation/infra/empty-cons print 005/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-cons print 006/DerivedGen.idr b/tests/derivation/infra/empty-cons print 006/DerivedGen.idr index 5d9757ed5..04ab501ae 100644 --- a/tests/derivation/infra/empty-cons print 006/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 006/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{EmptyCons} $ Fuel -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) diff --git a/tests/derivation/infra/empty-cons print 006/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 006/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 006/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 006/expected b/tests/derivation/infra/empty-cons print 006/expected index eb3025a1d..9456e8d53 100644 --- a/tests/derivation/infra/empty-cons print 006/expected +++ b/tests/derivation/infra/empty-cons print 006/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/infra/empty-cons print 007/DerivedGen.idr b/tests/derivation/infra/empty-cons print 007/DerivedGen.idr index 3354fc041..3c6534967 100644 --- a/tests/derivation/infra/empty-cons print 007/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 007/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +12,5 @@ data X : Nat -> Bool -> Type where X0 : X 0 True X1 : X 1 False -%runElab printDerived @{EmptyCons} $ Fuel -> Gen MaybeEmpty (n : Nat ** b : Bool ** X n b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> Gen MaybeEmpty (n : Nat ** b : Bool ** X n b) diff --git a/tests/derivation/infra/empty-cons print 007/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 007/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 007/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 007/expected b/tests/derivation/infra/empty-cons print 007/expected index 0640fcd26..713ce0aeb 100644 --- a/tests/derivation/infra/empty-cons print 007/expected +++ b/tests/derivation/infra/empty-cons print 007/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (b : Bool ** X n b)) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (b : Bool ** X n b)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-cons print 008/DerivedGen.idr b/tests/derivation/infra/empty-cons print 008/DerivedGen.idr index a0d9d1cea..408c71149 100644 --- a/tests/derivation/infra/empty-cons print 008/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 008/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{EmptyCons} $ Fuel -> Gen MaybeEmpty (n : Nat ** a : Type ** Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> Gen MaybeEmpty (n : Nat ** a : Type ** Vect n a) diff --git a/tests/derivation/infra/empty-cons print 008/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 008/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 008/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 008/expected b/tests/derivation/infra/empty-cons print 008/expected index af637b8de..83cf584f3 100644 --- a/tests/derivation/infra/empty-cons print 008/expected +++ b/tests/derivation/infra/empty-cons print 008/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (a : Type ** Vect n a)) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (a : Type ** Vect n a)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-cons print 009/DerivedGen.idr b/tests/derivation/infra/empty-cons print 009/DerivedGen.idr index a5fa391bd..b93385a0e 100644 --- a/tests/derivation/infra/empty-cons print 009/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 009/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -13,4 +14,5 @@ data Y = Y0 | Y1 data X = X0 | X1 | X2 Y -%runElab printDerived @{EmptyCons} $ Fuel -> Gen MaybeEmpty X +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/infra/empty-cons print 009/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 009/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 009/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 009/expected b/tests/derivation/infra/empty-cons print 009/expected index 10ca690a7..4ad564f4f 100644 --- a/tests/derivation/infra/empty-cons print 009/expected +++ b/tests/derivation/infra/empty-cons print 009/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty X -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-cons print 010/DerivedGen.idr b/tests/derivation/infra/empty-cons print 010/DerivedGen.idr index f95bc7f39..6f3e5abce 100644 --- a/tests/derivation/infra/empty-cons print 010/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 010/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -15,4 +16,5 @@ mutual data Y = Y0 | Y1 X -%runElab printDerived @{EmptyCons} $ Fuel -> Gen MaybeEmpty X +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/infra/empty-cons print 010/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 010/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 010/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 010/expected b/tests/derivation/infra/empty-cons print 010/expected index 53d5ba91e..d25471a4e 100644 --- a/tests/derivation/infra/empty-cons print 010/expected +++ b/tests/derivation/infra/empty-cons print 010/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty X -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-cons print 011/DerivedGen.idr b/tests/derivation/infra/empty-cons print 011/DerivedGen.idr index aa9edc64f..4418873e6 100644 --- a/tests/derivation/infra/empty-cons print 011/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 011/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -18,4 +19,5 @@ mutual data Y = Y0 | Y1 (X Nat) -%runElab printDerived @{EmptyCons} $ Fuel -> Gen MaybeEmpty (a ** X a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> Gen MaybeEmpty (a ** X a) diff --git a/tests/derivation/infra/empty-cons print 011/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 011/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 011/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 011/expected b/tests/derivation/infra/empty-cons print 011/expected index 0dc0775c7..48adcc7a6 100644 --- a/tests/derivation/infra/empty-cons print 011/expected +++ b/tests/derivation/infra/empty-cons print 011/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (a : Type ** X a) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (a : Type ** X a) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/empty-cons print 012/DerivedGen.idr b/tests/derivation/infra/empty-cons print 012/DerivedGen.idr index 7616b9251..f8ed69365 100644 --- a/tests/derivation/infra/empty-cons print 012/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 012/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +12,5 @@ data X : Nat -> Nat -> Type where XE : X n n XS : X n (S n) -%runElab printDerived @{EmptyCons} $ Fuel -> (n, m : Nat) -> Gen MaybeEmpty (X n m) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> (n, m : Nat) -> Gen MaybeEmpty (X n m) diff --git a/tests/derivation/infra/empty-cons print 012/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 012/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 012/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 012/expected b/tests/derivation/infra/empty-cons print 012/expected index 695f6dec0..4a6e4b0dd 100644 --- a/tests/derivation/infra/empty-cons print 012/expected +++ b/tests/derivation/infra/empty-cons print 012/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> Gen MaybeEmpty (X n m) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> Gen MaybeEmpty (X n m) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/infra/empty-cons print 013/DerivedGen.idr b/tests/derivation/infra/empty-cons print 013/DerivedGen.idr index 0122e9482..c5e5b144b 100644 --- a/tests/derivation/infra/empty-cons print 013/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 013/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +12,5 @@ data X : Nat -> Nat -> Nat -> Nat -> Type where XE : X n (S n) m n XS : X n n m m -%runElab printDerived @{EmptyCons} $ Fuel -> (n, m, p, k : Nat) -> Gen MaybeEmpty (X n m p k) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> (n, m, p, k : Nat) -> Gen MaybeEmpty (X n m p k) diff --git a/tests/derivation/infra/empty-cons print 013/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 013/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 013/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 013/expected b/tests/derivation/infra/empty-cons print 013/expected index 45c47dae3..1d56384a4 100644 --- a/tests/derivation/infra/empty-cons print 013/expected +++ b/tests/derivation/infra/empty-cons print 013/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> (p : Nat) -> (k : Nat) -> Gen MaybeEmpty (X n m p k) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> (p : Nat) -> (k : Nat) -> Gen MaybeEmpty (X n m p k) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/infra/empty-cons print 014/DerivedGen.idr b/tests/derivation/infra/empty-cons print 014/DerivedGen.idr index a6956b7bf..ca50589d1 100644 --- a/tests/derivation/infra/empty-cons print 014/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons print 014/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +12,5 @@ data X : Nat -> Nat -> Nat -> Nat -> Type where XE : X n (S n) m n XS : X n n m m -%runElab printDerived @{EmptyCons} $ Fuel -> (n, m, p, k : Nat) -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty (X n m p k) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ Fuel -> (n, m, p, k : Nat) -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty (X n m p k) diff --git a/tests/derivation/infra/empty-cons print 014/PrintDerivation.idr b/tests/derivation/infra/empty-cons print 014/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/empty-cons print 014/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 014/expected b/tests/derivation/infra/empty-cons print 014/expected index 2668f6c7e..51ab66a5d 100644 --- a/tests/derivation/infra/empty-cons print 014/expected +++ b/tests/derivation/infra/empty-cons print 014/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> (p : Nat) -> (k : Nat) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty (X n m p k) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> (p : Nat) -> (k : Nat) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty (X n m p k) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/infra/empty-cons run 001/DerivedGen.idr b/tests/derivation/infra/empty-cons run 001/DerivedGen.idr index 29ce2d122..cec0f366a 100644 --- a/tests/derivation/infra/empty-cons run 001/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 001/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-cons run 002/DerivedGen.idr b/tests/derivation/infra/empty-cons run 002/DerivedGen.idr index fc3f2660e..11a7d4741 100644 --- a/tests/derivation/infra/empty-cons run 002/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 002/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-cons run 003/DerivedGen.idr b/tests/derivation/infra/empty-cons run 003/DerivedGen.idr index 0525072a7..d22833d87 100644 --- a/tests/derivation/infra/empty-cons run 003/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 003/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-cons run 004/DerivedGen.idr b/tests/derivation/infra/empty-cons run 004/DerivedGen.idr index ba95523fd..6afadba8b 100644 --- a/tests/derivation/infra/empty-cons run 004/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 004/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-cons run 005/DerivedGen.idr b/tests/derivation/infra/empty-cons run 005/DerivedGen.idr index ba577e726..821495369 100644 --- a/tests/derivation/infra/empty-cons run 005/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 005/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-cons run 006/DerivedGen.idr b/tests/derivation/infra/empty-cons run 006/DerivedGen.idr index 8fc0b01a8..ebe704a27 100644 --- a/tests/derivation/infra/empty-cons run 006/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 006/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/empty-cons run 007/DerivedGen.idr b/tests/derivation/infra/empty-cons run 007/DerivedGen.idr index 415b6dc20..767b352ec 100644 --- a/tests/derivation/infra/empty-cons run 007/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 007/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-cons run 008/DerivedGen.idr b/tests/derivation/infra/empty-cons run 008/DerivedGen.idr index d58378f55..1db5cdd2a 100644 --- a/tests/derivation/infra/empty-cons run 008/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 008/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-cons run 009/DerivedGen.idr b/tests/derivation/infra/empty-cons run 009/DerivedGen.idr index c61d42557..ff1c939c2 100644 --- a/tests/derivation/infra/empty-cons run 009/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 009/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-cons run 010/DerivedGen.idr b/tests/derivation/infra/empty-cons run 010/DerivedGen.idr index daaa327de..79145adf2 100644 --- a/tests/derivation/infra/empty-cons run 010/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 010/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-cons run 011/DerivedGen.idr b/tests/derivation/infra/empty-cons run 011/DerivedGen.idr index 4952a54d8..efac204d0 100644 --- a/tests/derivation/infra/empty-cons run 011/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 011/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-cons run 012/DerivedGen.idr b/tests/derivation/infra/empty-cons run 012/DerivedGen.idr index 23326bcb9..03d41e6aa 100644 --- a/tests/derivation/infra/empty-cons run 012/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 012/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-cons run 013/DerivedGen.idr b/tests/derivation/infra/empty-cons run 013/DerivedGen.idr index 13098ebf9..640b2de09 100644 --- a/tests/derivation/infra/empty-cons run 013/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 013/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/empty-cons run 014/DerivedGen.idr b/tests/derivation/infra/empty-cons run 014/DerivedGen.idr index e393d3b80..026b35903 100644 --- a/tests/derivation/infra/empty-cons run 014/DerivedGen.idr +++ b/tests/derivation/infra/empty-cons run 014/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/ext print 001/DerivedGen.idr b/tests/derivation/infra/ext print 001/DerivedGen.idr index 46a527742..b5cbac9ea 100644 --- a/tests/derivation/infra/ext print 001/DerivedGen.idr +++ b/tests/derivation/infra/ext print 001/DerivedGen.idr @@ -1,10 +1,12 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{Ext_XS} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty XS +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{Ext_XS} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty XS diff --git a/tests/derivation/infra/ext print 001/PrintDerivation.idr b/tests/derivation/infra/ext print 001/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/ext print 001/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/ext print 001/expected b/tests/derivation/infra/ext print 001/expected index 498f02751..645037a72 100644 --- a/tests/derivation/infra/ext print 001/expected +++ b/tests/derivation/infra/ext print 001/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty XS -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty XS MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/infra/ext print 002/DerivedGen.idr b/tests/derivation/infra/ext print 002/DerivedGen.idr index c47dace79..148b3f55d 100644 --- a/tests/derivation/infra/ext print 002/DerivedGen.idr +++ b/tests/derivation/infra/ext print 002/DerivedGen.idr @@ -1,10 +1,12 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{Ext_XSS} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty XSS +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{Ext_XSS} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty XSS diff --git a/tests/derivation/infra/ext print 002/PrintDerivation.idr b/tests/derivation/infra/ext print 002/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/ext print 002/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/ext print 002/expected b/tests/derivation/infra/ext print 002/expected index f52a73ec8..a3a92d2fa 100644 --- a/tests/derivation/infra/ext print 002/expected +++ b/tests/derivation/infra/ext print 002/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty XSS -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty XSS MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/infra/ext print 003/DerivedGen.idr b/tests/derivation/infra/ext print 003/DerivedGen.idr index 01c6d254e..fda59fadd 100644 --- a/tests/derivation/infra/ext print 003/DerivedGen.idr +++ b/tests/derivation/infra/ext print 003/DerivedGen.idr @@ -1,10 +1,12 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{Ext_XSN} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty XSN +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{Ext_XSN} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty XSN diff --git a/tests/derivation/infra/ext print 003/PrintDerivation.idr b/tests/derivation/infra/ext print 003/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/ext print 003/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/ext print 003/expected b/tests/derivation/infra/ext print 003/expected index 3cdfcabcc..0baee2ef8 100644 --- a/tests/derivation/infra/ext print 003/expected +++ b/tests/derivation/infra/ext print 003/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty XSN -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty XSN MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/infra/ext print 004/DerivedGen.idr b/tests/derivation/infra/ext print 004/DerivedGen.idr index 22e1d897d..09a192c96 100644 --- a/tests/derivation/infra/ext print 004/DerivedGen.idr +++ b/tests/derivation/infra/ext print 004/DerivedGen.idr @@ -1,10 +1,12 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{Ext_XSN} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => (n : Nat) -> Gen MaybeEmpty (X'S n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{Ext_XSN} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => (n : Nat) -> Gen MaybeEmpty (X'S n) diff --git a/tests/derivation/infra/ext print 004/PrintDerivation.idr b/tests/derivation/infra/ext print 004/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/ext print 004/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/ext print 004/expected b/tests/derivation/infra/ext print 004/expected index e384a2bef..138a41b86 100644 --- a/tests/derivation/infra/ext print 004/expected +++ b/tests/derivation/infra/ext print 004/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> (n : Nat) -> Gen MaybeEmpty (X'S n) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> (n : Nat) -> Gen MaybeEmpty (X'S n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/infra/ext run 001/DerivedGen.idr b/tests/derivation/infra/ext run 001/DerivedGen.idr index ea7e76e15..cf18ef03d 100644 --- a/tests/derivation/infra/ext run 001/DerivedGen.idr +++ b/tests/derivation/infra/ext run 001/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/ext run 002/DerivedGen.idr b/tests/derivation/infra/ext run 002/DerivedGen.idr index 96d26d729..a09ecae63 100644 --- a/tests/derivation/infra/ext run 002/DerivedGen.idr +++ b/tests/derivation/infra/ext run 002/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/ext run 003/DerivedGen.idr b/tests/derivation/infra/ext run 003/DerivedGen.idr index 4e067ab1b..2be2eedd7 100644 --- a/tests/derivation/infra/ext run 003/DerivedGen.idr +++ b/tests/derivation/infra/ext run 003/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/ext run 004/DerivedGen.idr b/tests/derivation/infra/ext run 004/DerivedGen.idr index 378e9fbb5..cb971e6f7 100644 --- a/tests/derivation/infra/ext run 004/DerivedGen.idr +++ b/tests/derivation/infra/ext run 004/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/self print 001/DerivedGen.idr b/tests/derivation/infra/self print 001/DerivedGen.idr index 0c9baa697..74cfd4ccc 100644 --- a/tests/derivation/infra/self print 001/DerivedGen.idr +++ b/tests/derivation/infra/self print 001/DerivedGen.idr @@ -1,10 +1,12 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{CallSelf} $ Fuel -> Gen MaybeEmpty Unit +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{CallSelf} $ Fuel -> Gen MaybeEmpty Unit diff --git a/tests/derivation/infra/self print 001/PrintDerivation.idr b/tests/derivation/infra/self print 001/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/self print 001/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/self print 001/expected b/tests/derivation/infra/self print 001/expected index ec9969db1..e02a7a623 100644 --- a/tests/derivation/infra/self print 001/expected +++ b/tests/derivation/infra/self print 001/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty () -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty () MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/self print 002/DerivedGen.idr b/tests/derivation/infra/self print 002/DerivedGen.idr index 4fe3908a3..088a2f4ad 100644 --- a/tests/derivation/infra/self print 002/DerivedGen.idr +++ b/tests/derivation/infra/self print 002/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{CallSelf} $ Fuel -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{CallSelf} $ Fuel -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) diff --git a/tests/derivation/infra/self print 002/PrintDerivation.idr b/tests/derivation/infra/self print 002/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/self print 002/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/self print 002/expected b/tests/derivation/infra/self print 002/expected index 684ee508a..8345715d5 100644 --- a/tests/derivation/infra/self print 002/expected +++ b/tests/derivation/infra/self print 002/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (a : Type) -> Gen MaybeEmpty (Vect n a) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/infra/self print 003/DerivedGen.idr b/tests/derivation/infra/self print 003/DerivedGen.idr index 41333be59..56c2426f5 100644 --- a/tests/derivation/infra/self print 003/DerivedGen.idr +++ b/tests/derivation/infra/self print 003/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{CallSelf} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty Bool +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{CallSelf} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty Bool diff --git a/tests/derivation/infra/self print 003/PrintDerivation.idr b/tests/derivation/infra/self print 003/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/self print 003/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/self print 003/expected b/tests/derivation/infra/self print 003/expected index 746ea7868..866795299 100644 --- a/tests/derivation/infra/self print 003/expected +++ b/tests/derivation/infra/self print 003/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty Bool -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty Bool MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/infra/self print 004/DerivedGen.idr b/tests/derivation/infra/self print 004/DerivedGen.idr index 9f091ccc6..4d6335d1a 100644 --- a/tests/derivation/infra/self print 004/DerivedGen.idr +++ b/tests/derivation/infra/self print 004/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +11,5 @@ import PrintDerivation data X : Nat -> Type where MkX : X n -%runElab printDerived @{CallSelf} $ Fuel -> (n : Nat) -> Gen MaybeEmpty (X n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{CallSelf} $ Fuel -> (n : Nat) -> Gen MaybeEmpty (X n) diff --git a/tests/derivation/infra/self print 004/PrintDerivation.idr b/tests/derivation/infra/self print 004/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/self print 004/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/self print 004/expected b/tests/derivation/infra/self print 004/expected index 94958397d..95197b39a 100644 --- a/tests/derivation/infra/self print 004/expected +++ b/tests/derivation/infra/self print 004/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/infra/self print 005/DerivedGen.idr b/tests/derivation/infra/self print 005/DerivedGen.idr index 6a31b5345..290552a25 100644 --- a/tests/derivation/infra/self print 005/DerivedGen.idr +++ b/tests/derivation/infra/self print 005/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +11,5 @@ import PrintDerivation data X : Nat -> Type where MkX : X n -%runElab printDerived @{CallSelf} $ Fuel -> Gen MaybeEmpty (n : Nat ** X n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{CallSelf} $ Fuel -> Gen MaybeEmpty (n : Nat ** X n) diff --git a/tests/derivation/infra/self print 005/PrintDerivation.idr b/tests/derivation/infra/self print 005/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/self print 005/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/self print 005/expected b/tests/derivation/infra/self print 005/expected index 08f5edbab..499591456 100644 --- a/tests/derivation/infra/self print 005/expected +++ b/tests/derivation/infra/self print 005/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/self print 006/DerivedGen.idr b/tests/derivation/infra/self print 006/DerivedGen.idr index e4952ed19..21a7db324 100644 --- a/tests/derivation/infra/self print 006/DerivedGen.idr +++ b/tests/derivation/infra/self print 006/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{CallSelf} $ Fuel -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{CallSelf} $ Fuel -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) diff --git a/tests/derivation/infra/self print 006/PrintDerivation.idr b/tests/derivation/infra/self print 006/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/self print 006/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/self print 006/expected b/tests/derivation/infra/self print 006/expected index be7aab0f6..99a721fa5 100644 --- a/tests/derivation/infra/self print 006/expected +++ b/tests/derivation/infra/self print 006/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Type) -> Gen MaybeEmpty (n : Nat ** Vect n a) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/infra/self print 007/DerivedGen.idr b/tests/derivation/infra/self print 007/DerivedGen.idr index 1a09914a4..1d14c2c68 100644 --- a/tests/derivation/infra/self print 007/DerivedGen.idr +++ b/tests/derivation/infra/self print 007/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +12,5 @@ data X : Nat -> Bool -> Type where X0 : X 0 True X1 : X 1 False -%runElab printDerived @{CallSelf} $ Fuel -> Gen MaybeEmpty (n : Nat ** b : Bool ** X n b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{CallSelf} $ Fuel -> Gen MaybeEmpty (n : Nat ** b : Bool ** X n b) diff --git a/tests/derivation/infra/self print 007/PrintDerivation.idr b/tests/derivation/infra/self print 007/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/self print 007/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/self print 007/expected b/tests/derivation/infra/self print 007/expected index b08bc1fa5..2db67de0a 100644 --- a/tests/derivation/infra/self print 007/expected +++ b/tests/derivation/infra/self print 007/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (b : Bool ** X n b)) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (b : Bool ** X n b)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/self print 008/DerivedGen.idr b/tests/derivation/infra/self print 008/DerivedGen.idr index 58cc37b76..aea37b3bd 100644 --- a/tests/derivation/infra/self print 008/DerivedGen.idr +++ b/tests/derivation/infra/self print 008/DerivedGen.idr @@ -1,7 +1,8 @@ module DerivedGen import AlternativeCore -import PrintDerivation + +import Deriving.DepTyCheck.Gen import Data.Vect @@ -9,4 +10,5 @@ import Data.Vect %language ElabReflection -%runElab printDerived @{CallSelf} $ Fuel -> Gen MaybeEmpty (n : Nat ** a : Type ** Vect n a) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{CallSelf} $ Fuel -> Gen MaybeEmpty (n : Nat ** a : Type ** Vect n a) diff --git a/tests/derivation/infra/self print 008/PrintDerivation.idr b/tests/derivation/infra/self print 008/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/infra/self print 008/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/infra/self print 008/expected b/tests/derivation/infra/self print 008/expected index 4864ed647..632e63eed 100644 --- a/tests/derivation/infra/self print 008/expected +++ b/tests/derivation/infra/self print 008/expected @@ -1,8 +1,6 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (a : Type ** Vect n a)) -LOG gen.auto.derive.infra:0: +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (a : Type ** Vect n a)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/infra/self run 001/DerivedGen.idr b/tests/derivation/infra/self run 001/DerivedGen.idr index f927ee5de..694a37387 100644 --- a/tests/derivation/infra/self run 001/DerivedGen.idr +++ b/tests/derivation/infra/self run 001/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/self run 002/DerivedGen.idr b/tests/derivation/infra/self run 002/DerivedGen.idr index c306187fb..a8e0cac23 100644 --- a/tests/derivation/infra/self run 002/DerivedGen.idr +++ b/tests/derivation/infra/self run 002/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/self run 003/DerivedGen.idr b/tests/derivation/infra/self run 003/DerivedGen.idr index 33bfa8535..471f180b5 100644 --- a/tests/derivation/infra/self run 003/DerivedGen.idr +++ b/tests/derivation/infra/self run 003/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/self run 004/DerivedGen.idr b/tests/derivation/infra/self run 004/DerivedGen.idr index cdc0a73ef..ecb4649a2 100644 --- a/tests/derivation/infra/self run 004/DerivedGen.idr +++ b/tests/derivation/infra/self run 004/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/self run 005/DerivedGen.idr b/tests/derivation/infra/self run 005/DerivedGen.idr index e0255dd82..483e69d51 100644 --- a/tests/derivation/infra/self run 005/DerivedGen.idr +++ b/tests/derivation/infra/self run 005/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/self run 006/DerivedGen.idr b/tests/derivation/infra/self run 006/DerivedGen.idr index 0ec6ac988..abb29f24a 100644 --- a/tests/derivation/infra/self run 006/DerivedGen.idr +++ b/tests/derivation/infra/self run 006/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen %default total diff --git a/tests/derivation/infra/self run 007/DerivedGen.idr b/tests/derivation/infra/self run 007/DerivedGen.idr index 34780b198..ab9c7e2cc 100644 --- a/tests/derivation/infra/self run 007/DerivedGen.idr +++ b/tests/derivation/infra/self run 007/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/self run 008/DerivedGen.idr b/tests/derivation/infra/self run 008/DerivedGen.idr index ae584810e..4bb3af350 100644 --- a/tests/derivation/infra/self run 008/DerivedGen.idr +++ b/tests/derivation/infra/self run 008/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/self run 009/DerivedGen.idr b/tests/derivation/infra/self run 009/DerivedGen.idr index 9b93eb3df..4b91b4388 100644 --- a/tests/derivation/infra/self run 009/DerivedGen.idr +++ b/tests/derivation/infra/self run 009/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/infra/self run 010/DerivedGen.idr b/tests/derivation/infra/self run 010/DerivedGen.idr index 68cc8b0b2..eef405f0f 100644 --- a/tests/derivation/infra/self run 010/DerivedGen.idr +++ b/tests/derivation/infra/self run 010/DerivedGen.idr @@ -1,6 +1,8 @@ module DerivedGen import AlternativeCore + +import Deriving.DepTyCheck.Gen import RunDerivedGen import Data.Vect diff --git a/tests/derivation/least-effort/print/adt/001 trivial/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/001 trivial/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/001 trivial/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/001 trivial/DerivedGen.idr b/tests/derivation/least-effort/print/adt/001 trivial/DerivedGen.idr index 202e0e384..d438f61f6 100644 --- a/tests/derivation/least-effort/print/adt/001 trivial/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/001 trivial/DerivedGen.idr @@ -1,10 +1,10 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Unit +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Unit diff --git a/tests/derivation/least-effort/print/adt/001 trivial/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/001 trivial/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/001 trivial/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/001 trivial/expected b/tests/derivation/least-effort/print/adt/001 trivial/expected index 7c643cfb9..fdf376616 100644 --- a/tests/derivation/least-effort/print/adt/001 trivial/expected +++ b/tests/derivation/least-effort/print/adt/001 trivial/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty () -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty () MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/002 noparam/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/002 noparam/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/002 noparam/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/002 noparam/DerivedGen.idr b/tests/derivation/least-effort/print/adt/002 noparam/DerivedGen.idr index bd5f16e26..eb266dfee 100644 --- a/tests/derivation/least-effort/print/adt/002 noparam/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/002 noparam/DerivedGen.idr @@ -1,10 +1,10 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Bool +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Bool diff --git a/tests/derivation/least-effort/print/adt/002 noparam/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/002 noparam/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/002 noparam/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/002 noparam/expected b/tests/derivation/least-effort/print/adt/002 noparam/expected index ef8b124d3..830ea4f10 100644 --- a/tests/derivation/least-effort/print/adt/002 noparam/expected +++ b/tests/derivation/least-effort/print/adt/002 noparam/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Bool -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Bool MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/003 noparam/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/003 noparam/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/003 noparam/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/003 noparam/DerivedGen.idr b/tests/derivation/least-effort/print/adt/003 noparam/DerivedGen.idr index a8fe4be13..d0e80e601 100644 --- a/tests/derivation/least-effort/print/adt/003 noparam/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/003 noparam/DerivedGen.idr @@ -1,10 +1,10 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Nat +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Nat diff --git a/tests/derivation/least-effort/print/adt/003 noparam/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/003 noparam/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/003 noparam/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/003 noparam/expected b/tests/derivation/least-effort/print/adt/003 noparam/expected index a8897149b..6d91ede24 100644 --- a/tests/derivation/least-effort/print/adt/003 noparam/expected +++ b/tests/derivation/least-effort/print/adt/003 noparam/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Nat -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Nat MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/004 noparam/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/004 noparam/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/004 noparam/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/004 noparam/DerivedGen.idr b/tests/derivation/least-effort/print/adt/004 noparam/DerivedGen.idr index c2e5893ec..7fdeb9fae 100644 --- a/tests/derivation/least-effort/print/adt/004 noparam/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/004 noparam/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +10,5 @@ data X : Type where E : X R : X -> Nat -> X -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/adt/004 noparam/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/004 noparam/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/004 noparam/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/004 noparam/expected b/tests/derivation/least-effort/print/adt/004 noparam/expected index 6b7165e57..d1cf40ea6 100644 --- a/tests/derivation/least-effort/print/adt/004 noparam/expected +++ b/tests/derivation/least-effort/print/adt/004 noparam/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty X -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/005 param/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/005 param/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/005 param/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/005 param/DerivedGen.idr b/tests/derivation/least-effort/print/adt/005 param/DerivedGen.idr index 91dfd05f6..280de2665 100644 --- a/tests/derivation/least-effort/print/adt/005 param/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/005 param/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +9,5 @@ import PrintDerivation data X : Nat -> Type where MkX : X n -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> Gen MaybeEmpty $ X n +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> Gen MaybeEmpty $ X n diff --git a/tests/derivation/least-effort/print/adt/005 param/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/005 param/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/005 param/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/005 param/expected b/tests/derivation/least-effort/print/adt/005 param/expected index 39c757998..535ba4e03 100644 --- a/tests/derivation/least-effort/print/adt/005 param/expected +++ b/tests/derivation/least-effort/print/adt/005 param/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/least-effort/print/adt/006 param/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/006 param/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/006 param/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/006 param/DerivedGen.idr b/tests/derivation/least-effort/print/adt/006 param/DerivedGen.idr index ae23d2d01..6a8c898ca 100644 --- a/tests/derivation/least-effort/print/adt/006 param/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/006 param/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +9,5 @@ import PrintDerivation data X : Nat -> Type where MkX : X n -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** X n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** X n) diff --git a/tests/derivation/least-effort/print/adt/006 param/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/006 param/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/006 param/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/006 param/expected b/tests/derivation/least-effort/print/adt/006 param/expected index 590241e1b..7a6d17207 100644 --- a/tests/derivation/least-effort/print/adt/006 param/expected +++ b/tests/derivation/least-effort/print/adt/006 param/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/007 right-to-left simple/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/007 right-to-left simple/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/007 right-to-left simple/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/007 right-to-left simple/DerivedGen.idr b/tests/derivation/least-effort/print/adt/007 right-to-left simple/DerivedGen.idr index 88d9b7390..a470d2c59 100644 --- a/tests/derivation/least-effort/print/adt/007 right-to-left simple/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/007 right-to-left simple/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,4 +12,5 @@ data X : Nat -> Type where data Y : Type where MkY : {n : _} -> X n -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/adt/007 right-to-left simple/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/007 right-to-left simple/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/007 right-to-left simple/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/007 right-to-left simple/expected b/tests/derivation/least-effort/print/adt/007 right-to-left simple/expected index 99902817d..c64626f3e 100644 --- a/tests/derivation/least-effort/print/adt/007 right-to-left simple/expected +++ b/tests/derivation/least-effort/print/adt/007 right-to-left simple/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/008 right-to-left simple/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/008 right-to-left simple/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/008 right-to-left simple/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/008 right-to-left simple/DerivedGen.idr b/tests/derivation/least-effort/print/adt/008 right-to-left simple/DerivedGen.idr index 5101f0ed9..f89c53349 100644 --- a/tests/derivation/least-effort/print/adt/008 right-to-left simple/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/008 right-to-left simple/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,4 +12,5 @@ data X : Nat -> Type where data Y : Type where MkY : X n -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/adt/008 right-to-left simple/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/008 right-to-left simple/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/008 right-to-left simple/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/008 right-to-left simple/expected b/tests/derivation/least-effort/print/adt/008 right-to-left simple/expected index 99902817d..c64626f3e 100644 --- a/tests/derivation/least-effort/print/adt/008 right-to-left simple/expected +++ b/tests/derivation/least-effort/print/adt/008 right-to-left simple/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/009 left-to-right/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/009 left-to-right/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/009 left-to-right/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/009 left-to-right/DerivedGen.idr b/tests/derivation/least-effort/print/adt/009 left-to-right/DerivedGen.idr index 1ad7b0be4..13e836ca4 100644 --- a/tests/derivation/least-effort/print/adt/009 left-to-right/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/009 left-to-right/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,4 +12,5 @@ data X : Nat -> Type where data Y : Type where MkY : {n : _} -> X (n * 2) -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/adt/009 left-to-right/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/009 left-to-right/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/009 left-to-right/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/009 left-to-right/expected b/tests/derivation/least-effort/print/adt/009 left-to-right/expected index 73df6e27f..3bf59fae0 100644 --- a/tests/derivation/least-effort/print/adt/009 left-to-right/expected +++ b/tests/derivation/least-effort/print/adt/009 left-to-right/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/DerivedGen.idr b/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/DerivedGen.idr index 9952f7c21..b91ee3ecc 100644 --- a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,4 +12,5 @@ data X : Nat -> Nat -> Type where data Y : Type where MkY : X n m -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/expected b/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/expected index e71b4834e..28b3d7ab2 100644 --- a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/expected +++ b/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/DerivedGen.idr b/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/DerivedGen.idr index bf720fef4..5d22026f1 100644 --- a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,4 +12,5 @@ data X : Nat -> Unit -> Type where data Y : Type where MkY : X n m -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/expected b/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/expected index 0c547800c..4d56d2a43 100644 --- a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/expected +++ b/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/012 right-to-left chained/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/012 right-to-left chained/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/012 right-to-left chained/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/012 right-to-left chained/DerivedGen.idr b/tests/derivation/least-effort/print/adt/012 right-to-left chained/DerivedGen.idr index f4a3c8c65..5d4d9c1f5 100644 --- a/tests/derivation/least-effort/print/adt/012 right-to-left chained/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/012 right-to-left chained/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -16,4 +15,5 @@ data X2 : Nat -> Type where data Y : Type where MkY : X2 n -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/adt/012 right-to-left chained/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/012 right-to-left chained/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/012 right-to-left chained/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/012 right-to-left chained/expected b/tests/derivation/least-effort/print/adt/012 right-to-left chained/expected index 9ce8de8b5..b1111e603 100644 --- a/tests/derivation/least-effort/print/adt/012 right-to-left chained/expected +++ b/tests/derivation/least-effort/print/adt/012 right-to-left chained/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/013 right-to-left nondet/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/DerivedGen.idr b/tests/derivation/least-effort/print/adt/013 right-to-left nondet/DerivedGen.idr index 40597e555..c7f1c7ac1 100644 --- a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/013 right-to-left nondet/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,4 +12,5 @@ data X : Nat -> Nat -> Type where data Y : Type where MkY : X n m -> X n k -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/013 right-to-left nondet/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/expected b/tests/derivation/least-effort/print/adt/013 right-to-left nondet/expected index b7ecd7eb4..1c7187032 100644 --- a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/expected +++ b/tests/derivation/least-effort/print/adt/013 right-to-left nondet/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/AlternativeCore.idr b/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/DerivedGen.idr b/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/DerivedGen.idr index e85864bb9..74b70321f 100644 --- a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/DerivedGen.idr +++ b/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,4 +12,6 @@ data X : String -> Nat -> Type where data Y : Type where MkY : X n m -> X n k -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ + Fuel -> (Fuel -> Gen MaybeEmpty String) => (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/PrintDerivation.idr b/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/expected b/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/expected index d2d217c37..1665558d9 100644 --- a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/expected +++ b/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/least-effort/print/gadt/001 gadt/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/001 gadt/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/001 gadt/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/001 gadt/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/001 gadt/DerivedGen.idr index 40d0b0b29..54948df97 100644 --- a/tests/derivation/least-effort/print/gadt/001 gadt/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/001 gadt/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -9,4 +8,5 @@ import Data.Fin %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> Gen MaybeEmpty $ Fin n +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> Gen MaybeEmpty $ Fin n diff --git a/tests/derivation/least-effort/print/gadt/001 gadt/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/001 gadt/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/001 gadt/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/001 gadt/expected b/tests/derivation/least-effort/print/gadt/001 gadt/expected index b25b5018c..130d020b3 100644 --- a/tests/derivation/least-effort/print/gadt/001 gadt/expected +++ b/tests/derivation/least-effort/print/gadt/001 gadt/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (Fin n) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (Fin n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/least-effort/print/gadt/002 gadt/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/002 gadt/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/002 gadt/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/002 gadt/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/002 gadt/DerivedGen.idr index f004bc480..45fe04ce8 100644 --- a/tests/derivation/least-effort/print/gadt/002 gadt/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/002 gadt/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -9,4 +8,5 @@ import Data.Fin %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** Fin n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** Fin n) diff --git a/tests/derivation/least-effort/print/gadt/002 gadt/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/002 gadt/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/002 gadt/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/002 gadt/expected b/tests/derivation/least-effort/print/gadt/002 gadt/expected index ebe5d06df..0bfb458f5 100644 --- a/tests/derivation/least-effort/print/gadt/002 gadt/expected +++ b/tests/derivation/least-effort/print/gadt/002 gadt/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** Fin n) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** Fin n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/DerivedGen.idr index eb6cf7aea..713405d71 100644 --- a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -15,4 +14,5 @@ data Y : Type where MkY1 : X_GADT n m -> X_GADT n k -> Y MkY2 : X_GADT n m -> X_GADT k m -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/expected b/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/expected index b4d6bc272..66e220888 100644 --- a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/expected +++ b/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/gadt/004 right-to-left det/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/004 right-to-left det/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/004 right-to-left det/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/004 right-to-left det/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/004 right-to-left det/DerivedGen.idr index f305bb514..8e0d6746d 100644 --- a/tests/derivation/least-effort/print/gadt/004 right-to-left det/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/004 right-to-left det/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -20,4 +19,5 @@ data Y : Type where -- Should be generated right-to-left because of GADT on the right MkY_RL : X_ADT n m -> X_GADT n k -> Y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty Y diff --git a/tests/derivation/least-effort/print/gadt/004 right-to-left det/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/004 right-to-left det/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/004 right-to-left det/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/004 right-to-left det/expected b/tests/derivation/least-effort/print/gadt/004 right-to-left det/expected index da000ae97..90eac771c 100644 --- a/tests/derivation/least-effort/print/gadt/004 right-to-left det/expected +++ b/tests/derivation/least-effort/print/gadt/004 right-to-left det/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty Y -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/gadt/005 gadt/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/005 gadt/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/005 gadt/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/005 gadt/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/005 gadt/DerivedGen.idr index 0d0f8a64f..34daa1aed 100644 --- a/tests/derivation/least-effort/print/gadt/005 gadt/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/005 gadt/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,5 +12,6 @@ data D : Bool -> Type where TL : String -> D True TR : String -> D b -> D True -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty (b ** D b) diff --git a/tests/derivation/least-effort/print/gadt/005 gadt/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/005 gadt/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/005 gadt/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/005 gadt/expected b/tests/derivation/least-effort/print/gadt/005 gadt/expected index 79fb99a1f..c36018d30 100644 --- a/tests/derivation/least-effort/print/gadt/005 gadt/expected +++ b/tests/derivation/least-effort/print/gadt/005 gadt/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty (b : Bool ** D b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty (b : Bool ** D b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/least-effort/print/gadt/006 gadt/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/006 gadt/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/006 gadt/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/006 gadt/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/006 gadt/DerivedGen.idr index 87d0fde8e..9b3625fd3 100644 --- a/tests/derivation/least-effort/print/gadt/006 gadt/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/006 gadt/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -13,5 +12,6 @@ data D : Bool -> Type where TL : String -> D True TR : String -> D b -> D True -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => (Fuel -> Gen MaybeEmpty String) => (b : Bool) -> Gen MaybeEmpty $ D b diff --git a/tests/derivation/least-effort/print/gadt/006 gadt/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/006 gadt/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/006 gadt/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/006 gadt/expected b/tests/derivation/least-effort/print/gadt/006 gadt/expected index a0afbd896..69dbcaa47 100644 --- a/tests/derivation/least-effort/print/gadt/006 gadt/expected +++ b/tests/derivation/least-effort/print/gadt/006 gadt/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> (b : Bool) -> Gen MaybeEmpty (D b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> (b : Bool) -> Gen MaybeEmpty (D b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/least-effort/print/gadt/007 eq-n/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/007 eq-n/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/007 eq-n/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/007 eq-n/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/007 eq-n/DerivedGen.idr index c56ce79eb..814d0d989 100644 --- a/tests/derivation/least-effort/print/gadt/007 eq-n/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/007 eq-n/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +9,5 @@ import PrintDerivation data EqualN : Nat -> Nat -> Type where ReflN : EqualN x x -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (a ** b ** EqualN a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (a ** b ** EqualN a b) diff --git a/tests/derivation/least-effort/print/gadt/007 eq-n/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/007 eq-n/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/007 eq-n/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/007 eq-n/expected b/tests/derivation/least-effort/print/gadt/007 eq-n/expected index 4a2c5d0d4..29fea41fc 100644 --- a/tests/derivation/least-effort/print/gadt/007 eq-n/expected +++ b/tests/derivation/least-effort/print/gadt/007 eq-n/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (a : Nat ** (b : Nat ** EqualN a b)) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (a : Nat ** (b : Nat ** EqualN a b)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/gadt/008 eq-n/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/008 eq-n/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/008 eq-n/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/008 eq-n/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/008 eq-n/DerivedGen.idr index 0b0431fca..bfdde2106 100644 --- a/tests/derivation/least-effort/print/gadt/008 eq-n/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/008 eq-n/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +9,5 @@ import PrintDerivation data EqualN : Nat -> Nat -> Type where ReflN : EqualN x x -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Nat) -> Gen MaybeEmpty (b ** EqualN a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Nat) -> Gen MaybeEmpty (b ** EqualN a b) diff --git a/tests/derivation/least-effort/print/gadt/008 eq-n/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/008 eq-n/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/008 eq-n/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/008 eq-n/expected b/tests/derivation/least-effort/print/gadt/008 eq-n/expected index c09dcbce9..3264f7fdf 100644 --- a/tests/derivation/least-effort/print/gadt/008 eq-n/expected +++ b/tests/derivation/least-effort/print/gadt/008 eq-n/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Nat) -> Gen MaybeEmpty (b : Nat ** EqualN a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Nat) -> Gen MaybeEmpty (b : Nat ** EqualN a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/least-effort/print/gadt/009 eq-n/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/009 eq-n/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/009 eq-n/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/009 eq-n/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/009 eq-n/DerivedGen.idr index 2bd218a02..ac62817a9 100644 --- a/tests/derivation/least-effort/print/gadt/009 eq-n/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/009 eq-n/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +9,5 @@ import PrintDerivation data EqualN : Nat -> Nat -> Type where ReflN : EqualN x x -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (b : Nat) -> Gen MaybeEmpty (a ** EqualN a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (b : Nat) -> Gen MaybeEmpty (a ** EqualN a b) diff --git a/tests/derivation/least-effort/print/gadt/009 eq-n/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/009 eq-n/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/009 eq-n/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/009 eq-n/expected b/tests/derivation/least-effort/print/gadt/009 eq-n/expected index 4bea3639d..fa8d8cf51 100644 --- a/tests/derivation/least-effort/print/gadt/009 eq-n/expected +++ b/tests/derivation/least-effort/print/gadt/009 eq-n/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (b : Nat) -> Gen MaybeEmpty (a : Nat ** EqualN a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (b : Nat) -> Gen MaybeEmpty (a : Nat ** EqualN a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/least-effort/print/gadt/010 eq-n/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/010 eq-n/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/010 eq-n/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/010 eq-n/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/010 eq-n/DerivedGen.idr index 156e74605..512f66652 100644 --- a/tests/derivation/least-effort/print/gadt/010 eq-n/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/010 eq-n/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +9,5 @@ import PrintDerivation data EqualN : Nat -> Nat -> Type where ReflN : EqualN x x -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a, b : Nat) -> Gen MaybeEmpty $ EqualN a b +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a, b : Nat) -> Gen MaybeEmpty $ EqualN a b diff --git a/tests/derivation/least-effort/print/gadt/010 eq-n/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/010 eq-n/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/010 eq-n/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/010 eq-n/expected b/tests/derivation/least-effort/print/gadt/010 eq-n/expected index 5004a4d81..f712dd332 100644 --- a/tests/derivation/least-effort/print/gadt/010 eq-n/expected +++ b/tests/derivation/least-effort/print/gadt/010 eq-n/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Nat) -> (b : Nat) -> Gen MaybeEmpty (EqualN a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Nat) -> (b : Nat) -> Gen MaybeEmpty (EqualN a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/gadt/011 eq deepcons/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/011 eq deepcons/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/011 eq deepcons/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/011 eq deepcons/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/011 eq deepcons/DerivedGen.idr index 39abcaed4..41a64330d 100644 --- a/tests/derivation/least-effort/print/gadt/011 eq deepcons/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/011 eq deepcons/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +10,5 @@ data LT2 : Nat -> Nat -> Type where Base : x `LT2` S (S x) Step : x `LT2` y -> x `LT2` S y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty (a ** b ** LT2 a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty (a ** b ** LT2 a b) diff --git a/tests/derivation/least-effort/print/gadt/011 eq deepcons/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/011 eq deepcons/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/011 eq deepcons/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/011 eq deepcons/expected b/tests/derivation/least-effort/print/gadt/011 eq deepcons/expected index 91ef4015d..192fc7b89 100644 --- a/tests/derivation/least-effort/print/gadt/011 eq deepcons/expected +++ b/tests/derivation/least-effort/print/gadt/011 eq deepcons/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty (a : Nat ** (b : Nat ** LT2 a b)) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty Nat)} -> Gen MaybeEmpty (a : Nat ** (b : Nat ** LT2 a b)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW diff --git a/tests/derivation/least-effort/print/gadt/012 eq deepcons/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/012 eq deepcons/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/012 eq deepcons/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/012 eq deepcons/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/012 eq deepcons/DerivedGen.idr index d21093527..3afc9b6f6 100644 --- a/tests/derivation/least-effort/print/gadt/012 eq deepcons/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/012 eq deepcons/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +10,5 @@ data LT2 : Nat -> Nat -> Type where Base : x `LT2` S (S x) Step : x `LT2` y -> x `LT2` S y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Nat) -> Gen MaybeEmpty (b ** LT2 a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Nat) -> Gen MaybeEmpty (b ** LT2 a b) diff --git a/tests/derivation/least-effort/print/gadt/012 eq deepcons/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/012 eq deepcons/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/012 eq deepcons/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/012 eq deepcons/expected b/tests/derivation/least-effort/print/gadt/012 eq deepcons/expected index 5003f3937..d18fbf2e2 100644 --- a/tests/derivation/least-effort/print/gadt/012 eq deepcons/expected +++ b/tests/derivation/least-effort/print/gadt/012 eq deepcons/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Nat) -> Gen MaybeEmpty (b : Nat ** LT2 a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Nat) -> Gen MaybeEmpty (b : Nat ** LT2 a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/least-effort/print/gadt/013 eq deepcons/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/013 eq deepcons/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/013 eq deepcons/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/013 eq deepcons/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/013 eq deepcons/DerivedGen.idr index c3106bd02..f36073edc 100644 --- a/tests/derivation/least-effort/print/gadt/013 eq deepcons/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/013 eq deepcons/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +10,5 @@ data LT2 : Nat -> Nat -> Type where Base : x `LT2` S (S x) Step : x `LT2` y -> x `LT2` S y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (b : Nat) -> Gen MaybeEmpty (a ** LT2 a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (b : Nat) -> Gen MaybeEmpty (a ** LT2 a b) diff --git a/tests/derivation/least-effort/print/gadt/013 eq deepcons/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/013 eq deepcons/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/013 eq deepcons/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/013 eq deepcons/expected b/tests/derivation/least-effort/print/gadt/013 eq deepcons/expected index 1fafeefe4..3f1bec753 100644 --- a/tests/derivation/least-effort/print/gadt/013 eq deepcons/expected +++ b/tests/derivation/least-effort/print/gadt/013 eq deepcons/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (b : Nat) -> Gen MaybeEmpty (a : Nat ** LT2 a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (b : Nat) -> Gen MaybeEmpty (a : Nat ** LT2 a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/least-effort/print/gadt/014 eq deepcons/AlternativeCore.idr b/tests/derivation/least-effort/print/gadt/014 eq deepcons/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/gadt/014 eq deepcons/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/014 eq deepcons/DerivedGen.idr b/tests/derivation/least-effort/print/gadt/014 eq deepcons/DerivedGen.idr index d111b9eef..23510c2a9 100644 --- a/tests/derivation/least-effort/print/gadt/014 eq deepcons/DerivedGen.idr +++ b/tests/derivation/least-effort/print/gadt/014 eq deepcons/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -11,4 +10,5 @@ data LT2 : Nat -> Nat -> Type where Base : x `LT2` S (S x) Step : x `LT2` y -> x `LT2` S y -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a, b : Nat) -> Gen MaybeEmpty $ LT2 a b +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a, b : Nat) -> Gen MaybeEmpty $ LT2 a b diff --git a/tests/derivation/least-effort/print/gadt/014 eq deepcons/PrintDerivation.idr b/tests/derivation/least-effort/print/gadt/014 eq deepcons/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/gadt/014 eq deepcons/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/gadt/014 eq deepcons/expected b/tests/derivation/least-effort/print/gadt/014 eq deepcons/expected index d85a8a75f..2e60bcf52 100644 --- a/tests/derivation/least-effort/print/gadt/014 eq deepcons/expected +++ b/tests/derivation/least-effort/print/gadt/014 eq deepcons/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Nat) -> (b : Nat) -> Gen MaybeEmpty (LT2 a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Nat) -> (b : Nat) -> Gen MaybeEmpty (LT2 a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/dependent-givens-big/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/dependent-givens-big/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-big/DerivedGen.idr index aeaf0b5b2..c8446e81a 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-big/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/dependent-givens-big/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -63,4 +62,6 @@ namespace VectMaybeAnyType %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> (v : VectMaybeAnyType n) -> Gen MaybeEmpty (i ** t ** AtIndex n i t v) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ + Fuel -> (n : Nat) -> (v : VectMaybeAnyType n) -> Gen MaybeEmpty (i ** t ** AtIndex n i t v) diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/dependent-givens-big/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/dependent-givens-big/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/expected b/tests/derivation/least-effort/print/regression/dependent-givens-big/expected index 3d6c7e79e..a144b90b0 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-big/expected +++ b/tests/derivation/least-effort/print/regression/dependent-givens-big/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (v : VectMaybeAnyType n) -> Gen MaybeEmpty (i : Fin n ** (t : MaybeAnyType ** AtIndex n i t v)) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (v : VectMaybeAnyType n) -> Gen MaybeEmpty (i : Fin n ** (t : MaybeAnyType ** AtIndex n i t v)) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/DerivedGen.idr index 192202848..3ccfbb61b 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -12,4 +11,5 @@ data X : (n : Nat) -> Fin n -> Type where %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty $ X n f +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty $ X n f diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected b/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected index bd2c4785d..0d43d457f 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected +++ b/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty (X n f) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty (X n f) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/DerivedGen.idr index f05d5adea..2ada959bc 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -12,4 +11,5 @@ data X : (n : Nat) -> Fin n -> Type where %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty $ X n f +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty $ X n f diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected b/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected index d729941e8..12b4e1578 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected +++ b/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty (X n f) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty (X n f) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/fin-inc/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/fin-inc/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/fin-inc/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/fin-inc/DerivedGen.idr b/tests/derivation/least-effort/print/regression/fin-inc/DerivedGen.idr index a06aa8d8c..e8a337d19 100644 --- a/tests/derivation/least-effort/print/regression/fin-inc/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/fin-inc/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -12,4 +11,5 @@ record FinInc n where %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** FinInc n) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** FinInc n) diff --git a/tests/derivation/least-effort/print/regression/fin-inc/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/fin-inc/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/fin-inc/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/fin-inc/expected b/tests/derivation/least-effort/print/regression/fin-inc/expected index 6704d9098..c1f8a1dae 100644 --- a/tests/derivation/least-effort/print/regression/fin-inc/expected +++ b/tests/derivation/least-effort/print/regression/fin-inc/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** FinInc n) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** FinInc n) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/DerivedGen.idr b/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/DerivedGen.idr index d14906920..478b79c08 100644 --- a/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -10,5 +9,6 @@ data X : Nat -> Nat -> Nat -> Nat -> Type where %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (x1 : Nat) -> (x2 : Nat) -> (x3 : Nat) -> (x4 : Nat) -> Gen MaybeEmpty $ X x1 x2 x3 x4 diff --git a/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/expected b/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/expected index 5087bd90f..be2ffb8ef 100644 --- a/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/expected +++ b/tests/derivation/least-effort/print/regression/lost-deceq-four-occurences/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (x1 : Nat) -> (x2 : Nat) -> (x3 : Nat) -> (x4 : Nat) -> Gen MaybeEmpty (X x1 x2 x3 x4) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (x1 : Nat) -> (x2 : Nat) -> (x3 : Nat) -> (x4 : Nat) -> Gen MaybeEmpty (X x1 x2 x3 x4) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/DerivedGen.idr b/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/DerivedGen.idr index 829546dc0..da07fe1a9 100644 --- a/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -10,4 +9,5 @@ data X : Nat -> Nat -> Nat -> Type where %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (x1 : Nat) -> (x2 : Nat) -> (x3 : Nat) -> Gen MaybeEmpty $ X x1 x2 x3 +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (x1 : Nat) -> (x2 : Nat) -> (x3 : Nat) -> Gen MaybeEmpty $ X x1 x2 x3 diff --git a/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/expected b/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/expected index 9cfd8a0a3..175310f8f 100644 --- a/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/expected +++ b/tests/derivation/least-effort/print/regression/lost-deceq-three-occurences/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (x1 : Nat) -> (x2 : Nat) -> (x3 : Nat) -> Gen MaybeEmpty (X x1 x2 x3) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (x1 : Nat) -> (x2 : Nat) -> (x3 : Nat) -> Gen MaybeEmpty (X x1 x2 x3) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/DerivedGen.idr b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/DerivedGen.idr index 206913aca..8d84e6c8c 100644 --- a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -22,4 +21,5 @@ data Z : Type where data W : Z -> Z -> Type where MkW : W (MkZ (MkX n False) (MkX m False)) (MkZ (MkX n True) (MkX m True)) -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/expected b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/expected index 0a6bfff91..982aa6d11 100644 --- a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/expected +++ b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-complex/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/DerivedGen.idr b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/DerivedGen.idr index 0bd71a53b..a67ef6e3a 100644 --- a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -21,4 +20,5 @@ data Z : Type where data W : Z -> Z -> Type where MkW : W (MkZ (MkX n m False)) (MkZ (MkX n m True)) -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/expected b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/expected index 9139e0be1..35aa68636 100644 --- a/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/expected +++ b/tests/derivation/least-effort/print/regression/too-early-rename-multiple-simple/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/DerivedGen.idr b/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/DerivedGen.idr index 445a9e97c..1257fb467 100644 --- a/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -21,4 +20,5 @@ data Z : Type where data W : Z -> Z -> Type where MkW : W (MkZ (MkX n False)) (MkZ (MkX n True)) -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/expected b/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/expected index 82c0d975e..450dadd17 100644 --- a/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/expected +++ b/tests/derivation/least-effort/print/regression/too-early-rename-single-dependency/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Z) -> (b : Z) -> Gen MaybeEmpty (W a b) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/type-alias-gen-itself/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/type-alias-gen-itself/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/type-alias-gen-itself/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/type-alias-gen-itself/DerivedGen.idr b/tests/derivation/least-effort/print/regression/type-alias-gen-itself/DerivedGen.idr index 589a997bd..db21871c2 100644 --- a/tests/derivation/least-effort/print/regression/type-alias-gen-itself/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/type-alias-gen-itself/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -12,4 +11,5 @@ X = Bool %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen0 X +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen0 X diff --git a/tests/derivation/least-effort/print/regression/type-alias-gen-itself/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/type-alias-gen-itself/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/type-alias-gen-itself/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/type-alias-gen-itself/expected b/tests/derivation/least-effort/print/regression/type-alias-gen-itself/expected index b4dcbbac2..b4bb77a57 100644 --- a/tests/derivation/least-effort/print/regression/type-alias-gen-itself/expected +++ b/tests/derivation/least-effort/print/regression/type-alias-gen-itself/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen0 X -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen0 X MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/regression/type-alias-target-type/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/type-alias-target-type/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/type-alias-target-type/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/type-alias-target-type/DerivedGen.idr b/tests/derivation/least-effort/print/regression/type-alias-target-type/DerivedGen.idr index fe36b6466..b6084031f 100644 --- a/tests/derivation/least-effort/print/regression/type-alias-target-type/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/type-alias-target-type/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -12,4 +11,5 @@ X = Bool %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/regression/type-alias-target-type/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/type-alias-target-type/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/type-alias-target-type/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/type-alias-target-type/expected b/tests/derivation/least-effort/print/regression/type-alias-target-type/expected index 1dccc08aa..44d95731a 100644 --- a/tests/derivation/least-effort/print/regression/type-alias-target-type/expected +++ b/tests/derivation/least-effort/print/regression/type-alias-target-type/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> Gen MaybeEmpty X -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> local { decls = diff --git a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/DerivedGen.idr b/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/DerivedGen.idr index a11564702..4897b4e85 100644 --- a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -21,4 +20,5 @@ data Z : X -> X -> Type where %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (x : X) -> (x' : X) -> Gen MaybeEmpty $ Z x x' +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (x : X) -> (x' : X) -> Gen MaybeEmpty $ Z x x' diff --git a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/expected b/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/expected index dbb4089a9..f896d4019 100644 --- a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/expected +++ b/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (x : X) -> (x' : X) -> Gen MaybeEmpty (Z x x') -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (x : X) -> (x' : X) -> Gen MaybeEmpty (Z x x') MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/unification-name-mismatch/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/unification-name-mismatch/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/unification-name-mismatch/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/unification-name-mismatch/DerivedGen.idr b/tests/derivation/least-effort/print/regression/unification-name-mismatch/DerivedGen.idr index 67cc352d7..b55eb2fa3 100644 --- a/tests/derivation/least-effort/print/regression/unification-name-mismatch/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/unification-name-mismatch/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen %default total @@ -15,4 +14,5 @@ data Y : (xs : X) -> (ys : X) -> Type where A : Y (x :: xs) (x :: xs) B : Y xs ys -> Y (x :: xs) (y :: ys) -%runElab printDerived $ Fuel -> (xs : X) -> (ys : X) -> Gen MaybeEmpty $ Y xs ys +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter $ Fuel -> (xs : X) -> (ys : X) -> Gen MaybeEmpty $ Y xs ys diff --git a/tests/derivation/least-effort/print/regression/unification-name-mismatch/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/unification-name-mismatch/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/unification-name-mismatch/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/unification-name-mismatch/expected b/tests/derivation/least-effort/print/regression/unification-name-mismatch/expected index a04fb2f71..051eda979 100644 --- a/tests/derivation/least-effort/print/regression/unification-name-mismatch/expected +++ b/tests/derivation/least-effort/print/regression/unification-name-mismatch/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (xs : X) -> (ys : X) -> Gen MaybeEmpty (Y xs ys) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (xs : X) -> (ys : X) -> Gen MaybeEmpty (Y xs ys) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue diff --git a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/AlternativeCore.idr b/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/AlternativeCore.idr deleted file mode 120000 index 6da8d83f9..000000000 --- a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/AlternativeCore.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/DerivedGen.idr b/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/DerivedGen.idr index 92a5ad3aa..dfd74e08f 100644 --- a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/DerivedGen.idr +++ b/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/DerivedGen.idr @@ -1,7 +1,6 @@ module DerivedGen -import AlternativeCore -import PrintDerivation +import Deriving.DepTyCheck.Gen import Data.Fin @@ -23,4 +22,5 @@ mutual %language ElabReflection -%runElab printDerived @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (f : _) -> Gen MaybeEmpty (u ** Y u f) +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (f : _) -> Gen MaybeEmpty (u ** Y u f) diff --git a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/PrintDerivation.idr b/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/PrintDerivation.idr deleted file mode 120000 index 3724a195a..000000000 --- a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/PrintDerivation.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/PrintDerivation.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/expected b/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/expected index 56bac181e..e82c07f60 100644 --- a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/expected +++ b/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/expected @@ -1,8 +1,5 @@ -1/3: Building AlternativeCore (AlternativeCore.idr) -2/3: Building PrintDerivation (PrintDerivation.idr) -3/3: Building DerivedGen (DerivedGen.idr) -LOG gen.auto.derive.infra:0: type: (arg : Fuel) -> (f : X) -> Gen MaybeEmpty (u : () ** Y u f) -LOG gen.auto.derive.infra:0: +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (f : X) -> Gen MaybeEmpty (u : () ** Y u f) MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW ExplicitArg (Just "outer^") implicitTrue .=> local diff --git a/tests/derivation/utils/arg-deps/_common/Infra.idr b/tests/derivation/utils/arg-deps/_common/Infra.idr index a10fc95d0..60a2c6129 100644 --- a/tests/derivation/utils/arg-deps/_common/Infra.idr +++ b/tests/derivation/utils/arg-deps/_common/Infra.idr @@ -14,7 +14,7 @@ ppTy ty = do let (args, ret) = unPi expr deps <- map SortedSet.toList <$> argDeps args let expr' = piAll ret $ {piInfo := ExplicitArg} <$> args -- as if all arguments were explicit - logSugaredTerm "gen.auto.arg-deps" 0 "type " expr' - logMsg "gen.auto.arg-deps" 0 "dependencies: \{show deps}\n" + logSugaredTerm "deptycheck.arg-deps" 0 "type " expr' + logMsg "deptycheck.arg-deps" 0 "dependencies: \{show deps}\n" %runElab for_ listToCheck ppTy diff --git a/tests/derivation/utils/arg-deps/deps-001-simple/expected b/tests/derivation/utils/arg-deps/deps-001-simple/expected index 8981a043b..0a7274ce4 100644 --- a/tests/derivation/utils/arg-deps/deps-001-simple/expected +++ b/tests/derivation/utils/arg-deps/deps-001-simple/expected @@ -1,14 +1,14 @@ 1/2: Building DepsCheck (DepsCheck.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.arg-deps:0: type : () -LOG gen.auto.arg-deps:0: dependencies: [] +LOG deptycheck.arg-deps:0: type : () +LOG deptycheck.arg-deps:0: dependencies: [] -LOG gen.auto.arg-deps:0: type : (arg : Nat) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[]] +LOG deptycheck.arg-deps:0: type : (arg : Nat) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[]] -LOG gen.auto.arg-deps:0: type : (arg : Nat) -> (arg : Nat) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], []] +LOG deptycheck.arg-deps:0: type : (arg : Nat) -> (arg : Nat) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], []] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (arg : List a) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [0]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (arg : List a) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [0]] diff --git a/tests/derivation/utils/arg-deps/deps-002-longer-transitive/expected b/tests/derivation/utils/arg-deps/deps-002-longer-transitive/expected index 7fbaa2cd3..de98fb058 100644 --- a/tests/derivation/utils/arg-deps/deps-002-longer-transitive/expected +++ b/tests/derivation/utils/arg-deps/deps-002-longer-transitive/expected @@ -1,29 +1,29 @@ 1/2: Building DepsCheck (DepsCheck.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.arg-deps:0: type : (n : Nat) -> (a : Type) -> (arg : Vect n a) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [], [0, 1]] +LOG deptycheck.arg-deps:0: type : (n : Nat) -> (a : Type) -> (arg : Vect n a) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [], [0, 1]] -LOG gen.auto.arg-deps:0: type : (n : Nat) -> (a : Type) -> (v : Vect n a) -> (arg : length v = 5) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [], [0, 1], [0, 1, 2]] +LOG deptycheck.arg-deps:0: type : (n : Nat) -> (a : Type) -> (v : Vect n a) -> (arg : length v = 5) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [], [0, 1], [0, 1, 2]] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (xs : List a) -> (arg : Vect (length xs) a) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [0], [0, 1]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (xs : List a) -> (arg : Vect (length xs) a) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [0], [0, 1]] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (xs : List a) -> (v : Vect (length xs) a) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [0], [0, 1]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (xs : List a) -> (v : Vect (length xs) a) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [0], [0, 1]] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (xs : List a) -> (ys : List a) -> (arg : xs = ys) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [0], [0], [0, 1, 2]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (xs : List a) -> (ys : List a) -> (arg : xs = ys) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [0], [0], [0, 1, 2]] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (n : Nat) -> (m : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (arg : xs = ys) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [], [], [0, 1], [0, 2], [0, 1, 2, 3, 4]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (n : Nat) -> (m : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (arg : xs = ys) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [], [], [0, 1], [0, 2], [0, 1, 2, 3, 4]] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (n : Nat) -> (m : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (arg : xs = ys) -> (arg : List a) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [], [], [0, 1], [0, 2], [0, 1, 2, 3, 4], [0]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (n : Nat) -> (m : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (arg : xs = ys) -> (arg : List a) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [], [], [0, 1], [0, 2], [0, 1, 2, 3, 4], [0]] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (n : Nat) -> (m : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (arg : xs = ys) -> (arg : xs = []) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [], [], [0, 1], [0, 2], [0, 1, 2, 3, 4], [0, 1, 3]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (n : Nat) -> (m : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (arg : xs = ys) -> (arg : xs = []) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [], [], [0, 1], [0, 2], [0, 1, 2, 3, 4], [0, 1, 3]] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (n : Nat) -> (m : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (arg : xs = []) -> (arg : ys = []) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [], [], [0, 1], [0, 2], [0, 1, 3], [0, 2, 4]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (n : Nat) -> (m : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (arg : xs = []) -> (arg : ys = []) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [], [], [0, 1], [0, 2], [0, 1, 3], [0, 2, 4]] diff --git a/tests/derivation/utils/arg-deps/deps-003-lambda-shadowing/expected b/tests/derivation/utils/arg-deps/deps-003-lambda-shadowing/expected index e1317455c..fb3bf4ce5 100644 --- a/tests/derivation/utils/arg-deps/deps-003-lambda-shadowing/expected +++ b/tests/derivation/utils/arg-deps/deps-003-lambda-shadowing/expected @@ -1,11 +1,11 @@ 1/2: Building DepsCheck (DepsCheck.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.arg-deps:0: type : (x : Nat) -> (arg : \{x:0} => S {x:0} = S) -> () -LOG gen.auto.arg-deps:0: dependencies: [[], []] +LOG deptycheck.arg-deps:0: type : (x : Nat) -> (arg : \{x:0} => S {x:0} = S) -> () +LOG deptycheck.arg-deps:0: dependencies: [[], []] -LOG gen.auto.arg-deps:0: type : (x : Nat) -> (arg : \{x:0} => \{x:1} => S {x:1} = \{x:0} => S) -> () -LOG gen.auto.arg-deps:0: dependencies: [[], []] +LOG deptycheck.arg-deps:0: type : (x : Nat) -> (arg : \{x:0} => \{x:1} => S {x:1} = \{x:0} => S) -> () +LOG deptycheck.arg-deps:0: dependencies: [[], []] -LOG gen.auto.arg-deps:0: type : (x : Nat) -> (arg : \y => S y = S) -> () -LOG gen.auto.arg-deps:0: dependencies: [[], []] +LOG deptycheck.arg-deps:0: type : (x : Nat) -> (arg : \y => S y = S) -> () +LOG deptycheck.arg-deps:0: dependencies: [[], []] diff --git a/tests/derivation/utils/arg-deps/deps-004-case/expected b/tests/derivation/utils/arg-deps/deps-004-case/expected index 4d53cb966..41d31e3dc 100644 --- a/tests/derivation/utils/arg-deps/deps-004-case/expected +++ b/tests/derivation/utils/arg-deps/deps-004-case/expected @@ -1,8 +1,8 @@ 1/2: Building DepsCheck (DepsCheck.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.arg-deps:0: type : (a : Type) -> (xs : List a) -> (v : List a) -> (0 arg : case block in listToCheck a xs v) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [0], [0], [0, 2]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (xs : List a) -> (v : List a) -> (0 arg : case block in listToCheck a xs v) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [0], [0], [0, 2]] -LOG gen.auto.arg-deps:0: type : (a : Type) -> (xs : List a) -> (v : List a) -> (0 arg : case block in listToCheck a xs v) -> Nat -LOG gen.auto.arg-deps:0: dependencies: [[], [0], [0], [0, 2]] +LOG deptycheck.arg-deps:0: type : (a : Type) -> (xs : List a) -> (v : List a) -> (0 arg : case block in listToCheck a xs v) -> Nat +LOG deptycheck.arg-deps:0: dependencies: [[], [0], [0], [0, 2]] diff --git a/tests/derivation/utils/canonicsig/_common/Infra.idr b/tests/derivation/utils/canonicsig/_common/Infra.idr index 183e668e0..9fde9fb9c 100644 --- a/tests/derivation/utils/canonicsig/_common/Infra.idr +++ b/tests/derivation/utils/canonicsig/_common/Infra.idr @@ -40,7 +40,7 @@ caseVerdict (desc, given, expected) = do export logCheck : String -> Elab () -logCheck = \s => logMsg "gen.auto.canonic.check-sig" 0 s +logCheck = \s => logMsg "deptycheck.canonic.check-sig" 0 s export checkAndLog : TestCaseDesc -> Elab () diff --git a/tests/derivation/utils/canonicsig/dep-params/expected b/tests/derivation/utils/canonicsig/dep-params/expected index e37eeb869..bf57fd8db 100644 --- a/tests/derivation/utils/canonicsig/dep-params/expected +++ b/tests/derivation/utils/canonicsig/dep-params/expected @@ -1,8 +1,8 @@ 1/2: Building Infra (Infra.idr) 2/2: Building CanonicSigCheck (CanonicSigCheck.idr) -LOG gen.auto.canonic.check-sig:0: dependent type + mixed explicitness; all named; no givens: OKAY -LOG gen.auto.canonic.check-sig:0: dependent type + mixed explicitness; all named; no givens': OKAY -LOG gen.auto.canonic.check-sig:0: dependent type + mixed explicitness; all named; impl `a` given: OKAY -LOG gen.auto.canonic.check-sig:0: dependent type + mixed explicitness; all named; expl `n` given: OKAY -LOG gen.auto.canonic.check-sig:0: dependent type + mixed explicitness; all named; `a` and `n` given: OKAY -LOG gen.auto.canonic.check-sig:0: dependent type + mixed explicitness; all named; all given: OKAY +LOG deptycheck.canonic.check-sig:0: dependent type + mixed explicitness; all named; no givens: OKAY +LOG deptycheck.canonic.check-sig:0: dependent type + mixed explicitness; all named; no givens': OKAY +LOG deptycheck.canonic.check-sig:0: dependent type + mixed explicitness; all named; impl `a` given: OKAY +LOG deptycheck.canonic.check-sig:0: dependent type + mixed explicitness; all named; expl `n` given: OKAY +LOG deptycheck.canonic.check-sig:0: dependent type + mixed explicitness; all named; `a` and `n` given: OKAY +LOG deptycheck.canonic.check-sig:0: dependent type + mixed explicitness; all named; all given: OKAY diff --git a/tests/derivation/utils/canonicsig/nondep-expl-params/expected b/tests/derivation/utils/canonicsig/nondep-expl-params/expected index c1d398135..dc1b7008d 100644 --- a/tests/derivation/utils/canonicsig/nondep-expl-params/expected +++ b/tests/derivation/utils/canonicsig/nondep-expl-params/expected @@ -1,6 +1,6 @@ 1/2: Building Infra (Infra.idr) 2/2: Building CanonicSigCheck (CanonicSigCheck.idr) -LOG gen.auto.canonic.check-sig:0: non-dependent type + expl params; all named; no givens: OKAY -LOG gen.auto.canonic.check-sig:0: non-dependent type + expl params; all named; 1st given: OKAY -LOG gen.auto.canonic.check-sig:0: non-dependent type + expl params; all named; 2nd given: OKAY -LOG gen.auto.canonic.check-sig:0: non-dependent type + expl params; all named; both given: OKAY +LOG deptycheck.canonic.check-sig:0: non-dependent type + expl params; all named; no givens: OKAY +LOG deptycheck.canonic.check-sig:0: non-dependent type + expl params; all named; 1st given: OKAY +LOG deptycheck.canonic.check-sig:0: non-dependent type + expl params; all named; 2nd given: OKAY +LOG deptycheck.canonic.check-sig:0: non-dependent type + expl params; all named; both given: OKAY diff --git a/tests/derivation/utils/canonicsig/nondep-mixed-params/expected b/tests/derivation/utils/canonicsig/nondep-mixed-params/expected index 46c5a692c..fc6a54e01 100644 --- a/tests/derivation/utils/canonicsig/nondep-mixed-params/expected +++ b/tests/derivation/utils/canonicsig/nondep-mixed-params/expected @@ -1,6 +1,6 @@ 1/2: Building Infra (Infra.idr) 2/2: Building CanonicSigCheck (CanonicSigCheck.idr) -LOG gen.auto.canonic.check-sig:0: non-dependent type + mixed explicitness; all named; no givens: OKAY -LOG gen.auto.canonic.check-sig:0: non-dependent type + mixed explicitness; all named; 1st given: OKAY -LOG gen.auto.canonic.check-sig:0: non-dependent type + mixed explicitness; all named; 2nd given: OKAY -LOG gen.auto.canonic.check-sig:0: non-dependent type + mixed explicitness; all named; both given: OKAY +LOG deptycheck.canonic.check-sig:0: non-dependent type + mixed explicitness; all named; no givens: OKAY +LOG deptycheck.canonic.check-sig:0: non-dependent type + mixed explicitness; all named; 1st given: OKAY +LOG deptycheck.canonic.check-sig:0: non-dependent type + mixed explicitness; all named; 2nd given: OKAY +LOG deptycheck.canonic.check-sig:0: non-dependent type + mixed explicitness; all named; both given: OKAY diff --git a/tests/derivation/utils/canonicsig/trivial/expected b/tests/derivation/utils/canonicsig/trivial/expected index 05d6e6842..584179c44 100644 --- a/tests/derivation/utils/canonicsig/trivial/expected +++ b/tests/derivation/utils/canonicsig/trivial/expected @@ -1,3 +1,3 @@ 1/2: Building Infra (Infra.idr) 2/2: Building CanonicSigCheck (CanonicSigCheck.idr) -LOG gen.auto.canonic.check-sig:0: trivial type; no givens: OKAY +LOG deptycheck.canonic.check-sig:0: trivial type; no givens: OKAY diff --git a/tests/derivation/utils/cons-analysis/_common-deep-cons-app/Infra.idr b/tests/derivation/utils/cons-analysis/_common-deep-cons-app/Infra.idr index 2c93f7f49..e66feb66d 100644 --- a/tests/derivation/utils/cons-analysis/_common-deep-cons-app/Infra.idr +++ b/tests/derivation/utils/cons-analysis/_common-deep-cons-app/Infra.idr @@ -12,17 +12,17 @@ import Deriving.DepTyCheck.Gen.Core.Util printDeepConsApp : List Name -> TTImp -> Elab Unit printDeepConsApp freeNames tyExpr = do _ <- getNamesInfoInTypes' tyExpr - logMsg "gen.auto.deep-cons-app" 0 "" - logMsg "gen.auto.deep-cons-app" 0 "given free names: \{show freeNames}" - logSugaredTerm "gen.auto.deep-cons-app" 0 "original expression" tyExpr + logMsg "deptycheck.deep-cons-app" 0 "" + logMsg "deptycheck.deep-cons-app" 0 "given free names: \{show freeNames}" + logSugaredTerm "deptycheck.deep-cons-app" 0 "original expression" tyExpr let Right tyExpr = resolveNamesUniquely (fromList freeNames) tyExpr - | Left (n, alts) => logMsg "gen.auto.deep-cons-app" 0 "fail: name \{n} is not unique, alternatives: \{show alts}" - logSugaredTerm "gen.auto.deep-cons-app" 0 "resolved expression" tyExpr - logMsg "gen.auto.deep-cons-app" 0 "------------------------" + | Left (n, alts) => logMsg "deptycheck.deep-cons-app" 0 "fail: name \{n} is not unique, alternatives: \{show alts}" + logSugaredTerm "deptycheck.deep-cons-app" 0 "resolved expression" tyExpr + logMsg "deptycheck.deep-cons-app" 0 "------------------------" let Right (appliedNames ** bindExprF) = analyseDeepConsApp False (fromList freeNames) tyExpr - | Left err => logMsg "gen.auto.deep-cons-app" 0 "not a (deep) constructor application, reason: \{err}" - logMsg "gen.auto.deep-cons-app" 0 "applied names: \{show appliedNames}" + | Left err => logMsg "deptycheck.deep-cons-app" 0 "not a (deep) constructor application, reason: \{err}" + logMsg "deptycheck.deep-cons-app" 0 "applied names: \{show appliedNames}" let bindExpr = bindExprF $ \idx => bindVar $ show (index' appliedNames idx) ++ show idx - logSugaredTerm "gen.auto.deep-cons-app" 0 "bind expression" bindExpr + logSugaredTerm "deptycheck.deep-cons-app" 0 "bind expression" bindExpr %runElab consApps >>= traverse_ (uncurry printDeepConsApp) diff --git a/tests/derivation/utils/cons-analysis/deep-cons-app-001/expected b/tests/derivation/utils/cons-analysis/deep-cons-app-001/expected index 30022ef5a..75a4839d1 100644 --- a/tests/derivation/utils/cons-analysis/deep-cons-app-001/expected +++ b/tests/derivation/utils/cons-analysis/deep-cons-app-001/expected @@ -1,44 +1,44 @@ 1/2: Building ConsApps (ConsApps.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a] -LOG gen.auto.deep-cons-app:0: original expression: a -LOG gen.auto.deep-cons-app:0: resolved expression: a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a] -LOG gen.auto.deep-cons-app:0: bind expression: a0 -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: Nat -LOG gen.auto.deep-cons-app:0: resolved expression: Nat -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [] -LOG gen.auto.deep-cons-app:0: bind expression: Nat -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [Nat] -LOG gen.auto.deep-cons-app:0: original expression: Nat -LOG gen.auto.deep-cons-app:0: resolved expression: Nat -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [Nat] -LOG gen.auto.deep-cons-app:0: bind expression: Nat0 -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a] -LOG gen.auto.deep-cons-app:0: original expression: Vect n a -LOG gen.auto.deep-cons-app:0: resolved expression: Vect n a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [n, a] -LOG gen.auto.deep-cons-app:0: bind expression: Vect n0 a1 -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a] -LOG gen.auto.deep-cons-app:0: original expression: Either a a -LOG gen.auto.deep-cons-app:0: resolved expression: Either a a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a, a] -LOG gen.auto.deep-cons-app:0: bind expression: Either a0 a1 -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a, b] -LOG gen.auto.deep-cons-app:0: original expression: X a a -LOG gen.auto.deep-cons-app:0: resolved expression: X a a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a, a] -LOG gen.auto.deep-cons-app:0: bind expression: X a0 a1 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a] +LOG deptycheck.deep-cons-app:0: original expression: a +LOG deptycheck.deep-cons-app:0: resolved expression: a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a] +LOG deptycheck.deep-cons-app:0: bind expression: a0 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: Nat +LOG deptycheck.deep-cons-app:0: resolved expression: Nat +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [] +LOG deptycheck.deep-cons-app:0: bind expression: Nat +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [Nat] +LOG deptycheck.deep-cons-app:0: original expression: Nat +LOG deptycheck.deep-cons-app:0: resolved expression: Nat +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [Nat] +LOG deptycheck.deep-cons-app:0: bind expression: Nat0 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a] +LOG deptycheck.deep-cons-app:0: original expression: Vect n a +LOG deptycheck.deep-cons-app:0: resolved expression: Vect n a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [n, a] +LOG deptycheck.deep-cons-app:0: bind expression: Vect n0 a1 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a] +LOG deptycheck.deep-cons-app:0: original expression: Either a a +LOG deptycheck.deep-cons-app:0: resolved expression: Either a a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a, a] +LOG deptycheck.deep-cons-app:0: bind expression: Either a0 a1 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a, b] +LOG deptycheck.deep-cons-app:0: original expression: X a a +LOG deptycheck.deep-cons-app:0: resolved expression: X a a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a, a] +LOG deptycheck.deep-cons-app:0: bind expression: X a0 a1 diff --git a/tests/derivation/utils/cons-analysis/deep-cons-app-002-neg/expected b/tests/derivation/utils/cons-analysis/deep-cons-app-002-neg/expected index 7ebea5e90..823bc836d 100644 --- a/tests/derivation/utils/cons-analysis/deep-cons-app-002-neg/expected +++ b/tests/derivation/utils/cons-analysis/deep-cons-app-002-neg/expected @@ -1,56 +1,56 @@ 1/2: Building ConsApps (ConsApps.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a] -LOG gen.auto.deep-cons-app:0: original expression: b -LOG gen.auto.deep-cons-app:0: resolved expression: b -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `b` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: a -LOG gen.auto.deep-cons-app:0: resolved expression: a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `a` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: X a a -LOG gen.auto.deep-cons-app:0: resolved expression: X a a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `a` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [b] -LOG gen.auto.deep-cons-app:0: original expression: X a a -LOG gen.auto.deep-cons-app:0: resolved expression: X a a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `a` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a, b, X] -LOG gen.auto.deep-cons-app:0: original expression: X a a -LOG gen.auto.deep-cons-app:0: resolved expression: X a a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: applying free name to some arguments -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: Y -LOG gen.auto.deep-cons-app:0: resolved expression: Y -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Y` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a] -LOG gen.auto.deep-cons-app:0: original expression: Y -LOG gen.auto.deep-cons-app:0: resolved expression: Y -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Y` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a] -LOG gen.auto.deep-cons-app:0: original expression: Y a -LOG gen.auto.deep-cons-app:0: resolved expression: Y a -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Y` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a] -LOG gen.auto.deep-cons-app:0: original expression: Y a b -LOG gen.auto.deep-cons-app:0: resolved expression: Y a b -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Y` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a] +LOG deptycheck.deep-cons-app:0: original expression: b +LOG deptycheck.deep-cons-app:0: resolved expression: b +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `b` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: a +LOG deptycheck.deep-cons-app:0: resolved expression: a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `a` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: X a a +LOG deptycheck.deep-cons-app:0: resolved expression: X a a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `a` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [b] +LOG deptycheck.deep-cons-app:0: original expression: X a a +LOG deptycheck.deep-cons-app:0: resolved expression: X a a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `a` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a, b, X] +LOG deptycheck.deep-cons-app:0: original expression: X a a +LOG deptycheck.deep-cons-app:0: resolved expression: X a a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: applying free name to some arguments +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: Y +LOG deptycheck.deep-cons-app:0: resolved expression: Y +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Y` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a] +LOG deptycheck.deep-cons-app:0: original expression: Y +LOG deptycheck.deep-cons-app:0: resolved expression: Y +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Y` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a] +LOG deptycheck.deep-cons-app:0: original expression: Y a +LOG deptycheck.deep-cons-app:0: resolved expression: Y a +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Y` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a] +LOG deptycheck.deep-cons-app:0: original expression: Y a b +LOG deptycheck.deep-cons-app:0: resolved expression: Y a b +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Y` is not a constructor diff --git a/tests/derivation/utils/cons-analysis/deep-cons-app-003/expected b/tests/derivation/utils/cons-analysis/deep-cons-app-003/expected index 873792ce1..6e8722ad6 100644 --- a/tests/derivation/utils/cons-analysis/deep-cons-app-003/expected +++ b/tests/derivation/utils/cons-analysis/deep-cons-app-003/expected @@ -1,44 +1,44 @@ 1/2: Building ConsApps (ConsApps.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a] -LOG gen.auto.deep-cons-app:0: original expression: Vect n Nat -LOG gen.auto.deep-cons-app:0: resolved expression: Vect n Nat -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [n] -LOG gen.auto.deep-cons-app:0: bind expression: Vect n0 Nat -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n] -LOG gen.auto.deep-cons-app:0: original expression: Vect n Nat -LOG gen.auto.deep-cons-app:0: resolved expression: Vect n Nat -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [n] -LOG gen.auto.deep-cons-app:0: bind expression: Vect n0 Nat -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: Vect n (Either a b) -LOG gen.auto.deep-cons-app:0: resolved expression: Vect n (Either a b) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [n, a, b] -LOG gen.auto.deep-cons-app:0: bind expression: Vect n0 (Either a1 b2) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: Vect (S n) (Either a b) -LOG gen.auto.deep-cons-app:0: resolved expression: Vect (S n) (Either a b) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [n, a, b] -LOG gen.auto.deep-cons-app:0: bind expression: Vect (S n0) (Either a1 b2) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: Vect (S n) (Either a a) -LOG gen.auto.deep-cons-app:0: resolved expression: Vect (S n) (Either a a) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [n, a, a] -LOG gen.auto.deep-cons-app:0: bind expression: Vect (S n0) (Either a1 a2) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: Vect (S (S n)) (Either a (X a a)) -LOG gen.auto.deep-cons-app:0: resolved expression: Vect (S (S n)) (Either a (X a a)) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [n, a, a, a] -LOG gen.auto.deep-cons-app:0: bind expression: Vect (S (S n0)) (Either a1 (X a2 a3)) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a] +LOG deptycheck.deep-cons-app:0: original expression: Vect n Nat +LOG deptycheck.deep-cons-app:0: resolved expression: Vect n Nat +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [n] +LOG deptycheck.deep-cons-app:0: bind expression: Vect n0 Nat +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n] +LOG deptycheck.deep-cons-app:0: original expression: Vect n Nat +LOG deptycheck.deep-cons-app:0: resolved expression: Vect n Nat +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [n] +LOG deptycheck.deep-cons-app:0: bind expression: Vect n0 Nat +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: Vect n (Either a b) +LOG deptycheck.deep-cons-app:0: resolved expression: Vect n (Either a b) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [n, a, b] +LOG deptycheck.deep-cons-app:0: bind expression: Vect n0 (Either a1 b2) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: Vect (S n) (Either a b) +LOG deptycheck.deep-cons-app:0: resolved expression: Vect (S n) (Either a b) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [n, a, b] +LOG deptycheck.deep-cons-app:0: bind expression: Vect (S n0) (Either a1 b2) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: Vect (S n) (Either a a) +LOG deptycheck.deep-cons-app:0: resolved expression: Vect (S n) (Either a a) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [n, a, a] +LOG deptycheck.deep-cons-app:0: bind expression: Vect (S n0) (Either a1 a2) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: Vect (S (S n)) (Either a (X a a)) +LOG deptycheck.deep-cons-app:0: resolved expression: Vect (S (S n)) (Either a (X a a)) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [n, a, a, a] +LOG deptycheck.deep-cons-app:0: bind expression: Vect (S (S n0)) (Either a1 (X a2 a3)) diff --git a/tests/derivation/utils/cons-analysis/deep-cons-app-004/expected b/tests/derivation/utils/cons-analysis/deep-cons-app-004/expected index cbbadb300..25ccd991a 100644 --- a/tests/derivation/utils/cons-analysis/deep-cons-app-004/expected +++ b/tests/derivation/utils/cons-analysis/deep-cons-app-004/expected @@ -1,65 +1,65 @@ 1/2: Building ConsApps (ConsApps.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: XX (Right Unit) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Right ()) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Right ()) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a] -LOG gen.auto.deep-cons-app:0: original expression: XX (Right a) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Right a) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Right a0) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: XX (Right MkUnit) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Right ()) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Right ()) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: XX (Right []) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Right []) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Right []) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S Z) `MC` (S (S (S Z)) `MC` MM)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MM)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MM)))) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S n) `MC` (S (S (S Z)) `MC` MM)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (S (S n) `MC` (3 `MC` MM)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [n] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Left (1 `MC` (S (S n0) `MC` (3 `MC` MM)))) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S Z) `MC` (S (S (S Z)) `MC` MM)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MM)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MM)))) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b, c] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (a `MC` (b `MC` (c `MC` MM)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (a `MC` (b `MC` (c `MC` MM)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a, b, c] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Left (a0 `MC` (b1 `MC` (c2 `MC` MM)))) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b, c] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (a `MC` (Z `MC` (c `MC` MM)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (a `MC` (0 `MC` (c `MC` MM)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a, c] -LOG gen.auto.deep-cons-app:0: bind expression: XX (Left (a0 `MC` (0 `MC` (c1 `MC` MM)))) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: XX (Right Unit) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Right ()) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Right ()) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a] +LOG deptycheck.deep-cons-app:0: original expression: XX (Right a) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Right a) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Right a0) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: XX (Right MkUnit) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Right ()) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Right ()) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: XX (Right []) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Right []) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Right []) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S Z) `MC` (S (S (S Z)) `MC` MM)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MM)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MM)))) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S n) `MC` (S (S (S Z)) `MC` MM)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (S (S n) `MC` (3 `MC` MM)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [n] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Left (1 `MC` (S (S n0) `MC` (3 `MC` MM)))) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S Z) `MC` (S (S (S Z)) `MC` MM)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MM)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MM)))) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b, c] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (a `MC` (b `MC` (c `MC` MM)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (a `MC` (b `MC` (c `MC` MM)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a, b, c] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Left (a0 `MC` (b1 `MC` (c2 `MC` MM)))) +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b, c] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (a `MC` (Z `MC` (c `MC` MM)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (a `MC` (0 `MC` (c `MC` MM)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a, c] +LOG deptycheck.deep-cons-app:0: bind expression: XX (Left (a0 `MC` (0 `MC` (c1 `MC` MM)))) diff --git a/tests/derivation/utils/cons-analysis/deep-cons-app-005-neg/expected b/tests/derivation/utils/cons-analysis/deep-cons-app-005-neg/expected index 694cb784e..1e3d0fefa 100644 --- a/tests/derivation/utils/cons-analysis/deep-cons-app-005-neg/expected +++ b/tests/derivation/utils/cons-analysis/deep-cons-app-005-neg/expected @@ -1,50 +1,50 @@ 1/2: Building ConsApps (ConsApps.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: XX (Rigt Unit) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Rigt ()) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Rigt` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a] -LOG gen.auto.deep-cons-app:0: original expression: XX (Rigt a) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Rigt a) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Rigt` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: XX (Rigt MkUnit) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Rigt ()) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Rigt` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: XX (Rigt []) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Rigt []) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Rigt` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S Z) `MC` (S (S (S m)) `MC` MM)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (2 `MC` (S (S (S m)) `MC` MM)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `m` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S Z) `MC` (S (S (S Z)) `MC` MX)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MX)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `MX` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (a `MC` (b `MC` (c `MC` MM)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (a `MC` (b `MC` (c `MC` MM)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `c` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [n, a, b] -LOG gen.auto.deep-cons-app:0: original expression: XX (Left (a `MC` (Z `MC` (c `MC` MM)))) -LOG gen.auto.deep-cons-app:0: resolved expression: XX (Left (a `MC` (0 `MC` (c `MC` MM)))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `c` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: XX (Rigt Unit) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Rigt ()) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Rigt` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a] +LOG deptycheck.deep-cons-app:0: original expression: XX (Rigt a) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Rigt a) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Rigt` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: XX (Rigt MkUnit) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Rigt ()) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Rigt` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: XX (Rigt []) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Rigt []) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Rigt` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S Z) `MC` (S (S (S m)) `MC` MM)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (2 `MC` (S (S (S m)) `MC` MM)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `m` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (S Z `MC` (S (S Z) `MC` (S (S (S Z)) `MC` MX)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (1 `MC` (2 `MC` (3 `MC` MX)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `MX` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (a `MC` (b `MC` (c `MC` MM)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (a `MC` (b `MC` (c `MC` MM)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `c` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [n, a, b] +LOG deptycheck.deep-cons-app:0: original expression: XX (Left (a `MC` (Z `MC` (c `MC` MM)))) +LOG deptycheck.deep-cons-app:0: resolved expression: XX (Left (a `MC` (0 `MC` (c `MC` MM)))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `c` is not a constructor diff --git a/tests/derivation/utils/cons-analysis/deep-cons-app-006/expected b/tests/derivation/utils/cons-analysis/deep-cons-app-006/expected index c8e0b07de..04f68f468 100644 --- a/tests/derivation/utils/cons-analysis/deep-cons-app-006/expected +++ b/tests/derivation/utils/cons-analysis/deep-cons-app-006/expected @@ -1,64 +1,64 @@ 1/2: Building ConsApps (ConsApps.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [] -LOG gen.auto.deep-cons-app:0: original expression: Nat -LOG gen.auto.deep-cons-app:0: resolved expression: Nat -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [] -LOG gen.auto.deep-cons-app:0: bind expression: Nat -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [{arg:1}] -LOG gen.auto.deep-cons-app:0: original expression: Nat -LOG gen.auto.deep-cons-app:0: resolved expression: Nat -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [] -LOG gen.auto.deep-cons-app:0: bind expression: Nat -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [elem] -LOG gen.auto.deep-cons-app:0: original expression: Vect 0 elem -LOG gen.auto.deep-cons-app:0: resolved expression: Vect 0 elem -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [elem] -LOG gen.auto.deep-cons-app:0: bind expression: Vect 0 elem0 -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [len, elem, x, xs] -LOG gen.auto.deep-cons-app:0: original expression: Vect (S len) elem -LOG gen.auto.deep-cons-app:0: resolved expression: Vect (S len) elem -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [len, elem] -LOG gen.auto.deep-cons-app:0: bind expression: Vect (S len0) elem1 -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [{a:1053}] -LOG gen.auto.deep-cons-app:0: original expression: Split [] -LOG gen.auto.deep-cons-app:0: resolved expression: Split [] -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [{a:1053}, {a:1053}] -LOG gen.auto.deep-cons-app:0: bind expression: Split [] -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a, x] -LOG gen.auto.deep-cons-app:0: original expression: Split [x] -LOG gen.auto.deep-cons-app:0: resolved expression: Split [x] -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a, a, x, a] -LOG gen.auto.deep-cons-app:0: bind expression: Split [x2] -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a, x, xs, y, ys] -LOG gen.auto.deep-cons-app:0: original expression: Split (x :: (xs ++ (y :: ys))) -LOG gen.auto.deep-cons-app:0: resolved expression: Split (x :: (xs ++ (y :: ys))) -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: not a (deep) constructor application, reason: name `Prelude.Types.List.(++)` is not a constructor -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a, x] -LOG gen.auto.deep-cons-app:0: original expression: x = x -LOG gen.auto.deep-cons-app:0: resolved expression: x = x -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a, a, x, x] -LOG gen.auto.deep-cons-app:0: bind expression: x2 = x3 -LOG gen.auto.deep-cons-app:0: -LOG gen.auto.deep-cons-app:0: given free names: [a, x] -LOG gen.auto.deep-cons-app:0: original expression: EqExp a a x x -LOG gen.auto.deep-cons-app:0: resolved expression: EqExp a a x x -LOG gen.auto.deep-cons-app:0: ------------------------ -LOG gen.auto.deep-cons-app:0: applied names: [a, a, x, x] -LOG gen.auto.deep-cons-app:0: bind expression: EqExp a0 a1 x2 x3 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [] +LOG deptycheck.deep-cons-app:0: original expression: Nat +LOG deptycheck.deep-cons-app:0: resolved expression: Nat +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [] +LOG deptycheck.deep-cons-app:0: bind expression: Nat +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [{arg:1}] +LOG deptycheck.deep-cons-app:0: original expression: Nat +LOG deptycheck.deep-cons-app:0: resolved expression: Nat +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [] +LOG deptycheck.deep-cons-app:0: bind expression: Nat +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [elem] +LOG deptycheck.deep-cons-app:0: original expression: Vect 0 elem +LOG deptycheck.deep-cons-app:0: resolved expression: Vect 0 elem +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [elem] +LOG deptycheck.deep-cons-app:0: bind expression: Vect 0 elem0 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [len, elem, x, xs] +LOG deptycheck.deep-cons-app:0: original expression: Vect (S len) elem +LOG deptycheck.deep-cons-app:0: resolved expression: Vect (S len) elem +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [len, elem] +LOG deptycheck.deep-cons-app:0: bind expression: Vect (S len0) elem1 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [{a:1053}] +LOG deptycheck.deep-cons-app:0: original expression: Split [] +LOG deptycheck.deep-cons-app:0: resolved expression: Split [] +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [{a:1053}, {a:1053}] +LOG deptycheck.deep-cons-app:0: bind expression: Split [] +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a, x] +LOG deptycheck.deep-cons-app:0: original expression: Split [x] +LOG deptycheck.deep-cons-app:0: resolved expression: Split [x] +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a, a, x, a] +LOG deptycheck.deep-cons-app:0: bind expression: Split [x2] +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a, x, xs, y, ys] +LOG deptycheck.deep-cons-app:0: original expression: Split (x :: (xs ++ (y :: ys))) +LOG deptycheck.deep-cons-app:0: resolved expression: Split (x :: (xs ++ (y :: ys))) +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: not a (deep) constructor application, reason: name `Prelude.Types.List.(++)` is not a constructor +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a, x] +LOG deptycheck.deep-cons-app:0: original expression: x = x +LOG deptycheck.deep-cons-app:0: resolved expression: x = x +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a, a, x, x] +LOG deptycheck.deep-cons-app:0: bind expression: x2 = x3 +LOG deptycheck.deep-cons-app:0: +LOG deptycheck.deep-cons-app:0: given free names: [a, x] +LOG deptycheck.deep-cons-app:0: original expression: EqExp a a x x +LOG deptycheck.deep-cons-app:0: resolved expression: EqExp a a x x +LOG deptycheck.deep-cons-app:0: ------------------------ +LOG deptycheck.deep-cons-app:0: applied names: [a, a, x, x] +LOG deptycheck.deep-cons-app:0: bind expression: EqExp a0 a1 x2 x3 diff --git a/tests/derivation/utils/involved-types/_common-involved-types/Infra.idr b/tests/derivation/utils/involved-types/_common-involved-types/Infra.idr index 79f30f9c2..b8e74ec17 100644 --- a/tests/derivation/utils/involved-types/_common-involved-types/Infra.idr +++ b/tests/derivation/utils/involved-types/_common-involved-types/Infra.idr @@ -8,14 +8,14 @@ import Deriving.DepTyCheck.Gen.Core.Util printInvolvedTypesVerdict : Name -> Count -> List Name -> Elab Unit printInvolvedTypesVerdict tyName minRig expected = do - logMsg "gen.auto.involved-types" 0 "given type: \{show tyName}" + logMsg "deptycheck.involved-types" 0 "given type: \{show tyName}" invTys <- allInvolvedTypes minRig !(getInfo' tyName) let invTys = sortBy (comparing show) $ invTys <&> name expected <- for expected $ map TypeInfo.name . getInfo' let expected = sortBy (comparing show) expected when (invTys /= expected) $ do - logMsg "gen.auto.involved-types" 0 "-------- !!! --------" - logMsg "gen.auto.involved-types" 0 "found : \{show invTys}" - logMsg "gen.auto.involved-types" 0 "expected: \{show expected}" + logMsg "deptycheck.involved-types" 0 "-------- !!! --------" + logMsg "deptycheck.involved-types" 0 "found : \{show invTys}" + logMsg "deptycheck.involved-types" 0 "expected: \{show expected}" %runElab for_ typesAndInvolved $ \(n, r, ns) => printInvolvedTypesVerdict n r ns diff --git a/tests/derivation/utils/involved-types/norec-001/expected b/tests/derivation/utils/involved-types/norec-001/expected index 0c87999b2..03efd5349 100644 --- a/tests/derivation/utils/involved-types/norec-001/expected +++ b/tests/derivation/utils/involved-types/norec-001/expected @@ -1,10 +1,10 @@ 1/2: Building TypesAndInvolved (TypesAndInvolved.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.involved-types:0: given type: Bool -LOG gen.auto.involved-types:0: given type: Bool -LOG gen.auto.involved-types:0: given type: Bool -LOG gen.auto.involved-types:0: given type: Bool -LOG gen.auto.involved-types:0: given type: X -LOG gen.auto.involved-types:0: given type: X -LOG gen.auto.involved-types:0: given type: X -LOG gen.auto.involved-types:0: given type: X +LOG deptycheck.involved-types:0: given type: Bool +LOG deptycheck.involved-types:0: given type: Bool +LOG deptycheck.involved-types:0: given type: Bool +LOG deptycheck.involved-types:0: given type: Bool +LOG deptycheck.involved-types:0: given type: X +LOG deptycheck.involved-types:0: given type: X +LOG deptycheck.involved-types:0: given type: X +LOG deptycheck.involved-types:0: given type: X diff --git a/tests/derivation/utils/involved-types/rec-001/expected b/tests/derivation/utils/involved-types/rec-001/expected index 3ee689d0f..719477608 100644 --- a/tests/derivation/utils/involved-types/rec-001/expected +++ b/tests/derivation/utils/involved-types/rec-001/expected @@ -1,6 +1,6 @@ 1/2: Building TypesAndInvolved (TypesAndInvolved.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.involved-types:0: given type: Nat -LOG gen.auto.involved-types:0: given type: List -LOG gen.auto.involved-types:0: given type: Vect -LOG gen.auto.involved-types:0: given type: Vect +LOG deptycheck.involved-types:0: given type: Nat +LOG deptycheck.involved-types:0: given type: List +LOG deptycheck.involved-types:0: given type: Vect +LOG deptycheck.involved-types:0: given type: Vect diff --git a/tests/derivation/utils/involved-types/rec-002/expected b/tests/derivation/utils/involved-types/rec-002/expected index d5edff34f..d424e6131 100644 --- a/tests/derivation/utils/involved-types/rec-002/expected +++ b/tests/derivation/utils/involved-types/rec-002/expected @@ -1,4 +1,4 @@ 1/2: Building TypesAndInvolved (TypesAndInvolved.idr) 2/2: Building Infra (Infra.idr) -LOG gen.auto.involved-types:0: given type: X -LOG gen.auto.involved-types:0: given type: TTImp +LOG deptycheck.involved-types:0: given type: X +LOG deptycheck.involved-types:0: given type: TTImp diff --git a/tests/derivation/utils/up-to-renaming-ttimp-eq/_common/Infra.idr b/tests/derivation/utils/up-to-renaming-ttimp-eq/_common/Infra.idr index f7250f965..5a85f57a8 100644 --- a/tests/derivation/utils/up-to-renaming-ttimp-eq/_common/Infra.idr +++ b/tests/derivation/utils/up-to-renaming-ttimp-eq/_common/Infra.idr @@ -30,7 +30,7 @@ checkEq desc res e1 e2 = do e2 <- toTTImp e2 let ch1 : String -> TTImp -> TTImp -> Elab Unit ch1 desc l r = do - logMsg "gen.auto.reflection.ttimp-eq-up-to-renamings" 0 $ if (l == r) @{UpToRenaming} == res + logMsg "deptycheck.reflection.ttimp-eq-up-to-renamings" 0 $ if (l == r) @{UpToRenaming} == res then "\{desc}: OKAY" else """ \{desc}: FAILED diff --git a/tests/derivation/utils/up-to-renaming-ttimp-eq/renaming/expected b/tests/derivation/utils/up-to-renaming-ttimp-eq/renaming/expected index 7144c165e..e7b4781a2 100644 --- a/tests/derivation/utils/up-to-renaming-ttimp-eq/renaming/expected +++ b/tests/derivation/utils/up-to-renaming-ttimp-eq/renaming/expected @@ -1,130 +1,130 @@ 1/2: Building Infra (Infra.idr) 2/2: Building RenamingTTImpEqCheck (RenamingTTImpEqCheck.idr) -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused e (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused e (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused e (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused e (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused e (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused e (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused e (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused e (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused q (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused q (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused q (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused q (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused q (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused q (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused q (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused q (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, diff names (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: fst, rename, same names (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, diff names (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, rename, same names (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` q (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, `_` e (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: flipped lambda, unnamed (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: snd, shadow, rename (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused e (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused e (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused e (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused e (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused e (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused e (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused e (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused e (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused q (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused q (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused q (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused q (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused q (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused q (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused q (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused q (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unnamed unused' (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' e (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: _ unused' q (wrap case) <<: OKAY diff --git a/tests/derivation/utils/up-to-renaming-ttimp-eq/simple/expected b/tests/derivation/utils/up-to-renaming-ttimp-eq/simple/expected index 8caaa4265..eb593aca5 100644 --- a/tests/derivation/utils/up-to-renaming-ttimp-eq/simple/expected +++ b/tests/derivation/utils/up-to-renaming-ttimp-eq/simple/expected @@ -1,146 +1,146 @@ 1/2: Building Infra (Infra.idr) 2/2: Building RenamingTTImpEqCheck (RenamingTTImpEqCheck.idr) -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is zero (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is zero (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is zero (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is zero (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is zero (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is zero (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is zero (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is zero (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is not one (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is not one (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is not one (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is not one (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is not one (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is not one (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is not one (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: zero is not one (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is list (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is list (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is list (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is list (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is list (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is list (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is list (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is list (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is not vect (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is not vect (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is not vect (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is not vect (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is not vect (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is not vect (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is not vect (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: list is not vect (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is succ (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is succ (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is succ (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is succ (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is succ (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is succ (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is succ (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is succ (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (wrap case) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (plain) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (plain) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (ap z) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (ap z) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (ap cross) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (ap cross) <<: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (wrap case) >>: OKAY -LOG gen.auto.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not its value (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is zero (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is zero (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is zero (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is zero (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is zero (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is zero (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is zero (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is zero (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is not one (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is not one (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is not one (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is not one (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is not one (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is not one (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is not one (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: zero is not one (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: one (cons) is one (nat lit) (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat one is not integer one (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is list (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is list (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is list (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is list (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is list (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is list (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is list (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is list (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is not vect (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is not vect (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is not vect (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is not vect (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is not vect (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is not vect (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is not vect (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: list is not vect (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is succ (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is succ (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is succ (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is succ (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is succ (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is succ (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is succ (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is succ (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: succ is not zero (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is unit (ttimp) (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: unit is not some other `Unit` (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is nat id (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat id is not string id (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is nat fun ty (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: nat fun ty is not string fun ty (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is itself (wrap case) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (plain) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (plain) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (ap z) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (ap z) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (ap cross) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (ap cross) <<: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (wrap case) >>: OKAY +LOG deptycheck.reflection.ttimp-eq-up-to-renamings:0: dep ty fun is not another one (wrap case) <<: OKAY From e4d69ea2d576aa0f6cf3696e91195a15c690da96 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Sat, 31 Aug 2024 13:42:21 +0300 Subject: [PATCH 34/53] [ derive ] Support printing derived gens with Idris representation --- src/Deriving/DepTyCheck/Gen/Entry.idr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/Entry.idr b/src/Deriving/DepTyCheck/Gen/Entry.idr index 299598bc7..7ff973b99 100644 --- a/src/Deriving/DepTyCheck/Gen/Entry.idr +++ b/src/Deriving/DepTyCheck/Gen/Entry.idr @@ -374,15 +374,16 @@ deriveGenFor a = do ||| Declares `main : IO Unit` function that prints derived generator for the given generator's signature export -deriveGenPrinter : DerivatorCore => Type -> Elab Unit +deriveGenPrinter : {default True printTTImp : Bool} -> DerivatorCore => Type -> Elab Unit deriveGenPrinter ty = do ty <- quote ty logSugaredTerm "deptycheck.derive.print" DefaultLogLevel "type" ty expr <- deriveGenExpr ty expr <- quote expr + printTTImp <- quote printTTImp declare `[ main : IO Unit main = do - putStr $ interpolate ~(expr) + putStr $ if ~printTTImp then interpolate ~expr else show ~expr putStrLn "" ] From 165ce711ba4211da93f7b429913d939886acb3ce Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 2 Sep 2024 18:29:57 +0300 Subject: [PATCH 35/53] [ gen ] Add an associative binary composition fun merging alternatives --- src/Test/DepTyCheck/Gen.idr | 51 +++++++++++++++++++ .../distribution/_common/DistrCheckCommon.idr | 4 +- .../with-alts-deep-001/CheckDistribution.idr | 35 +++++++++++++ .../with-alts-deep-001/DistrCheckCommon.idr | 1 + .../distribution/with-alts-deep-001/expected | 1 + tests/lib/distribution/with-alts-deep-001/run | 1 + .../distribution/with-alts-deep-001/test.ipkg | 1 + .../CheckDistribution.idr | 37 ++++++++++++++ .../DistrCheckCommon.idr | 1 + .../with-alts-shallow-001/expected | 1 + .../distribution/with-alts-shallow-001/run | 1 + .../with-alts-shallow-001/test.ipkg | 1 + 12 files changed, 133 insertions(+), 2 deletions(-) create mode 100644 tests/lib/distribution/with-alts-deep-001/CheckDistribution.idr create mode 120000 tests/lib/distribution/with-alts-deep-001/DistrCheckCommon.idr create mode 100644 tests/lib/distribution/with-alts-deep-001/expected create mode 120000 tests/lib/distribution/with-alts-deep-001/run create mode 120000 tests/lib/distribution/with-alts-deep-001/test.ipkg create mode 100644 tests/lib/distribution/with-alts-shallow-001/CheckDistribution.idr create mode 120000 tests/lib/distribution/with-alts-shallow-001/DistrCheckCommon.idr create mode 100644 tests/lib/distribution/with-alts-shallow-001/expected create mode 120000 tests/lib/distribution/with-alts-shallow-001/run create mode 120000 tests/lib/distribution/with-alts-shallow-001/test.ipkg diff --git a/src/Test/DepTyCheck/Gen.idr b/src/Test/DepTyCheck/Gen.idr index 56e8a5d50..d14f37071 100644 --- a/src/Test/DepTyCheck/Gen.idr +++ b/src/Test/DepTyCheck/Gen.idr @@ -507,6 +507,15 @@ elements' xs = elements $ relaxF $ fromList $ toList xs --- Analysis of generators --- ------------------------------ +||| Shallow alternatives of a generator. +||| +||| If the given generator is made by one of `oneOf`, `frequency` or `elements`, +||| this function returns alternatives which this generators contains. +||| Otherwise it retuns a single-element alternative list containing given generator. +||| +||| In a sense, this function is a reverse function of `oneOf`, i.g. +||| `oneOf $ alternativesOf g` must be equivalent to `g` and +||| `alternativesof $ oneOf gs` must be equivalent to `gs`. export alternativesOf : {em : _} -> Gen em a -> GenAlternatives True em a alternativesOf $ OneOf oo = MkGenAlts $ unGenAlts $ mapOneOf oo relax @@ -585,6 +594,48 @@ export {em : _} -> Monad (GenAlternatives True em) where xs >>= f = flip processAlternatives' xs $ alternativesOf . (>>= oneOf . f) +---------------------------------------- +--- Additional composition functions --- +---------------------------------------- + +||| Associative composition of two generators, merging shallow alternatives of given two generators +||| +||| This operation being applied to arguments `a` and `b` is *not* the same as `oneOf [a, b]`. +||| Generator ``a `withAlts` b`` has equal probabilities of all shallow alternatives of generators `a` and `b`. +||| For example, when there are generators +||| ```idris +||| g1 = oneOf [elems [0, 1, 2, 3], elems [4, 5]] +||| g2 = oneOf elemts [10, 11, 12, 13, 14, 15] +||| ``` +||| generator ``g1 `withAlts` g2`` would be equivalent to +||| `oneOf [elems [0, 1, 2, 3], elems [4, 5], pure 10, pure 11, pure 12, pure 13, pure 14, pure 15]`. +||| +||| In other words, ``a `withAlts` b`` must be equivalent to `oneOf $ alternativesOf a ++ alternativesOf b`. +export %inline +withAlts : {em : _} -> Gen em a -> Gen em a -> Gen em a +a `withAlts` b = oneOf $ alternativesOf a ++ alternativesOf b + +-- As of `<|>` +export +infixr 2 `withAlts` + +||| Associative composition of two generators, merging deep alternatives of given two generators +||| +||| This operation being applied to arguments `a` and `b` is *not* the same as `oneOf [a, b]`. +||| Generator ``a `withDeepAlts` b`` has equal probabilities of all deep alternatives of generators `a` and `b`. +||| For example, when there are generators +||| ```idris +||| g1 = oneOf [elems [0, 1, 2, 3], elems [4, 5]] +||| g2 = oneOf elemts [10, 11, 12, 13, 14, 15] +||| ``` +||| generator ``withDeepAlts n g1 g2`` with `n >= 2` would be equivalent to +||| `oneOf elements [0, 1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]`. +||| +||| In other words, ``withDeepAlts d a b`` must be equivalent to `oneOf $ deepAlternativesOf d a ++ deepAlternativesOf d b`. +export %inline +withDeepAlts : {em : _} -> (depth : Nat) -> Gen em a -> Gen em a -> Gen em a +withDeepAlts depth a b = oneOf $ deepAlternativesOf depth a ++ deepAlternativesOf depth b + ----------------- --- Filtering --- ----------------- diff --git a/tests/lib/distribution/_common/DistrCheckCommon.idr b/tests/lib/distribution/_common/DistrCheckCommon.idr index 6029809f3..b66f524ca 100644 --- a/tests/lib/distribution/_common/DistrCheckCommon.idr +++ b/tests/lib/distribution/_common/DistrCheckCommon.idr @@ -17,12 +17,12 @@ find (x::xs) = case force xs of [] => Just x xs => if all isOk x then Just x else assert_total $ find xs -verdict : Vect n (CoverageTest a) -> Gen MaybeEmpty a -> Maybe $ Vect n SignificantBounds +verdict : Vect n (CoverageTest a) -> Gen em a -> Maybe $ Vect n SignificantBounds verdict conds = find . mapMaybe sequence . checkCoverageConditions conds . unGenTryN 10000000 someStdGen Show SignificantBounds where show = interpolate export -printVerdict : HasIO m => Gen MaybeEmpty a -> Vect n (CoverageTest a) -> m () +printVerdict : HasIO m => Gen em a -> Vect n (CoverageTest a) -> m () printVerdict = putStrLn .: show .: flip verdict diff --git a/tests/lib/distribution/with-alts-deep-001/CheckDistribution.idr b/tests/lib/distribution/with-alts-deep-001/CheckDistribution.idr new file mode 100644 index 000000000..5dec965ee --- /dev/null +++ b/tests/lib/distribution/with-alts-deep-001/CheckDistribution.idr @@ -0,0 +1,35 @@ +module CheckDistribution + +import Data.Either + +import DistrCheckCommon + +%default total + +g1 : Gen NonEmpty Nat +g1 = oneOf + [ elements [0, 1, 2, 3] + , elements [4, 5] + ] + +g2 : Gen NonEmpty Nat +g2 = elements [10, 11, 12, 13, 14, 15] + +g12 : Gen NonEmpty Nat +g12 = withDeepAlts 2 g1 g2 + +main : IO () +main = printVerdict g12 + [ coverWith 8.3.percent (== 0) + , coverWith 8.3.percent (== 1) + , coverWith 8.3.percent (== 2) + , coverWith 8.3.percent (== 3) + , coverWith 8.3.percent (== 4) + , coverWith 8.3.percent (== 5) + , coverWith 8.3.percent (== 10) + , coverWith 8.3.percent (== 11) + , coverWith 8.3.percent (== 12) + , coverWith 8.3.percent (== 13) + , coverWith 8.3.percent (== 14) + , coverWith 8.3.percent (== 15) + ] diff --git a/tests/lib/distribution/with-alts-deep-001/DistrCheckCommon.idr b/tests/lib/distribution/with-alts-deep-001/DistrCheckCommon.idr new file mode 120000 index 000000000..97b34ad55 --- /dev/null +++ b/tests/lib/distribution/with-alts-deep-001/DistrCheckCommon.idr @@ -0,0 +1 @@ +../_common/DistrCheckCommon.idr \ No newline at end of file diff --git a/tests/lib/distribution/with-alts-deep-001/expected b/tests/lib/distribution/with-alts-deep-001/expected new file mode 100644 index 000000000..672c4e48d --- /dev/null +++ b/tests/lib/distribution/with-alts-deep-001/expected @@ -0,0 +1 @@ +Just [ok, ok, ok, ok, ok, ok, ok, ok, ok, ok, ok, ok] diff --git a/tests/lib/distribution/with-alts-deep-001/run b/tests/lib/distribution/with-alts-deep-001/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/lib/distribution/with-alts-deep-001/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/lib/distribution/with-alts-deep-001/test.ipkg b/tests/lib/distribution/with-alts-deep-001/test.ipkg new file mode 120000 index 000000000..7297aae9f --- /dev/null +++ b/tests/lib/distribution/with-alts-deep-001/test.ipkg @@ -0,0 +1 @@ +../_common/test.ipkg \ No newline at end of file diff --git a/tests/lib/distribution/with-alts-shallow-001/CheckDistribution.idr b/tests/lib/distribution/with-alts-shallow-001/CheckDistribution.idr new file mode 100644 index 000000000..d19c4605e --- /dev/null +++ b/tests/lib/distribution/with-alts-shallow-001/CheckDistribution.idr @@ -0,0 +1,37 @@ +module CheckDistribution + +import Data.Either + +import DistrCheckCommon + +%default total + +g1 : Gen NonEmpty Nat +g1 = oneOf + [ elements [0, 1, 2, 3] + , elements [4, 5] + ] + +g2 : Gen NonEmpty Nat +g2 = elements [10, 11, 12, 13, 14, 15] + +g12 : Gen NonEmpty Nat +g12 = g1 `withAlts` g2 + +main : IO () +main = printVerdict g12 + [ coverWith 3.125.percent (== 0) + , coverWith 3.125.percent (== 1) + , coverWith 3.125.percent (== 2) + , coverWith 3.125.percent (== 3) + + , coverWith 6.25.percent (== 4) + , coverWith 6.25.percent (== 5) + + , coverWith 12.5.percent (== 10) + , coverWith 12.5.percent (== 11) + , coverWith 12.5.percent (== 12) + , coverWith 12.5.percent (== 13) + , coverWith 12.5.percent (== 14) + , coverWith 12.5.percent (== 15) + ] diff --git a/tests/lib/distribution/with-alts-shallow-001/DistrCheckCommon.idr b/tests/lib/distribution/with-alts-shallow-001/DistrCheckCommon.idr new file mode 120000 index 000000000..97b34ad55 --- /dev/null +++ b/tests/lib/distribution/with-alts-shallow-001/DistrCheckCommon.idr @@ -0,0 +1 @@ +../_common/DistrCheckCommon.idr \ No newline at end of file diff --git a/tests/lib/distribution/with-alts-shallow-001/expected b/tests/lib/distribution/with-alts-shallow-001/expected new file mode 100644 index 000000000..672c4e48d --- /dev/null +++ b/tests/lib/distribution/with-alts-shallow-001/expected @@ -0,0 +1 @@ +Just [ok, ok, ok, ok, ok, ok, ok, ok, ok, ok, ok, ok] diff --git a/tests/lib/distribution/with-alts-shallow-001/run b/tests/lib/distribution/with-alts-shallow-001/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/lib/distribution/with-alts-shallow-001/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/lib/distribution/with-alts-shallow-001/test.ipkg b/tests/lib/distribution/with-alts-shallow-001/test.ipkg new file mode 120000 index 000000000..7297aae9f --- /dev/null +++ b/tests/lib/distribution/with-alts-shallow-001/test.ipkg @@ -0,0 +1 @@ +../_common/test.ipkg \ No newline at end of file From a2dd24000ae1338d9dea4fc26deb587aecd55ba7 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 2 Sep 2024 20:10:12 +0300 Subject: [PATCH 36/53] [ gen ] Add more elegant analogue for `suchThat` for fuelled generators --- src/Test/DepTyCheck/Gen.idr | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/Test/DepTyCheck/Gen.idr b/src/Test/DepTyCheck/Gen.idr index d14f37071..af2dc5011 100644 --- a/src/Test/DepTyCheck/Gen.idr +++ b/src/Test/DepTyCheck/Gen.idr @@ -22,6 +22,8 @@ import Decidable.Equality import public Language.Implicits.IfUnsolved +import Syntax.WithProof + import public Test.DepTyCheck.Gen.Emptiness import public Test.DepTyCheck.Gen.Labels @@ -671,6 +673,37 @@ export suchThat_invertedEq : DecEq b => Gen em a -> (y : b) -> (f : a -> b) -> Gen0 $ Subset a $ \x => y = f x suchThat_invertedEq g y f = g `suchThat_dec` \x => y `decEq` f x +||| More elegant version of `suchThat_withPrf` for fuelled generators. +||| +||| Tries to repeat generation until there is some fuel, and fallback to `suchThat_withPrf` in case there isn't. +export +retryUntil_withPrf : (p : a -> Bool) -> (Fuel -> Gen em a) -> Fuel -> Gen0 $ a `Subset` So . p +retryUntil_withPrf p f Dry = f Dry `suchThat_withPrf` p +retryUntil_withPrf p f fl'@(More fl) = do + x <- relax $ f fl' + case @@ p x of + (True ** prf) => pure $ Element x $ eqToSo prf + (False ** _) => retryUntil_withPrf p f fl + +||| More elegant version of `suchThat` for fuelled generators. +||| +||| Tries to repeat generation until there is some fuel, and fallback to `suchThat` in case there isn't. +public export %inline +retryUntil : (p : a -> Bool) -> (Fuel -> Gen em a) -> Fuel -> Gen0 a +retryUntil p f = map fst . retryUntil_withPrf p f + +||| More elegant version of `suchThat_dec` for fuelled generators. +||| +||| Tries to repeat generation until there is some fuel, and fallback to `suchThat_dec` in case there isn't. +export +retryUntil_dec : (p : (x : a) -> Dec (prop x)) -> (Fuel -> Gen em a) -> Fuel -> Gen0 $ Subset a prop +retryUntil_dec p f Dry = f Dry `suchThat_dec` p +retryUntil_dec p f fl'@(More fl) = do + x <- relax $ f fl' + case p x of + Yes p => pure $ Element x p + No _ => retryUntil_dec p f fl + ------------------------------- --- Variation in generation --- ------------------------------- From b023a1d876499fbee6fdcdba8f06bc4bde0bd806 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 9 Sep 2024 15:31:23 +0300 Subject: [PATCH 37/53] [ gen ] Implement functions for picking one random generated value --- deptycheck.ipkg | 2 +- src/Test/DepTyCheck/Gen.idr | 18 +++++++++++++++++- tests/lib/gen-monad/pick-001/UseGen.idr | 17 +++++++++++++++++ tests/lib/gen-monad/pick-001/expected | 1 + tests/lib/gen-monad/pick-001/run | 6 ++++++ tests/lib/gen-monad/pick-001/use-gen.ipkg | 8 ++++++++ 6 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 tests/lib/gen-monad/pick-001/UseGen.idr create mode 100644 tests/lib/gen-monad/pick-001/expected create mode 100755 tests/lib/gen-monad/pick-001/run create mode 100644 tests/lib/gen-monad/pick-001/use-gen.ipkg diff --git a/deptycheck.ipkg b/deptycheck.ipkg index 5d15e2737..a4446c164 100644 --- a/deptycheck.ipkg +++ b/deptycheck.ipkg @@ -9,7 +9,7 @@ license = "MPL-2.0" sourcedir = "src" builddir = ".build" -version = 0.0.240724 +version = 0.0.240909 modules = Deriving.DepTyCheck , Deriving.DepTyCheck.Gen diff --git a/src/Test/DepTyCheck/Gen.idr b/src/Test/DepTyCheck/Gen.idr index af2dc5011..ecc05d295 100644 --- a/src/Test/DepTyCheck/Gen.idr +++ b/src/Test/DepTyCheck/Gen.idr @@ -8,11 +8,12 @@ import Control.Monad.State import public Control.Monad.State.Interface import Data.Bool +import public Data.CheckedEmpty.List.Lazy import Data.Fuel import public Data.Nat1 import Data.List import Data.List.Lazy -import public Data.CheckedEmpty.List.Lazy +import Data.List.Lazy.Extra import Data.Singleton import Data.SnocList import Data.Stream @@ -244,6 +245,11 @@ export unGenAll : RandomGen g => (seed : g) -> Gen1 a -> Stream a unGenAll = map snd .: unGenAll' +||| Picks one random value from a generator +export +pick1 : CanInitSeed g m => Functor m => Gen1 a -> m a +pick1 gen = initSeed <&> \s => evalRandom s $ unGen1 gen + --- Possibly empty generators --- export @@ -273,6 +279,16 @@ export unGenTryN : RandomGen g => (n : Nat) -> g -> Gen em a -> LazyList a unGenTryN n = mapMaybe id .: take (limit n) .: unGenTryAll +||| Tries once to pick a random value from a generator +export +pick : CanInitSeed g m => Functor m => Gen em a -> m $ Maybe a +pick gen = initSeed <&> \s => evalRandom s $ unGen' gen + +||| Tries to pick a random value from a generator, returning the number of unsuccessful attempts, if generated successfully +export +pickTryN : CanInitSeed g m => Functor m => (n : Nat) -> Gen em a -> m $ Maybe (Fin n, a) +pickTryN n g = initSeed <&> \s => head' (withIndex $ unGenTryN n s g) >>= \(i, x) => natToFin i n <&> (,x) + -- TODO To add config and Reader for that. -- This config should contain attempts count for each `unGen` (including those in combinators) -- Current `unGen` should be renamed to `unGen1` and not be exported. diff --git a/tests/lib/gen-monad/pick-001/UseGen.idr b/tests/lib/gen-monad/pick-001/UseGen.idr new file mode 100644 index 000000000..4debe9caf --- /dev/null +++ b/tests/lib/gen-monad/pick-001/UseGen.idr @@ -0,0 +1,17 @@ +module UseGen + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +gen : Gen MaybeEmpty (Nat, Nat) +gen = do + a <- elements [1 .. 100] + b <- elements [1 .. 100] + if a == b then pure () else empty + pure (a, b) + +main : IO Unit +main = printLn . map (\(a, b) => a == b) =<< pick gen diff --git a/tests/lib/gen-monad/pick-001/expected b/tests/lib/gen-monad/pick-001/expected new file mode 100644 index 000000000..3e69f58e1 --- /dev/null +++ b/tests/lib/gen-monad/pick-001/expected @@ -0,0 +1 @@ +Just True diff --git a/tests/lib/gen-monad/pick-001/run b/tests/lib/gen-monad/pick-001/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/gen-monad/pick-001/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/gen-monad/pick-001/use-gen.ipkg b/tests/lib/gen-monad/pick-001/use-gen.ipkg new file mode 100644 index 000000000..d71bc8f30 --- /dev/null +++ b/tests/lib/gen-monad/pick-001/use-gen.ipkg @@ -0,0 +1,8 @@ +package dummy + +authors = "Denis Buzdalov" + +main = UseGen +executable = use-gen + +depends = deptycheck From 7f5a59341cdfff09e8d6d44746cc22e0ce0b36dc Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 9 Sep 2024 18:57:05 +0300 Subject: [PATCH 38/53] [ test ] Add tests inspired by John Hughes' RGen example --- tests/Tests.idr | 1 + tests/lib/john-hughes/rgen-001/UseGen.idr | 25 +++++++++++++++ tests/lib/john-hughes/rgen-001/expected | 10 ++++++ tests/lib/john-hughes/rgen-001/run | 6 ++++ tests/lib/john-hughes/rgen-001/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-002/UseGen.idr | 30 ++++++++++++++++++ tests/lib/john-hughes/rgen-002/expected | 10 ++++++ tests/lib/john-hughes/rgen-002/run | 6 ++++ tests/lib/john-hughes/rgen-002/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-003/UseGen.idr | 31 +++++++++++++++++++ tests/lib/john-hughes/rgen-003/expected | 10 ++++++ tests/lib/john-hughes/rgen-003/run | 6 ++++ tests/lib/john-hughes/rgen-003/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-004/UseGen.idr | 32 +++++++++++++++++++ tests/lib/john-hughes/rgen-004/expected | 10 ++++++ tests/lib/john-hughes/rgen-004/run | 6 ++++ tests/lib/john-hughes/rgen-004/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-005/UseGen.idr | 30 ++++++++++++++++++ tests/lib/john-hughes/rgen-005/expected | 10 ++++++ tests/lib/john-hughes/rgen-005/run | 6 ++++ tests/lib/john-hughes/rgen-005/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-006/UseGen.idr | 33 ++++++++++++++++++++ tests/lib/john-hughes/rgen-006/expected | 10 ++++++ tests/lib/john-hughes/rgen-006/run | 6 ++++ tests/lib/john-hughes/rgen-006/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-007/UseGen.idr | 30 ++++++++++++++++++ tests/lib/john-hughes/rgen-007/expected | 10 ++++++ tests/lib/john-hughes/rgen-007/run | 6 ++++ tests/lib/john-hughes/rgen-007/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-008/UseGen.idr | 32 +++++++++++++++++++ tests/lib/john-hughes/rgen-008/expected | 10 ++++++ tests/lib/john-hughes/rgen-008/run | 6 ++++ tests/lib/john-hughes/rgen-008/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-009/UseGen.idr | 32 +++++++++++++++++++ tests/lib/john-hughes/rgen-009/expected | 10 ++++++ tests/lib/john-hughes/rgen-009/run | 6 ++++ tests/lib/john-hughes/rgen-009/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-010/UseGen.idr | 32 +++++++++++++++++++ tests/lib/john-hughes/rgen-010/expected | 10 ++++++ tests/lib/john-hughes/rgen-010/run | 6 ++++ tests/lib/john-hughes/rgen-010/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-011/UseGen.idr | 32 +++++++++++++++++++ tests/lib/john-hughes/rgen-011/expected | 10 ++++++ tests/lib/john-hughes/rgen-011/run | 6 ++++ tests/lib/john-hughes/rgen-011/use-gen.ipkg | 6 ++++ tests/lib/john-hughes/rgen-012/UseGen.idr | 34 +++++++++++++++++++++ tests/lib/john-hughes/rgen-012/expected | 10 ++++++ tests/lib/john-hughes/rgen-012/run | 6 ++++ tests/lib/john-hughes/rgen-012/use-gen.ipkg | 6 ++++ 49 files changed, 638 insertions(+) create mode 100644 tests/lib/john-hughes/rgen-001/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-001/expected create mode 100755 tests/lib/john-hughes/rgen-001/run create mode 100644 tests/lib/john-hughes/rgen-001/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-002/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-002/expected create mode 100755 tests/lib/john-hughes/rgen-002/run create mode 100644 tests/lib/john-hughes/rgen-002/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-003/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-003/expected create mode 100755 tests/lib/john-hughes/rgen-003/run create mode 100644 tests/lib/john-hughes/rgen-003/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-004/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-004/expected create mode 100755 tests/lib/john-hughes/rgen-004/run create mode 100644 tests/lib/john-hughes/rgen-004/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-005/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-005/expected create mode 100755 tests/lib/john-hughes/rgen-005/run create mode 100644 tests/lib/john-hughes/rgen-005/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-006/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-006/expected create mode 100755 tests/lib/john-hughes/rgen-006/run create mode 100644 tests/lib/john-hughes/rgen-006/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-007/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-007/expected create mode 100755 tests/lib/john-hughes/rgen-007/run create mode 100644 tests/lib/john-hughes/rgen-007/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-008/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-008/expected create mode 100755 tests/lib/john-hughes/rgen-008/run create mode 100644 tests/lib/john-hughes/rgen-008/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-009/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-009/expected create mode 100755 tests/lib/john-hughes/rgen-009/run create mode 100644 tests/lib/john-hughes/rgen-009/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-010/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-010/expected create mode 100755 tests/lib/john-hughes/rgen-010/run create mode 100644 tests/lib/john-hughes/rgen-010/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-011/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-011/expected create mode 100755 tests/lib/john-hughes/rgen-011/run create mode 100644 tests/lib/john-hughes/rgen-011/use-gen.ipkg create mode 100644 tests/lib/john-hughes/rgen-012/UseGen.idr create mode 100644 tests/lib/john-hughes/rgen-012/expected create mode 100755 tests/lib/john-hughes/rgen-012/run create mode 100644 tests/lib/john-hughes/rgen-012/use-gen.ipkg diff --git a/tests/Tests.idr b/tests/Tests.idr index e25579f81..bc01d0848 100644 --- a/tests/Tests.idr +++ b/tests/Tests.idr @@ -7,6 +7,7 @@ main = goldenRunner $ [ "The `Gen` monad" `atDir` "lib/gen-monad" , "Distribution of generators" `atDir` "lib/distribution" , "Model coverage" `atDir` "lib/coverage" + , "John Hughes-style tests" `atDir` "lib/john-hughes" , "The library documentation" `atDir` "docs" , "Derivation utils: TTImp equality up to renaming" `atDir` "derivation/utils/up-to-renaming-ttimp-eq" , "Derivation utils: canonic signature" `atDir` "derivation/utils/canonicsig" diff --git a/tests/lib/john-hughes/rgen-001/UseGen.idr b/tests/lib/john-hughes/rgen-001/UseGen.idr new file mode 100644 index 000000000..a87b84188 --- /dev/null +++ b/tests/lib/john-hughes/rgen-001/UseGen.idr @@ -0,0 +1,25 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-001/expected b/tests/lib/john-hughes/rgen-001/expected new file mode 100644 index 000000000..db414ea77 --- /dev/null +++ b/tests/lib/john-hughes/rgen-001/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 57, 6, 66] +[68, 94, 42, 45, 8, 25] +[75, 58, 86, 80, 74, 38] +[33, 69, 37, 18, 1, 21] +[99, 74, 42, 24, 41, 48] +[46, 64, 2, 60, 35, 72] +[75, 54, 46, 85, 76, 35] +[75, 39, 3, 51, 15, 78] +[14, 87, 51, 33, 19, 80] +[42, 21, 20, 56, 99, 29] diff --git a/tests/lib/john-hughes/rgen-001/run b/tests/lib/john-hughes/rgen-001/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-001/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-001/use-gen.ipkg b/tests/lib/john-hughes/rgen-001/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-001/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-002/UseGen.idr b/tests/lib/john-hughes/rgen-002/UseGen.idr new file mode 100644 index 000000000..18ab33b6f --- /dev/null +++ b/tests/lib/john-hughes/rgen-002/UseGen.idr @@ -0,0 +1,30 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ a == f + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-002/expected b/tests/lib/john-hughes/rgen-002/expected new file mode 100644 index 000000000..a63c4778e --- /dev/null +++ b/tests/lib/john-hughes/rgen-002/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 57, 6, 2] +[68, 94, 42, 45, 8, 68] +[75, 58, 86, 80, 74, 75] +[33, 69, 37, 18, 1, 33] +[99, 74, 42, 24, 41, 99] +[46, 64, 2, 60, 35, 46] +[75, 54, 46, 85, 76, 75] +[75, 39, 3, 51, 15, 75] +[14, 87, 51, 33, 19, 14] +[80, 42, 21, 20, 56, 80] diff --git a/tests/lib/john-hughes/rgen-002/run b/tests/lib/john-hughes/rgen-002/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-002/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-002/use-gen.ipkg b/tests/lib/john-hughes/rgen-002/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-002/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-003/UseGen.idr b/tests/lib/john-hughes/rgen-003/UseGen.idr new file mode 100644 index 000000000..7d585192d --- /dev/null +++ b/tests/lib/john-hughes/rgen-003/UseGen.idr @@ -0,0 +1,31 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ a == f + guard $ b == e + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-003/expected b/tests/lib/john-hughes/rgen-003/expected new file mode 100644 index 000000000..42e4daf8a --- /dev/null +++ b/tests/lib/john-hughes/rgen-003/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 57, 73, 2] +[68, 94, 42, 45, 94, 68] +[75, 58, 86, 80, 58, 75] +[33, 69, 37, 18, 69, 33] +[99, 74, 42, 24, 74, 99] +[41, 48, 46, 64, 48, 41] +[60, 35, 72, 75, 35, 60] +[85, 76, 35, 75, 76, 85] +[51, 15, 78, 14, 15, 51] +[33, 19, 80, 42, 19, 33] diff --git a/tests/lib/john-hughes/rgen-003/run b/tests/lib/john-hughes/rgen-003/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-003/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-003/use-gen.ipkg b/tests/lib/john-hughes/rgen-003/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-003/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-004/UseGen.idr b/tests/lib/john-hughes/rgen-004/UseGen.idr new file mode 100644 index 000000000..4a609a0ca --- /dev/null +++ b/tests/lib/john-hughes/rgen-004/UseGen.idr @@ -0,0 +1,32 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ a == f + guard $ b == e + guard $ c == d + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-004/expected b/tests/lib/john-hughes/rgen-004/expected new file mode 100644 index 000000000..50e323cfd --- /dev/null +++ b/tests/lib/john-hughes/rgen-004/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 21, 73, 2] +[66, 68, 94, 94, 68, 66] +[8, 25, 75, 75, 25, 8] +[74, 38, 33, 33, 38, 74] +[18, 1, 21, 21, 1, 18] +[42, 24, 41, 41, 24, 42] +[64, 2, 60, 60, 2, 64] +[75, 54, 46, 46, 54, 75] +[76, 35, 75, 75, 35, 76] +[15, 78, 14, 14, 78, 15] diff --git a/tests/lib/john-hughes/rgen-004/run b/tests/lib/john-hughes/rgen-004/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-004/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-004/use-gen.ipkg b/tests/lib/john-hughes/rgen-004/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-004/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-005/UseGen.idr b/tests/lib/john-hughes/rgen-005/UseGen.idr new file mode 100644 index 000000000..e0bf943d9 --- /dev/null +++ b/tests/lib/john-hughes/rgen-005/UseGen.idr @@ -0,0 +1,30 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ a == f && b == e && c == d + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-005/expected b/tests/lib/john-hughes/rgen-005/expected new file mode 100644 index 000000000..50e323cfd --- /dev/null +++ b/tests/lib/john-hughes/rgen-005/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 21, 73, 2] +[66, 68, 94, 94, 68, 66] +[8, 25, 75, 75, 25, 8] +[74, 38, 33, 33, 38, 74] +[18, 1, 21, 21, 1, 18] +[42, 24, 41, 41, 24, 42] +[64, 2, 60, 60, 2, 64] +[75, 54, 46, 46, 54, 75] +[76, 35, 75, 75, 35, 76] +[15, 78, 14, 14, 78, 15] diff --git a/tests/lib/john-hughes/rgen-005/run b/tests/lib/john-hughes/rgen-005/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-005/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-005/use-gen.ipkg b/tests/lib/john-hughes/rgen-005/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-005/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-006/UseGen.idr b/tests/lib/john-hughes/rgen-006/UseGen.idr new file mode 100644 index 000000000..f727b4710 --- /dev/null +++ b/tests/lib/john-hughes/rgen-006/UseGen.idr @@ -0,0 +1,33 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ a == f + guard $ b == e + guard $ c == d + guard $ c == 2 + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-006/expected b/tests/lib/john-hughes/rgen-006/expected new file mode 100644 index 000000000..988ae4adc --- /dev/null +++ b/tests/lib/john-hughes/rgen-006/expected @@ -0,0 +1,10 @@ +[2, 73, 2, 2, 73, 2] +[66, 68, 2, 2, 68, 66] +[45, 8, 2, 2, 8, 45] +[80, 74, 2, 2, 74, 80] +[18, 1, 2, 2, 1, 18] +[42, 24, 2, 2, 24, 42] +[46, 64, 2, 2, 64, 46] +[72, 75, 2, 2, 75, 72] +[76, 35, 2, 2, 35, 76] +[15, 78, 2, 2, 78, 15] diff --git a/tests/lib/john-hughes/rgen-006/run b/tests/lib/john-hughes/rgen-006/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-006/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-006/use-gen.ipkg b/tests/lib/john-hughes/rgen-006/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-006/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-007/UseGen.idr b/tests/lib/john-hughes/rgen-007/UseGen.idr new file mode 100644 index 000000000..084169833 --- /dev/null +++ b/tests/lib/john-hughes/rgen-007/UseGen.idr @@ -0,0 +1,30 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ a == f && b == e && c == d && c == 2 + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-007/expected b/tests/lib/john-hughes/rgen-007/expected new file mode 100644 index 000000000..988ae4adc --- /dev/null +++ b/tests/lib/john-hughes/rgen-007/expected @@ -0,0 +1,10 @@ +[2, 73, 2, 2, 73, 2] +[66, 68, 2, 2, 68, 66] +[45, 8, 2, 2, 8, 45] +[80, 74, 2, 2, 74, 80] +[18, 1, 2, 2, 1, 18] +[42, 24, 2, 2, 24, 42] +[46, 64, 2, 2, 64, 46] +[72, 75, 2, 2, 75, 72] +[76, 35, 2, 2, 35, 76] +[15, 78, 2, 2, 78, 15] diff --git a/tests/lib/john-hughes/rgen-007/run b/tests/lib/john-hughes/rgen-007/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-007/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-007/use-gen.ipkg b/tests/lib/john-hughes/rgen-007/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-007/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-008/UseGen.idr b/tests/lib/john-hughes/rgen-008/UseGen.idr new file mode 100644 index 000000000..09c8d7246 --- /dev/null +++ b/tests/lib/john-hughes/rgen-008/UseGen.idr @@ -0,0 +1,32 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ c == f + guard $ c == e + guard $ c == d + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-008/expected b/tests/lib/john-hughes/rgen-008/expected new file mode 100644 index 000000000..4fa6241ef --- /dev/null +++ b/tests/lib/john-hughes/rgen-008/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 21, 21, 21] +[66, 68, 94, 94, 94, 94] +[8, 25, 75, 75, 75, 75] +[74, 38, 33, 33, 33, 33] +[18, 1, 21, 21, 21, 21] +[42, 24, 41, 41, 41, 41] +[64, 2, 60, 60, 60, 60] +[75, 54, 46, 46, 46, 46] +[76, 35, 75, 75, 75, 75] +[15, 78, 14, 14, 14, 14] diff --git a/tests/lib/john-hughes/rgen-008/run b/tests/lib/john-hughes/rgen-008/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-008/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-008/use-gen.ipkg b/tests/lib/john-hughes/rgen-008/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-008/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-009/UseGen.idr b/tests/lib/john-hughes/rgen-009/UseGen.idr new file mode 100644 index 000000000..076f0cfba --- /dev/null +++ b/tests/lib/john-hughes/rgen-009/UseGen.idr @@ -0,0 +1,32 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ b == f + guard $ b == e + guard $ b == d + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-009/expected b/tests/lib/john-hughes/rgen-009/expected new file mode 100644 index 000000000..165b29aa4 --- /dev/null +++ b/tests/lib/john-hughes/rgen-009/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 73, 73, 73] +[66, 68, 94, 68, 68, 68] +[8, 25, 75, 25, 25, 25] +[74, 38, 33, 38, 38, 38] +[18, 1, 21, 1, 1, 1] +[42, 24, 41, 24, 24, 24] +[64, 2, 60, 2, 2, 2] +[75, 54, 46, 54, 54, 54] +[76, 35, 75, 35, 35, 35] +[15, 78, 14, 78, 78, 78] diff --git a/tests/lib/john-hughes/rgen-009/run b/tests/lib/john-hughes/rgen-009/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-009/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-009/use-gen.ipkg b/tests/lib/john-hughes/rgen-009/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-009/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-010/UseGen.idr b/tests/lib/john-hughes/rgen-010/UseGen.idr new file mode 100644 index 000000000..c0d8c7fdf --- /dev/null +++ b/tests/lib/john-hughes/rgen-010/UseGen.idr @@ -0,0 +1,32 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + guard $ b == d + e <- nums + guard $ b == e + f <- nums + guard $ b == f + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-010/expected b/tests/lib/john-hughes/rgen-010/expected new file mode 100644 index 000000000..165b29aa4 --- /dev/null +++ b/tests/lib/john-hughes/rgen-010/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 73, 73, 73] +[66, 68, 94, 68, 68, 68] +[8, 25, 75, 25, 25, 25] +[74, 38, 33, 38, 38, 38] +[18, 1, 21, 1, 1, 1] +[42, 24, 41, 24, 24, 24] +[64, 2, 60, 2, 2, 2] +[75, 54, 46, 54, 54, 54] +[76, 35, 75, 35, 35, 35] +[15, 78, 14, 78, 78, 78] diff --git a/tests/lib/john-hughes/rgen-010/run b/tests/lib/john-hughes/rgen-010/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-010/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-010/use-gen.ipkg b/tests/lib/john-hughes/rgen-010/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-010/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-011/UseGen.idr b/tests/lib/john-hughes/rgen-011/UseGen.idr new file mode 100644 index 000000000..e691626f3 --- /dev/null +++ b/tests/lib/john-hughes/rgen-011/UseGen.idr @@ -0,0 +1,32 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + c <- nums + d <- nums + e <- nums + f <- nums + guard $ a == f + guard $ a == e + guard $ a == d + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-011/expected b/tests/lib/john-hughes/rgen-011/expected new file mode 100644 index 000000000..c91b13303 --- /dev/null +++ b/tests/lib/john-hughes/rgen-011/expected @@ -0,0 +1,10 @@ +[2, 73, 21, 2, 2, 2] +[66, 68, 94, 66, 66, 66] +[8, 25, 75, 8, 8, 8] +[74, 38, 33, 74, 74, 74] +[18, 1, 21, 18, 18, 18] +[42, 24, 41, 42, 42, 42] +[64, 2, 60, 64, 64, 64] +[75, 54, 46, 75, 75, 75] +[76, 35, 75, 76, 76, 76] +[15, 78, 14, 15, 15, 15] diff --git a/tests/lib/john-hughes/rgen-011/run b/tests/lib/john-hughes/rgen-011/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-011/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-011/use-gen.ipkg b/tests/lib/john-hughes/rgen-011/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-011/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck diff --git a/tests/lib/john-hughes/rgen-012/UseGen.idr b/tests/lib/john-hughes/rgen-012/UseGen.idr new file mode 100644 index 000000000..08821e4ce --- /dev/null +++ b/tests/lib/john-hughes/rgen-012/UseGen.idr @@ -0,0 +1,34 @@ +module UseGen + +import Data.List.Lazy + +import Test.DepTyCheck.Gen + +import System.Random.Pure.StdGen + +%default total + +%cg chez lazy=weakMemo + +guard : Bool -> Gen0 () +guard True = pure () +guard False = empty + +fun : Gen0 $ List Int +fun = do + let nums = elements [1 .. 100] + a <- nums + b <- nums + guard $ a == b + c <- nums + guard $ a == c + d <- nums + guard $ a == d + e <- nums + guard $ a == e + f <- nums + guard $ a == f + pure [a, b, c, d, e, f] + +main : IO Unit +main = Lazy.traverse_ printLn $ unGenTryN 10 someStdGen fun diff --git a/tests/lib/john-hughes/rgen-012/expected b/tests/lib/john-hughes/rgen-012/expected new file mode 100644 index 000000000..4f201218b --- /dev/null +++ b/tests/lib/john-hughes/rgen-012/expected @@ -0,0 +1,10 @@ +[2, 2, 2, 2, 2, 2] +[66, 66, 66, 66, 66, 66] +[42, 42, 42, 42, 42, 42] +[58, 58, 58, 58, 58, 58] +[69, 69, 69, 69, 69, 69] +[21, 21, 21, 21, 21, 21] +[41, 41, 41, 41, 41, 41] +[2, 2, 2, 2, 2, 2] +[54, 54, 54, 54, 54, 54] +[35, 35, 35, 35, 35, 35] diff --git a/tests/lib/john-hughes/rgen-012/run b/tests/lib/john-hughes/rgen-012/run new file mode 100755 index 000000000..55f2037b5 --- /dev/null +++ b/tests/lib/john-hughes/rgen-012/run @@ -0,0 +1,6 @@ +rm -rf build + +flock "$1" pack -q install-deps use-gen.ipkg && \ +pack exec UseGen.idr + +rm -rf build diff --git a/tests/lib/john-hughes/rgen-012/use-gen.ipkg b/tests/lib/john-hughes/rgen-012/use-gen.ipkg new file mode 100644 index 000000000..7735f2ddb --- /dev/null +++ b/tests/lib/john-hughes/rgen-012/use-gen.ipkg @@ -0,0 +1,6 @@ +package test + +main = UseGen +executable = use-gen + +depends = deptycheck From 5681a7788ef982c3febc91c292d98054370d79e2 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 16 Sep 2024 23:09:32 +0300 Subject: [PATCH 39/53] [ test ] Make arg-deps tests be able to take `0`-quantified arguments --- .../utils/arg-deps/_common/Infra.idr | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/derivation/utils/arg-deps/_common/Infra.idr b/tests/derivation/utils/arg-deps/_common/Infra.idr index 60a2c6129..bb461c86f 100644 --- a/tests/derivation/utils/arg-deps/_common/Infra.idr +++ b/tests/derivation/utils/arg-deps/_common/Infra.idr @@ -8,13 +8,22 @@ import Language.Reflection.Compat %language ElabReflection -ppTy : Type -> Elab Unit -ppTy ty = do - expr <- quote ty - let (args, ret) = unPi expr - deps <- map SortedSet.toList <$> argDeps args - let expr' = piAll ret $ {piInfo := ExplicitArg} <$> args -- as if all arguments were explicit - logSugaredTerm "deptycheck.arg-deps" 0 "type " expr' - logMsg "deptycheck.arg-deps" 0 "dependencies: \{show deps}\n" +unlist : TTImp -> List TTImp +unlist e = do + let (_, [a, b]) = unApp e +-- | (IVar {}, []) => [] + | _ => [] + a :: unlist b -%runElab for_ listToCheck ppTy +ppTys : (0 _ : List Type) -> Elab Unit +ppTys tys = do + tys <- quote tys + let tys = unlist tys + for_ tys $ \expr => do + let (args, ret) = unPi expr + deps <- map SortedSet.toList <$> argDeps args + let expr' = piAll ret $ {piInfo := ExplicitArg} <$> args -- as if all arguments were explicit + logSugaredTerm "deptycheck.arg-deps" 0 "type " expr' + logMsg "deptycheck.arg-deps" 0 "dependencies: \{show deps}\n" + +%runElab ppTys listToCheck From 56c0dabbd0fbf0974740b2d823ca85fbacf991df Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 16 Sep 2024 20:31:06 +0300 Subject: [PATCH 40/53] [ derive ] Use much simpler (syntactic) arg dependencies calculation --- .../DepTyCheck/Gen/Core/ConsDerive.idr | 2 +- src/Deriving/DepTyCheck/Util/Reflection.idr | 111 ++---------------- .../utils/arg-deps/_common/Infra.idr | 2 +- .../arg-deps/deps-005-is-fs/DepsCheck.idr | 16 +++ .../utils/arg-deps/deps-005-is-fs/Infra.idr | 1 + .../arg-deps/deps-005-is-fs/arg-deps.ipkg | 1 + .../utils/arg-deps/deps-005-is-fs/expected | 8 ++ .../utils/arg-deps/deps-005-is-fs/run | 1 + 8 files changed, 41 insertions(+), 101 deletions(-) create mode 100644 tests/derivation/utils/arg-deps/deps-005-is-fs/DepsCheck.idr create mode 120000 tests/derivation/utils/arg-deps/deps-005-is-fs/Infra.idr create mode 120000 tests/derivation/utils/arg-deps/deps-005-is-fs/arg-deps.ipkg create mode 100644 tests/derivation/utils/arg-deps/deps-005-is-fs/expected create mode 120000 tests/derivation/utils/arg-deps/deps-005-is-fs/run diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index 9a2b712ea..ab20a3a2c 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -159,7 +159,7 @@ namespace NonObligatoryExts `(Prelude.pure {f=Test.DepTyCheck.Gen.Gen _} ~consExpr) -- Get dependencies of constructor's arguments - rawDeps <- argDeps con.args + let rawDeps = argDeps con.args let deps = downmap ((`difference` givs) . mapIn weakenToSuper) rawDeps ------------------------------------------------- diff --git a/src/Deriving/DepTyCheck/Util/Reflection.idr b/src/Deriving/DepTyCheck/Util/Reflection.idr index 30fbb9eb0..18e6fc7d2 100644 --- a/src/Deriving/DepTyCheck/Util/Reflection.idr +++ b/src/Deriving/DepTyCheck/Util/Reflection.idr @@ -316,105 +316,6 @@ extractTargetTyExpr ti = var ti.name typeCon : TypeInfo -> Con typeCon ti = MkCon ti.name ti.args type ----------------------------------------------- ---- Analyzing dependently typed signatures --- ----------------------------------------------- - -export -doesTypecheckAs : Elaboration m => (0 expected : Type) -> TTImp -> m Bool -doesTypecheckAs expected expr = try .| check {expected} expr $> True .| pure False - -export -argDeps : Elaboration m => (args : List Arg) -> m $ DVect args.length $ SortedSet . Fin . Fin.finToNat -argDeps args = do - ignore $ check {expected=Type} $ fullSig defaultRet -- we can't return trustful result if given arguments do not form a nice Pi type - concatMap depsOfOne range - - where - - %unbound_implicits off -- this is a workaround of https://github.com/idris-lang/Idris2/issues/2040 - - filteredArgs : (excluded : SortedSet $ Fin args.length) -> List Arg - filteredArgs excluded = filterI args $ \idx, _ => not $ contains idx excluded - - partialSig : (retTy : TTImp) -> (excluded : SortedSet $ Fin args.length) -> TTImp - partialSig retTy = piAll retTy . map {piInfo := ExplicitArg} . filteredArgs - - partialApp : (appliee : Name) -> (excluded : SortedSet $ Fin args.length) -> TTImp - partialApp n = appNames n . map argName . filteredArgs - - fullSig : (retTy : TTImp) -> TTImp - fullSig t = partialSig t empty - - fullApp : (appliee : Name) -> TTImp - fullApp n = partialApp n empty - - defaultRet : TTImp - defaultRet = `(Builtin.Unit) - - -- This is for check that *meaning* of types are preversed after excluding some of arguments - -- - -- Example: - -- Consider that `args` form the following: `(n : Nat) -> (a : Type) -> (v : Vect n a) -> (x : Nat) -> ...` - -- Consider we have `excluded` set containing only index 3 (the `x : Nat` argument). - -- For this case this function would return the following type: - -- ``` - -- (full : (n : Nat) -> (a : Type) -> (v : Vect n a) -> (x : Nat) -> Unit) -> - -- (part : (n : Nat) -> (a : Type) -> (v : Vect n a) -> Unit) -> - -- (n : Nat) -> (a : Type) -> (v : Vect n a) -> (x : Nat) -> - -- full n a v x = part n a v - -- ``` - -- As soon as this expression typechecks as `Type`, we are confident that - -- corresponding parameters of the full and the partial signatures are compatible, i.e. - -- removing of the parameters from `excluded` set does not change left types too much. - preservationCheckSig : (excluded : SortedSet $ Fin args.length) -> TTImp - preservationCheckSig excluded = - pi (MkArg MW ExplicitArg .| Just full .| fullSig defaultRet) $ - pi (MkArg MW ExplicitArg .| Just part .| partialSig defaultRet excluded) $ - fullSig $ - `(Builtin.Equal) .$ fullApp full .$ partialApp part excluded - where - full, part : Name - full = MN "full" 1 - part = MN "part" 1 - - checkExcluded : (excluded : SortedSet $ Fin args.length) -> m Bool - checkExcluded excluded = doesTypecheckAs Type (partialSig defaultRet excluded) - && doesTypecheckAs Type (preservationCheckSig excluded) - - -- Returns a set of indices of all arguments that do depend on the given - depsOfOne' : (idx : Fin args.length) -> m $ SortedSet $ Fin args.length - depsOfOne' idx = do - let cands = allGreaterThan idx - findMinExclude cands $ fromList cands - - where - -- tries to add candidates one by one, and leave them if typechecks without the current `idx` - findMinExclude : (left : List $ Fin args.length) -> (currExcl : SortedSet $ Fin args.length) -> m $ SortedSet $ Fin args.length - findMinExclude [] excl = pure excl - findMinExclude (x::xs) prevExcl = do - let currExcl = delete x prevExcl - findMinExclude xs $ if !(checkExcluded $ insert idx currExcl) then currExcl else prevExcl - - depsOfOne : Fin args.length -> m $ DVect args.length $ SortedSet . Fin . Fin.finToNat - depsOfOne idx = do - whoDependsOnIdx <- depsOfOne' idx - sequence $ tabulateI $ \i => - if contains i whoDependsOnIdx - then do - let Just dep = tryToFit idx - | Nothing => fail "INTERNAL ERROR: unable to fit fins during dependency calculation" - pure $ singleton dep - else pure empty - - %unbound_implicits on -- this is a workaround of https://github.com/idris-lang/Idris2/issues/2039 - - Semigroup a => Applicative f => Semigroup (f a) where - a <+> b = [| a <+> b |] - - Monoid a => Applicative f => Monoid (f a) where - neutral = pure neutral - ------------------------------------ --- Analysis of type definitions --- ------------------------------------ @@ -711,3 +612,15 @@ genTypeName g = do let (IVar _ genTy, _) = unApp genTy | (genTy, _) => failAt (getFC genTy) "Expected a type name" pure genTy + +---------------------------------------------- +--- Analyzing dependently typed signatures --- +---------------------------------------------- + +export +argDeps : (args : List Arg) -> DVect args.length $ SortedSet . Fin . Fin.finToNat +argDeps args = do + let nameToIndices = SortedMap.fromList $ mapI args $ \i, arg => (argName arg, SortedSet.singleton i) + let args = Vect.fromList args <&> \arg => allVarNames arg.type |> map (fromMaybe empty . lookup' nameToIndices) + flip upmapI args $ \i, argDeps => flip concatMap argDeps $ \candidates => + maybe empty singleton $ last' $ mapMaybe tryToFit $ SortedSet.toList candidates diff --git a/tests/derivation/utils/arg-deps/_common/Infra.idr b/tests/derivation/utils/arg-deps/_common/Infra.idr index bb461c86f..eab87c14b 100644 --- a/tests/derivation/utils/arg-deps/_common/Infra.idr +++ b/tests/derivation/utils/arg-deps/_common/Infra.idr @@ -21,7 +21,7 @@ ppTys tys = do let tys = unlist tys for_ tys $ \expr => do let (args, ret) = unPi expr - deps <- map SortedSet.toList <$> argDeps args + let deps = map SortedSet.toList $ argDeps args let expr' = piAll ret $ {piInfo := ExplicitArg} <$> args -- as if all arguments were explicit logSugaredTerm "deptycheck.arg-deps" 0 "type " expr' logMsg "deptycheck.arg-deps" 0 "dependencies: \{show deps}\n" diff --git a/tests/derivation/utils/arg-deps/deps-005-is-fs/DepsCheck.idr b/tests/derivation/utils/arg-deps/deps-005-is-fs/DepsCheck.idr new file mode 100644 index 000000000..d692a28e2 --- /dev/null +++ b/tests/derivation/utils/arg-deps/deps-005-is-fs/DepsCheck.idr @@ -0,0 +1,16 @@ +module DepsCheck + +import Data.Vect + +import Language.Reflection + +%macro +typeOf : Elaboration m => Name -> m $ List Type +typeOf n = map (mapMaybe id) $ for !(getType n) $ catch . check {expected=Type} . snd + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +export +0 listToCheck : List Type +listToCheck = typeOf `{ItIsFS} diff --git a/tests/derivation/utils/arg-deps/deps-005-is-fs/Infra.idr b/tests/derivation/utils/arg-deps/deps-005-is-fs/Infra.idr new file mode 120000 index 000000000..187efccc1 --- /dev/null +++ b/tests/derivation/utils/arg-deps/deps-005-is-fs/Infra.idr @@ -0,0 +1 @@ +../_common/Infra.idr \ No newline at end of file diff --git a/tests/derivation/utils/arg-deps/deps-005-is-fs/arg-deps.ipkg b/tests/derivation/utils/arg-deps/deps-005-is-fs/arg-deps.ipkg new file mode 120000 index 000000000..871cd8929 --- /dev/null +++ b/tests/derivation/utils/arg-deps/deps-005-is-fs/arg-deps.ipkg @@ -0,0 +1 @@ +../_common/arg-deps.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/arg-deps/deps-005-is-fs/expected b/tests/derivation/utils/arg-deps/deps-005-is-fs/expected new file mode 100644 index 000000000..74803608a --- /dev/null +++ b/tests/derivation/utils/arg-deps/deps-005-is-fs/expected @@ -0,0 +1,8 @@ +1/2: Building DepsCheck (DepsCheck.idr) +2/2: Building Infra (Infra.idr) +LOG deptycheck.arg-deps:0: type : (0 k : Nat) -> (0 i : Fin k) -> IsFS (S k) (FS i) +LOG deptycheck.arg-deps:0: dependencies: [[], [0]] + +LOG deptycheck.arg-deps:0: type : id +LOG deptycheck.arg-deps:0: dependencies: [] + diff --git a/tests/derivation/utils/arg-deps/deps-005-is-fs/run b/tests/derivation/utils/arg-deps/deps-005-is-fs/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/arg-deps/deps-005-is-fs/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From f5ad4057544ecfeeaf0f8dfd57ae64c5b619d6fc Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Fri, 13 Sep 2024 18:18:08 +0300 Subject: [PATCH 41/53] [ test ] Add infra test with dependency on a dependent type with `_` --- .../empty-cons print 015/AlternativeCore.idr | 1 + .../infra/empty-cons print 015/DerivedGen.idr | 18 +++++ .../empty-cons print 015/RunDerivedGen.idr | 1 + .../infra/empty-cons print 015/derive.ipkg | 1 + .../infra/empty-cons print 015/expected | 65 +++++++++++++++++++ .../derivation/infra/empty-cons print 015/run | 1 + .../empty-cons run 015/AlternativeCore.idr | 1 + .../infra/empty-cons run 015/DerivedGen.idr | 27 ++++++++ .../empty-cons run 015/RunDerivedGen.idr | 1 + .../infra/empty-cons run 015/derive.ipkg | 1 + .../infra/empty-cons run 015/expected | 6 ++ tests/derivation/infra/empty-cons run 015/run | 1 + 12 files changed, 124 insertions(+) create mode 120000 tests/derivation/infra/empty-cons print 015/AlternativeCore.idr create mode 100644 tests/derivation/infra/empty-cons print 015/DerivedGen.idr create mode 120000 tests/derivation/infra/empty-cons print 015/RunDerivedGen.idr create mode 120000 tests/derivation/infra/empty-cons print 015/derive.ipkg create mode 100644 tests/derivation/infra/empty-cons print 015/expected create mode 120000 tests/derivation/infra/empty-cons print 015/run create mode 120000 tests/derivation/infra/empty-cons run 015/AlternativeCore.idr create mode 100644 tests/derivation/infra/empty-cons run 015/DerivedGen.idr create mode 120000 tests/derivation/infra/empty-cons run 015/RunDerivedGen.idr create mode 120000 tests/derivation/infra/empty-cons run 015/derive.ipkg create mode 100644 tests/derivation/infra/empty-cons run 015/expected create mode 120000 tests/derivation/infra/empty-cons run 015/run diff --git a/tests/derivation/infra/empty-cons print 015/AlternativeCore.idr b/tests/derivation/infra/empty-cons print 015/AlternativeCore.idr new file mode 120000 index 000000000..6da8d83f9 --- /dev/null +++ b/tests/derivation/infra/empty-cons print 015/AlternativeCore.idr @@ -0,0 +1 @@ +../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 015/DerivedGen.idr b/tests/derivation/infra/empty-cons print 015/DerivedGen.idr new file mode 100644 index 000000000..3527726f4 --- /dev/null +++ b/tests/derivation/infra/empty-cons print 015/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import AlternativeCore + +import Deriving.DepTyCheck.Gen + +import Data.Vect + +%default total + +%language ElabReflection + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{EmptyCons} $ + Fuel -> {n : Nat} -> (v : Fin n) -> Gen MaybeEmpty $ IsFS n v diff --git a/tests/derivation/infra/empty-cons print 015/RunDerivedGen.idr b/tests/derivation/infra/empty-cons print 015/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/infra/empty-cons print 015/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 015/derive.ipkg b/tests/derivation/infra/empty-cons print 015/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/infra/empty-cons print 015/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons print 015/expected b/tests/derivation/infra/empty-cons print 015/expected new file mode 100644 index 000000000..d298dc8d9 --- /dev/null +++ b/tests/derivation/infra/empty-cons print 015/expected @@ -0,0 +1,65 @@ +1/2: Building AlternativeCore (AlternativeCore.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (v : Fin n) -> Gen MaybeEmpty (IsFS n v) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ImplicitArg (Just "outer^") implicitTrue +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}") + }) + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}") + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "^bnd^{k:3643}") + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ bindVar "i") + .= var "empty" + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.IsFS[0, 1] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^<{arg:1}>") + } + ] + ] + , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/infra/empty-cons print 015/run b/tests/derivation/infra/empty-cons print 015/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/infra/empty-cons print 015/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons run 015/AlternativeCore.idr b/tests/derivation/infra/empty-cons run 015/AlternativeCore.idr new file mode 120000 index 000000000..6da8d83f9 --- /dev/null +++ b/tests/derivation/infra/empty-cons run 015/AlternativeCore.idr @@ -0,0 +1 @@ +../_common/AlternativeCore.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons run 015/DerivedGen.idr b/tests/derivation/infra/empty-cons run 015/DerivedGen.idr new file mode 100644 index 000000000..7cad4fcb0 --- /dev/null +++ b/tests/derivation/infra/empty-cons run 015/DerivedGen.idr @@ -0,0 +1,27 @@ +module DerivedGen + +import AlternativeCore + +import Deriving.DepTyCheck.Gen +import RunDerivedGen + +import Data.Vect + +%default total + +%language ElabReflection + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +checkedGen : Fuel -> {n : Nat} -> (v : Fin n) -> Gen MaybeEmpty $ IsFS n v +checkedGen = deriveGen @{EmptyCons} + +Show (IsFS n a) where + show ItIsFS = "ItisFS" + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl {n=3} 2 + , G $ \fl => checkedGen fl {n=3} 0 + ] diff --git a/tests/derivation/infra/empty-cons run 015/RunDerivedGen.idr b/tests/derivation/infra/empty-cons run 015/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/infra/empty-cons run 015/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons run 015/derive.ipkg b/tests/derivation/infra/empty-cons run 015/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/infra/empty-cons run 015/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/infra/empty-cons run 015/expected b/tests/derivation/infra/empty-cons run 015/expected new file mode 100644 index 000000000..76f757b9a --- /dev/null +++ b/tests/derivation/infra/empty-cons run 015/expected @@ -0,0 +1,6 @@ +1/3: Building AlternativeCore (AlternativeCore.idr) +2/3: Building RunDerivedGen (RunDerivedGen.idr) +3/3: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- diff --git a/tests/derivation/infra/empty-cons run 015/run b/tests/derivation/infra/empty-cons run 015/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/infra/empty-cons run 015/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 639791648d205ca1ae4692efa6a2acaf3145cea6 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 16 Sep 2024 16:43:14 +0300 Subject: [PATCH 42/53] [ refactor ] Simplify some code in the derivator --- .../DepTyCheck/Gen/Core/ConsDerive.idr | 21 +++++++++---------- .../DepTyCheck/Gen/Core/ConsEntry.idr | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index ab20a3a2c..f39959e2f 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -85,8 +85,16 @@ namespace NonObligatoryExts argsTypeApps <- for con.args.asVect $ analyseTypeApp . type -- Decide how constructor arguments would be named during generation - let bindNames : Vect (con.args.length) String - bindNames = flip mapI .| fromList con.args .| \_ => bindNameRenamer . argName + let bindNames = fromList con.args <&> bindNameRenamer . argName + + -- Form the expression of calling the current constructor + let callCons = do + let constructorCall = callCon con $ bindNames <&> varStr + let wrapImpls : Nat -> TTImp + wrapImpls Z = constructorCall + wrapImpls (S n) = var `{Builtin.DPair.MkDPair} .$ implicitTrue .$ wrapImpls n + let consExpr = wrapImpls $ sig.targetType.args.length `minus` sig.givenParams.size + `(Prelude.pure {f=Test.DepTyCheck.Gen.Gen _} ~consExpr) -- Derive constructor calling expression for given order of generation let genForOrder : List (Fin con.args.length) -> m TTImp @@ -149,15 +157,6 @@ namespace NonObligatoryExts -- Chain the subgen call with a given continuation pure $ \cont => `(~subgenCall >>= ~(bindRHS cont)) - callCons : TTImp - callCons = do - let constructorCall = callCon con $ bindNames <&> varStr - let wrapImpls : Nat -> TTImp - wrapImpls Z = constructorCall - wrapImpls (S n) = var `{Builtin.DPair.MkDPair} .$ implicitTrue .$ wrapImpls n - let consExpr = wrapImpls $ sig.targetType.args.length `minus` sig.givenParams.size - `(Prelude.pure {f=Test.DepTyCheck.Gen.Gen _} ~consExpr) - -- Get dependencies of constructor's arguments let rawDeps = argDeps con.args let deps = downmap ((`difference` givs) . mapIn weakenToSuper) rawDeps diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsEntry.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsEntry.idr index 9ab498563..45d369ace 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsEntry.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsEntry.idr @@ -66,7 +66,7 @@ canonicConsBody sig name con = do renamedAppliedNames <- for appliedNames.asVect $ \(name, typeDetermined) => do let bindName = bindNameRenamer name if cast typeDetermined - then pure $ const `(_) -- no need to match type-determined parameter by hand + then pure $ const implicitTrue -- no need to match type-determined parameter by hand else if contains name !get then do -- I'm using a name containing chars that cannot be present in the code parsed from the Idris frontend From c7a96606944e1aa48cde2970ae00cb7297ad1f63 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 16 Sep 2024 17:52:51 +0300 Subject: [PATCH 43/53] [ refactor ] Remove useless intermediate function --- .../DepTyCheck/Gen/Core/ConsDerive.idr | 84 +++++++++---------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index f39959e2f..d9cbac54a 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -98,64 +98,58 @@ namespace NonObligatoryExts -- Derive constructor calling expression for given order of generation let genForOrder : List (Fin con.args.length) -> m TTImp - genForOrder order = foldr apply callCons <$> evalStateT givs (for order genForOneArg) where + -- ... state is the set of arguments that are already present (given or generated) + genForOrder order = map (foldr apply callCons) $ evalStateT givs $ for order $ \genedArg => do - -- ... state is the set of arguments that are already present (given or generated) - genForOneArg : forall m. - CanonicGen m => - MonadState (SortedSet $ Fin con.args.length) m => - (gened : Fin con.args.length) -> m $ TTImp -> TTImp - genForOneArg genedArg = do + -- Get info for the `genedArg` + let MkTypeApp typeOfGened argsOfTypeOfGened = index genedArg $ the (Vect _ TypeApp) argsTypeApps - -- Get info for the `genedArg` - let MkTypeApp typeOfGened argsOfTypeOfGened = index genedArg $ the (Vect _ TypeApp) argsTypeApps + -- Acquire the set of arguments that are already present + presentArguments <- get - -- Acquire the set of arguments that are already present - presentArguments <- get + -- TODO to put the following check as up as possible as soon as it typecheks O_O + -- Check that those argument that we need to generate is not already present + let False = contains genedArg presentArguments + | True => pure id - -- TODO to put the following check as up as possible as soon as it typecheks O_O - -- Check that those argument that we need to generate is not already present - let False = contains genedArg presentArguments - | True => pure id + -- Filter arguments classification according to the set of arguments that are left to be generated; + -- Those which are `Right` are given, those which are `Left` are needs to be generated. + let depArgs : Vect typeOfGened.args.length (Either (Fin con.args.length) TTImp) := argsOfTypeOfGened <&> \case + Right expr => Right expr + Left i => if contains i presentArguments then Right $ var $ argName $ index' con.args i else Left i - -- Filter arguments classification according to the set of arguments that are left to be generated; - -- Those which are `Right` are given, those which are `Left` are needs to be generated. - let depArgs : Vect typeOfGened.args.length (Either (Fin con.args.length) TTImp) := argsOfTypeOfGened <&> \case - Right expr => Right expr - Left i => if contains i presentArguments then Right $ var $ argName $ index' con.args i else Left i + -- Determine which arguments will be on the left of dpair in subgen call, in correct order + let subgeneratedArgs = mapMaybe getLeft $ toList depArgs - -- Determine which arguments will be on the left of dpair in subgen call, in correct order - let subgeneratedArgs = mapMaybe getLeft $ toList depArgs + -- Make sure generated arguments will not be generated again + modify $ insert genedArg . union (fromList subgeneratedArgs) - -- Make sure generated arguments will not be generated again - modify $ insert genedArg . union (fromList subgeneratedArgs) + -- Form a task for subgen + let (subgivensLength ** subgivens) = mapMaybe (\(ie, idx) => (idx,) <$> getRight ie) $ depArgs `zip` Fin.range + let subsig : GenSignature := MkGenSignature typeOfGened $ fromList $ fst <$> toList subgivens + let Yes Refl = decEq subsig.givenParams.size subgivensLength + | No _ => fail "INTERNAL ERROR: error in given params set length computation" - -- Form a task for subgen - let (subgivensLength ** subgivens) = mapMaybe (\(ie, idx) => (idx,) <$> getRight ie) $ depArgs `zip` Fin.range - let subsig : GenSignature := MkGenSignature typeOfGened $ fromList $ fst <$> toList subgivens - let Yes Refl = decEq subsig.givenParams.size subgivensLength - | No _ => fail "INTERNAL ERROR: error in given params set length computation" + -- Check if called subgenerator can call the current one + let mutRec = hasNameInsideDeep sig.targetType.name $ var subsig.targetType.name - -- Check if called subgenerator can call the current one - let mutRec = hasNameInsideDeep sig.targetType.name $ var subsig.targetType.name + -- Decide whether to use local (decreasing) or outmost fuel, depending on whether we are in mutual recursion with subgen + let subfuel = if mutRec then fuel else var outmostFuelArg - -- Decide whether to use local (decreasing) or outmost fuel, depending on whether we are in mutual recursion with subgen - let subfuel = if mutRec then fuel else var outmostFuelArg + -- Form an expression to call the subgen + subgenCall <- callGen subsig subfuel $ snd <$> subgivens - -- Form an expression to call the subgen - subgenCall <- callGen subsig subfuel $ snd <$> subgivens + -- Form an expression of binding the result of subgen + let genedArg:::subgeneratedArgs = genedArg:::subgeneratedArgs <&> bindVar . flip Vect.index bindNames + let bindSubgenResult = foldr (\l, r => var `{Builtin.DPair.MkDPair} .$ l .$ r) genedArg subgeneratedArgs - -- Form an expression of binding the result of subgen - let genedArg:::subgeneratedArgs = genedArg:::subgeneratedArgs <&> bindVar . flip Vect.index bindNames - let bindSubgenResult = foldr (\l, r => var `{Builtin.DPair.MkDPair} .$ l .$ r) genedArg subgeneratedArgs + -- Form an expression of the RHS of a bind; simplify lambda if subgeneration result type does not require pattern matching + let bindRHS = \cont => case bindSubgenResult of + IBindVar _ n => lam (MkArg MW ExplicitArg (Just $ UN $ Basic n) implicitFalse) cont + _ => `(\ ~bindSubgenResult => ~cont) - -- Form an expression of the RHS of a bind; simplify lambda if subgeneration result type does not require pattern matching - let bindRHS = \cont => case bindSubgenResult of - IBindVar _ n => lam (MkArg MW ExplicitArg (Just $ UN $ Basic n) implicitFalse) cont - _ => `(\ ~bindSubgenResult => ~cont) - - -- Chain the subgen call with a given continuation - pure $ \cont => `(~subgenCall >>= ~(bindRHS cont)) + -- Chain the subgen call with a given continuation + pure $ \cont => `(~subgenCall >>= ~(bindRHS cont)) -- Get dependencies of constructor's arguments let rawDeps = argDeps con.args From 44e7f14c22eea5abbcce6fffb744225d1952ad4c Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Fri, 13 Sep 2024 16:04:53 +0300 Subject: [PATCH 44/53] [ derive ] Do not pass values of arguments on which someone else depends --- .../covering-seq/tests/gens/print/expected | 36 ++- .../sorted-list/tests/gens/print/expected | 18 +- .../DepTyCheck/Gen/Core/ConsDerive.idr | 21 +- .../adt/007 right-to-left simple/expected | 2 +- .../adt/008 right-to-left simple/expected | 2 +- .../print/adt/009 left-to-right/expected | 2 +- .../adt/010 right-to-left long-dpair/expected | 5 +- .../adt/011 right-to-left long-dpair/expected | 5 +- .../adt/012 right-to-left chained/expected | 4 +- .../adt/013 right-to-left nondet/expected | 6 +- .../adt/014 right-to-left nondet ext/expected | 6 +- .../least-effort/print/gadt/001 gadt/expected | 2 +- .../least-effort/print/gadt/002 gadt/expected | 2 +- .../gadt/003 right-to-left nondet/expected | 12 +- .../print/gadt/004 right-to-left det/expected | 12 +- .../least-effort/print/gadt/005 gadt/expected | 4 +- .../least-effort/print/gadt/006 gadt/expected | 8 +- .../print/gadt/011 eq deepcons/expected | 4 +- .../print/gadt/012 eq deepcons/expected | 5 +- .../print/gadt/013 eq deepcons/expected | 5 +- .../print/gadt/014 eq deepcons/expected | 2 +- .../regression/dependent-givens-big/expected | 13 +- .../dependent-givens-small-deep/expected | 2 +- .../dependent-givens-small-shallow/expected | 2 +- .../print/regression/fin-inc/expected | 6 +- .../DerivedGen.idr | 16 + .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../expected | 171 +++++++++++ .../underscore-in-cons-expl-full-gend1/run | 1 + .../DerivedGen.idr | 16 + .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../expected | 280 ++++++++++++++++++ .../underscore-in-cons-expl-full-gend2/run | 1 + .../DerivedGen.idr | 16 + .../RunDerivedGen.idr | 1 + .../underscore-in-cons-expl-full/derive.ipkg | 1 + .../underscore-in-cons-expl-full/expected | 68 +++++ .../underscore-in-cons-expl-full/run | 1 + .../DerivedGen.idr | 16 + .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../underscore-in-cons-expl-partial/expected | 68 +++++ .../underscore-in-cons-expl-partial/run | 1 + .../unification-mismatch-dependent/expected | 2 +- .../unification-name-mismatch/expected | 4 +- .../regression/unnamed-auto-implicit/expected | 6 +- .../DerivedGen.idr | 23 ++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../expected | 20 ++ .../underscore-in-cons-expl-full-gend1/run | 1 + .../DerivedGen.idr | 22 ++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../expected | 24 ++ .../underscore-in-cons-expl-full-gend2/run | 1 + .../DerivedGen.idr | 23 ++ .../RunDerivedGen.idr | 1 + .../underscore-in-cons-expl-full/derive.ipkg | 1 + .../underscore-in-cons-expl-full/expected | 25 ++ .../underscore-in-cons-expl-full/run | 1 + .../DerivedGen.idr | 23 ++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../underscore-in-cons-expl-partial/expected | 25 ++ .../underscore-in-cons-expl-partial/run | 1 + 68 files changed, 970 insertions(+), 88 deletions(-) create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/derive.ipkg create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/expected create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/run create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/derive.ipkg create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/expected create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/run create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/derive.ipkg create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/expected create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/run create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/derive.ipkg create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/expected create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/run create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/run create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/expected create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/run create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/expected create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/run create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/expected create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/run diff --git a/examples/covering-seq/tests/gens/print/expected b/examples/covering-seq/tests/gens/print/expected index 5c91b882b..67d9dba1c 100644 --- a/examples/covering-seq/tests/gens/print/expected +++ b/examples/covering-seq/tests/gens/print/expected @@ -142,7 +142,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (bs : BitMask n) -> Gen May .$ ( MkArg MW ExplicitArg (Just "^bnd^{conArg:1}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.List.Covering.End" .! ("n", var "n") .! ("bs", var "bs") .@ var "^bnd^{conArg:1}"))) + .$ ( var "Data.List.Covering.End" + .! ("n", implicitTrue) + .! ("bs", implicitTrue) + .@ var "^bnd^{conArg:1}"))) ] , IDef emptyFC @@ -159,8 +162,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (bs : BitMask n) -> Gen May .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Data.List.Covering.Miss" - .! ("n", var "n") - .! ("bs", var "bs") + .! ("n", implicitTrue) + .! ("bs", implicitTrue) .$ var "^bnd^{arg:7}" .$ var "^bnd^{arg:8}")))) ] @@ -194,9 +197,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (bs : BitMask n) -> Gen May .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Data.List.Covering.Hit" - .! ("n", var "n") - .! ("bs", var "bs") - .$ var "i" + .! ("n", implicitTrue) + .! ("bs", implicitTrue) + .$ implicitTrue .@ var "^bnd^{conArg:2}" .$ var "^bnd^{arg:9}"))))) ] @@ -320,7 +323,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (bs : BitMask n) -> Gen May .$ (var "fromString" .$ primVal (Str "Data.List.Covering.BitMask.Index.Here (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.List.Covering.BitMask.Index.Here" .! ("n", var "n") .! ("bs", var "bs") .! ("b", var "b"))) + .$ ( var "Data.List.Covering.BitMask.Index.Here" + .! ("n", implicitTrue) + .! ("bs", var "bs") + .! ("b", var "b"))) , var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "n") @@ -362,10 +368,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (bs : BitMask n) -> Gen May .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Data.List.Covering.BitMask.Index.There" .! ("b", var "b") - .! ("v", var "v") - .! ("n", var "n") - .! ("bs", var "bs") - .! ("i", var "i") + .! ("v", implicitTrue) + .! ("n", implicitTrue) + .! ("bs", implicitTrue) + .! ("i", implicitTrue) .$ var "^bnd^{arg:10}"))) , var "<>" .$ implicitTrue @@ -473,7 +479,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (bs : BitMask n) -> Gen May .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:11}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", var "k") .$ var "^bnd^{arg:11}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "^bnd^{arg:11}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -668,9 +674,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (bs : BitMask n) -> Gen May .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Data.List.Covering.BitMask.Index.Continue" - .! ("n", var "n") - .! ("bs", var "bs") - .! ("b", var "b") + .! ("n", implicitTrue) + .! ("bs", implicitTrue) + .! ("b", implicitTrue) .$ var "^bnd^{arg:13}"))) , var "<>" .$ bindVar "^cons_fuel^" diff --git a/examples/sorted-list/tests/gens/print/expected b/examples/sorted-list/tests/gens/print/expected index 898ce62cf..b70dd9866 100644 --- a/examples/sorted-list/tests/gens/print/expected +++ b/examples/sorted-list/tests/gens/print/expected @@ -135,7 +135,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty SortedList .$ (var "Builtin.DPair.MkDPair" .$ bindVar "xs" .$ bindVar "^bnd^{conArg:1}") .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.List.Sorted.(::)" .$ var "x" .$ var "xs" .@ var "^bnd^{conArg:1}") + .$ (var "Data.List.Sorted.(::)" .$ implicitTrue .$ implicitTrue .@ var "^bnd^{conArg:1}") ] })) ] @@ -255,10 +255,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty SortedList .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "Data.List.Sorted.NE" - .! ("xs", var "xs") - .! ("x", var "x") + .! ("xs", implicitTrue) + .! ("x", implicitTrue) .! ("prf", var "prf") - .! ("n", var "n") + .! ("n", implicitTrue) .$ var "^bnd^{arg:3}"))) ] }) @@ -367,10 +367,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty SortedList .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "Data.List.Sorted.NE" - .! ("xs", var "xs") - .! ("x", var "x") + .! ("xs", implicitTrue) + .! ("x", implicitTrue) .! ("prf", var "prf") - .! ("n", var "n") + .! ("n", implicitTrue) .$ var "^bnd^{arg:3}")) ] }) @@ -477,8 +477,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty SortedList .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "Data.Nat.LTESucc" - .! ("right", var "right") - .! ("left", var "left") + .! ("right", implicitTrue) + .! ("left", implicitTrue) .$ var "^bnd^{arg:4}")) ] })) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index d9cbac54a..609147733 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -84,12 +84,17 @@ namespace NonObligatoryExts -- Compute left-to-right need of generation when there are non-trivial types at the left argsTypeApps <- for con.args.asVect $ analyseTypeApp . type + -- Get dependencies of constructor's arguments + let rawDeps' = argDeps con.args + let rawDeps : Vect _ $ SortedSet $ Fin con.args.length := downmap (mapIn weakenToSuper) rawDeps' + let dependees = concat rawDeps -- arguments which any other argument depends on + -- Decide how constructor arguments would be named during generation - let bindNames = fromList con.args <&> bindNameRenamer . argName + let bindNames = withIndex (fromList con.args) <&> map (bindNameRenamer . argName) -- Form the expression of calling the current constructor let callCons = do - let constructorCall = callCon con $ bindNames <&> varStr + let constructorCall = callCon con $ bindNames <&> \(idx, n) => if contains idx dependees then implicitTrue else varStr n let wrapImpls : Nat -> TTImp wrapImpls Z = constructorCall wrapImpls (S n) = var `{Builtin.DPair.MkDPair} .$ implicitTrue .$ wrapImpls n @@ -140,7 +145,7 @@ namespace NonObligatoryExts subgenCall <- callGen subsig subfuel $ snd <$> subgivens -- Form an expression of binding the result of subgen - let genedArg:::subgeneratedArgs = genedArg:::subgeneratedArgs <&> bindVar . flip Vect.index bindNames + let genedArg:::subgeneratedArgs = genedArg:::subgeneratedArgs <&> bindVar . snd . flip Vect.index bindNames let bindSubgenResult = foldr (\l, r => var `{Builtin.DPair.MkDPair} .$ l .$ r) genedArg subgeneratedArgs -- Form an expression of the RHS of a bind; simplify lambda if subgeneration result type does not require pattern matching @@ -151,10 +156,6 @@ namespace NonObligatoryExts -- Chain the subgen call with a given continuation pure $ \cont => `(~subgenCall >>= ~(bindRHS cont)) - -- Get dependencies of constructor's arguments - let rawDeps = argDeps con.args - let deps = downmap ((`difference` givs) . mapIn weakenToSuper) rawDeps - ------------------------------------------------- -- Left-to-right generation phase (2nd phase) --- ------------------------------------------------- @@ -173,21 +174,21 @@ namespace NonObligatoryExts -- Find rightmost arguments among `preLTR` let depsLTR = SortedSet.fromList $ mapMaybe (\(ds, idx) => whenT .| contains idx preLTR && null ds .| idx) $ - toListI $ deps <&> intersection preLTR + toListI $ rawDeps <&> intersection preLTR . (`difference` givs) --------------------------------------------------------------------------------- -- Main right-to-left generation phase (3rd phase aka 2nd right-to-left phase) -- --------------------------------------------------------------------------------- -- Arguments that no other argument depends on - let rightmostArgs = fromFoldable {f=Vect _} range `difference` (givs `union` concat deps) + let rightmostArgs = fromFoldable {f=Vect _} range `difference` (givs `union` dependees) --------------------------------------------------------------- -- Manage different possible variants of generation ordering -- --------------------------------------------------------------- -- Prepare info about which arguments are independent and thus can be ordered arbitrarily - let disjDeps = disjointDepSets rawDeps givs + let disjDeps = disjointDepSets rawDeps' givs -- Acquire order(s) in what we will generate arguments let allOrders = do diff --git a/tests/derivation/least-effort/print/adt/007 right-to-left simple/expected b/tests/derivation/least-effort/print/adt/007 right-to-left simple/expected index c64626f3e..710108193 100644 --- a/tests/derivation/least-effort/print/adt/007 right-to-left simple/expected +++ b/tests/derivation/least-effort/print/adt/007 right-to-left simple/expected @@ -73,7 +73,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "^bnd^{arg:2}" .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkY" .! ("n", var "n") .$ var "^bnd^{arg:2}") + .$ (var "DerivedGen.MkY" .! ("n", implicitTrue) .$ var "^bnd^{arg:2}") ] })) ] diff --git a/tests/derivation/least-effort/print/adt/008 right-to-left simple/expected b/tests/derivation/least-effort/print/adt/008 right-to-left simple/expected index c64626f3e..710108193 100644 --- a/tests/derivation/least-effort/print/adt/008 right-to-left simple/expected +++ b/tests/derivation/least-effort/print/adt/008 right-to-left simple/expected @@ -73,7 +73,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "^bnd^{arg:2}" .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkY" .! ("n", var "n") .$ var "^bnd^{arg:2}") + .$ (var "DerivedGen.MkY" .! ("n", implicitTrue) .$ var "^bnd^{arg:2}") ] })) ] diff --git a/tests/derivation/least-effort/print/adt/009 left-to-right/expected b/tests/derivation/least-effort/print/adt/009 left-to-right/expected index 3bf59fae0..e6e909f5b 100644 --- a/tests/derivation/least-effort/print/adt/009 left-to-right/expected +++ b/tests/derivation/least-effort/print/adt/009 left-to-right/expected @@ -72,7 +72,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkY" .! ("n", var "n") .$ var "^bnd^{arg:2}")))) + .$ (var "DerivedGen.MkY" .! ("n", implicitTrue) .$ var "^bnd^{arg:2}")))) ] ] , scope = diff --git a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/expected b/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/expected index 28b3d7ab2..6694c4b8e 100644 --- a/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/expected +++ b/tests/derivation/least-effort/print/adt/010 right-to-left long-dpair/expected @@ -79,7 +79,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .$ (var "Builtin.DPair.MkDPair" .$ bindVar "m" .$ bindVar "^bnd^{arg:3}") .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkY" .! ("m", var "m") .! ("n", var "n") .$ var "^bnd^{arg:3}") + .$ ( var "DerivedGen.MkY" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "^bnd^{arg:3}") ] })) ] diff --git a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/expected b/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/expected index 4d56d2a43..dbcf6c57f 100644 --- a/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/expected +++ b/tests/derivation/least-effort/print/adt/011 right-to-left long-dpair/expected @@ -90,7 +90,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .$ (var "Builtin.DPair.MkDPair" .$ bindVar "m" .$ bindVar "^bnd^{arg:3}") .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkY" .! ("m", var "m") .! ("n", var "n") .$ var "^bnd^{arg:3}") + .$ ( var "DerivedGen.MkY" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "^bnd^{arg:3}") ] })) ] diff --git a/tests/derivation/least-effort/print/adt/012 right-to-left chained/expected b/tests/derivation/least-effort/print/adt/012 right-to-left chained/expected index b1111e603..9bddb0eec 100644 --- a/tests/derivation/least-effort/print/adt/012 right-to-left chained/expected +++ b/tests/derivation/least-effort/print/adt/012 right-to-left chained/expected @@ -88,7 +88,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "^bnd^{arg:3}" .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkY" .! ("n", var "n") .$ var "^bnd^{arg:3}") + .$ (var "DerivedGen.MkY" .! ("n", implicitTrue) .$ var "^bnd^{arg:3}") ] })) ] @@ -139,7 +139,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue - .$ (var "DerivedGen.MkX2" .$ var "n" .$ var "^bnd^{arg:4}")) + .$ (var "DerivedGen.MkX2" .$ implicitTrue .$ var "^bnd^{arg:4}")) ] })) ] diff --git a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/expected b/tests/derivation/least-effort/print/adt/013 right-to-left nondet/expected index 1c7187032..8f66095cb 100644 --- a/tests/derivation/least-effort/print/adt/013 right-to-left nondet/expected +++ b/tests/derivation/least-effort/print/adt/013 right-to-left nondet/expected @@ -105,9 +105,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.MkY" - .! ("k", var "k") - .! ("m", var "m") - .! ("n", var "n") + .! ("k", implicitTrue) + .! ("m", implicitTrue) + .! ("n", implicitTrue) .$ var "^bnd^{arg:4}" .$ var "^bnd^{arg:3}") ] diff --git a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/expected b/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/expected index 1665558d9..8ea46f840 100644 --- a/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/expected +++ b/tests/derivation/least-effort/print/adt/014 right-to-left nondet ext/expected @@ -106,9 +106,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.MkY" - .! ("k", var "k") - .! ("m", var "m") - .! ("n", var "n") + .! ("k", implicitTrue) + .! ("m", implicitTrue) + .! ("n", implicitTrue) .$ var "^bnd^{arg:6}" .$ var "^bnd^{arg:5}") ] diff --git a/tests/derivation/least-effort/print/gadt/001 gadt/expected b/tests/derivation/least-effort/print/gadt/001 gadt/expected index 130d020b3..93235eb8a 100644 --- a/tests/derivation/least-effort/print/gadt/001 gadt/expected +++ b/tests/derivation/least-effort/print/gadt/001 gadt/expected @@ -72,7 +72,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:1}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", var "k") .$ var "^bnd^{arg:1}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "^bnd^{arg:1}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] diff --git a/tests/derivation/least-effort/print/gadt/002 gadt/expected b/tests/derivation/least-effort/print/gadt/002 gadt/expected index 0bfb458f5..f34612b26 100644 --- a/tests/derivation/least-effort/print/gadt/002 gadt/expected +++ b/tests/derivation/least-effort/print/gadt/002 gadt/expected @@ -96,7 +96,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue - .$ (var "Data.Fin.FS" .! ("k", var "k") .$ var "^bnd^{arg:1}")) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "^bnd^{arg:1}")) ] })) ] diff --git a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/expected b/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/expected index 66e220888..71ee4768c 100644 --- a/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/expected +++ b/tests/derivation/least-effort/print/gadt/003 right-to-left nondet/expected @@ -133,9 +133,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.MkY1" - .! ("k", var "k") - .! ("m", var "m") - .! ("n", var "n") + .! ("k", implicitTrue) + .! ("m", implicitTrue) + .! ("n", implicitTrue) .$ var "^bnd^{arg:4}" .$ var "^bnd^{arg:3}") ] @@ -170,9 +170,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.MkY2" - .! ("k", var "k") - .! ("m", var "m") - .! ("n", var "n") + .! ("k", implicitTrue) + .! ("m", implicitTrue) + .! ("n", implicitTrue) .$ var "^bnd^{arg:6}" .$ var "^bnd^{arg:5}") ] diff --git a/tests/derivation/least-effort/print/gadt/004 right-to-left det/expected b/tests/derivation/least-effort/print/gadt/004 right-to-left det/expected index 90eac771c..f87e1f13e 100644 --- a/tests/derivation/least-effort/print/gadt/004 right-to-left det/expected +++ b/tests/derivation/least-effort/print/gadt/004 right-to-left det/expected @@ -152,9 +152,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.MkY_LR" - .! ("k", var "k") - .! ("m", var "m") - .! ("n", var "n") + .! ("k", implicitTrue) + .! ("m", implicitTrue) + .! ("n", implicitTrue) .$ var "^bnd^{arg:6}" .$ var "^bnd^{arg:5}") ] @@ -189,9 +189,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty Y .= var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.MkY_RL" - .! ("k", var "k") - .! ("m", var "m") - .! ("n", var "n") + .! ("k", implicitTrue) + .! ("m", implicitTrue) + .! ("n", implicitTrue) .$ var "^bnd^{arg:8}" .$ var "^bnd^{arg:7}") ] diff --git a/tests/derivation/least-effort/print/gadt/005 gadt/expected b/tests/derivation/least-effort/print/gadt/005 gadt/expected index c36018d30..c3afb08ef 100644 --- a/tests/derivation/least-effort/print/gadt/005 gadt/expected +++ b/tests/derivation/least-effort/print/gadt/005 gadt/expected @@ -157,7 +157,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "DerivedGen.FN" - .! ("b", var "b") + .! ("b", implicitTrue) .$ var "^bnd^{arg:7}" .$ var "^bnd^{arg:6}"))) ] @@ -198,7 +198,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "DerivedGen.TR" - .! ("b", var "b") + .! ("b", implicitTrue) .$ var "^bnd^{arg:10}" .$ var "^bnd^{arg:9}"))) ] diff --git a/tests/derivation/least-effort/print/gadt/006 gadt/expected b/tests/derivation/least-effort/print/gadt/006 gadt/expected index 69dbcaa47..90554da87 100644 --- a/tests/derivation/least-effort/print/gadt/006 gadt/expected +++ b/tests/derivation/least-effort/print/gadt/006 gadt/expected @@ -152,7 +152,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.FN" - .! ("b", var "b") + .! ("b", implicitTrue) .$ var "^bnd^{arg:7}" .$ var "^bnd^{arg:6}")) ] @@ -193,7 +193,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.TR" - .! ("b", var "b") + .! ("b", implicitTrue) .$ var "^bnd^{arg:10}" .$ var "^bnd^{arg:9}")) ] @@ -355,7 +355,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "DerivedGen.FN" - .! ("b", var "b") + .! ("b", implicitTrue) .$ var "^bnd^{arg:7}" .$ var "^bnd^{arg:6}"))) ] @@ -396,7 +396,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "DerivedGen.TR" - .! ("b", var "b") + .! ("b", implicitTrue) .$ var "^bnd^{arg:10}" .$ var "^bnd^{arg:9}"))) ] diff --git a/tests/derivation/least-effort/print/gadt/011 eq deepcons/expected b/tests/derivation/least-effort/print/gadt/011 eq deepcons/expected index 192fc7b89..d9860ad11 100644 --- a/tests/derivation/least-effort/print/gadt/011 eq deepcons/expected +++ b/tests/derivation/least-effort/print/gadt/011 eq deepcons/expected @@ -110,8 +110,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "DerivedGen.Step" - .! ("y", var "y") - .! ("x", var "x") + .! ("y", implicitTrue) + .! ("x", implicitTrue) .$ var "^bnd^{arg:4}"))) ] })) diff --git a/tests/derivation/least-effort/print/gadt/012 eq deepcons/expected b/tests/derivation/least-effort/print/gadt/012 eq deepcons/expected index d18fbf2e2..ad9cd22e6 100644 --- a/tests/derivation/least-effort/print/gadt/012 eq deepcons/expected +++ b/tests/derivation/least-effort/print/gadt/012 eq deepcons/expected @@ -89,7 +89,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Nat) -> Gen MaybeEmpty .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue - .$ (var "DerivedGen.Step" .! ("y", var "y") .! ("x", var "x") .$ var "^bnd^{arg:3}")) + .$ ( var "DerivedGen.Step" + .! ("y", implicitTrue) + .! ("x", implicitTrue) + .$ var "^bnd^{arg:3}")) ] })) ] diff --git a/tests/derivation/least-effort/print/gadt/013 eq deepcons/expected b/tests/derivation/least-effort/print/gadt/013 eq deepcons/expected index 3f1bec753..2e868552d 100644 --- a/tests/derivation/least-effort/print/gadt/013 eq deepcons/expected +++ b/tests/derivation/least-effort/print/gadt/013 eq deepcons/expected @@ -92,7 +92,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (b : Nat) -> Gen MaybeEmpty .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue - .$ (var "DerivedGen.Step" .! ("y", var "y") .! ("x", var "x") .$ var "^bnd^{arg:3}")) + .$ ( var "DerivedGen.Step" + .! ("y", implicitTrue) + .! ("x", implicitTrue) + .$ var "^bnd^{arg:3}")) ] })) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" diff --git a/tests/derivation/least-effort/print/gadt/014 eq deepcons/expected b/tests/derivation/least-effort/print/gadt/014 eq deepcons/expected index 2e60bcf52..dbb2af764 100644 --- a/tests/derivation/least-effort/print/gadt/014 eq deepcons/expected +++ b/tests/derivation/least-effort/print/gadt/014 eq deepcons/expected @@ -101,7 +101,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (a : Nat) -> (b : Nat) -> G .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Step" .! ("y", var "y") .! ("x", var "x") .$ var "^bnd^{arg:3}"))) + .$ (var "DerivedGen.Step" .! ("y", implicitTrue) .! ("x", implicitTrue) .$ var "^bnd^{arg:3}"))) , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/expected b/tests/derivation/least-effort/print/regression/dependent-givens-big/expected index a144b90b0..2ed020667 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-big/expected +++ b/tests/derivation/least-effort/print/regression/dependent-givens-big/expected @@ -101,7 +101,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (v : VectMaybe .$ implicitTrue .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue - .$ (var "DerivedGen.VectMaybeAnyType.Here" .! ("n", var "n") .! ("xs", var "xs") .! ("x", var "x"))))) + .$ ( var "DerivedGen.VectMaybeAnyType.Here" + .! ("n", implicitTrue) + .! ("xs", var "xs") + .! ("x", var "x"))))) , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef @@ -131,10 +134,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (v : VectMaybe .$ implicitTrue .$ ( var "DerivedGen.VectMaybeAnyType.There" .! ("z", var "z") - .! ("n", var "n") - .! ("zs", var "zs") - .! ("x", var "x") - .! ("i", var "i") + .! ("n", implicitTrue) + .! ("zs", implicitTrue) + .! ("x", implicitTrue) + .! ("i", implicitTrue) .$ var "^bnd^{arg:4}"))) ] })) diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected b/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected index 0d43d457f..44b63a6e3 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected +++ b/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected @@ -54,7 +54,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (f : Fin n) -> .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "n" .$ var "f")) + .$ (var "DerivedGen.MkX" .$ implicitTrue .$ var "f")) , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected b/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected index 12b4e1578..9db94345c 100644 --- a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected +++ b/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected @@ -52,7 +52,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (f : Fin n) -> .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "n" .$ var "f")) + .$ (var "DerivedGen.MkX" .$ implicitTrue .$ var "f")) , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] diff --git a/tests/derivation/least-effort/print/regression/fin-inc/expected b/tests/derivation/least-effort/print/regression/fin-inc/expected index c1f8a1dae..f3a0bba56 100644 --- a/tests/derivation/least-effort/print/regression/fin-inc/expected +++ b/tests/derivation/least-effort/print/regression/fin-inc/expected @@ -88,7 +88,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue - .$ (var "DerivedGen.MkFinInc" .! ("n", var "n") .$ var "val" .$ var "prf")) + .$ (var "DerivedGen.MkFinInc" .! ("n", implicitTrue) .$ implicitTrue .$ var "prf")) ] })) ] @@ -183,8 +183,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "Data.Nat.LTESucc" - .! ("right", var "right") - .! ("left", var "left") + .! ("right", implicitTrue) + .! ("left", implicitTrue) .$ var "^bnd^{arg:1}"))) ] })) diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/DerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/DerivedGen.idr new file mode 100644 index 000000000..135e0e3e8 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import Data.Fin + +import Deriving.DepTyCheck.Gen + +%default total + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +%language ElabReflection + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ + Fuel -> (n : Nat) -> Gen MaybeEmpty (v ** IsFS n v) diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/derive.ipkg b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/expected b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/expected new file mode 100644 index 000000000..8eb2c5761 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/expected @@ -0,0 +1,171 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (v : Fin n ** IsFS n v) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "n") + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .=> var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}")) + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") + }) + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "n") + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .=> var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}")) + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "^bnd^{k:3643}") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.ItIsFS (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "{k:3643}") + .$ ( MkArg MW ExplicitArg (Just "i") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.ItIsFS" .! ("{k:3643}", implicitTrue) .! ("i", var "i"))))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.IsFS[0] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^") + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.Fin.Fin" .$ var "n") + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.Fin.Fin" .$ var "n") + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.FZ (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FZ" .! ("k", var "k"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "^bnd^{arg:2}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0] (dry fuel)")) + .$ (var "<>" .$ var "Data.Fuel.Dry" .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + ] + , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/run b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend1/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/DerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/DerivedGen.idr new file mode 100644 index 000000000..d4ab4c4a4 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import Data.Fin + +import Deriving.DepTyCheck.Gen + +%default total + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +%language ElabReflection + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ + Fuel -> Gen MaybeEmpty (n ** v ** IsFS n v) diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/derive.ipkg b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/expected b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/expected new file mode 100644 index 000000000..3348d8678 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/expected @@ -0,0 +1,280 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (v : Fin n ** IsFS n v)) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "n") + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .=> var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}"))) + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ (MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") .=> var "Data.Fin.Fin" .$ var "n")) + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "n") + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .=> var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}"))) + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.ItIsFS (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "^bnd^{k:3643}" .$ bindVar "i" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.ItIsFS" .! ("{k:3643}", implicitTrue) .! ("i", var "i")))) + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.IsFS[] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ (MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") .=> var "Data.Fin.Fin" .$ var "n")) + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ (MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") .=> var "Data.Fin.Fin" .$ var "n")) + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.FZ (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "k") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Builtin.DPair.MkDPair" .$ implicitTrue .$ (var "Data.Fin.FZ" .! ("k", var "k"))))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "k" .$ bindVar "^bnd^{arg:2}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "^bnd^{arg:2}")) + ] + })) + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[] (dry fuel)")) + .$ (var "<>" .$ var "Data.Fuel.Dry") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Z (orders)")) + .$ (var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ var "Prelude.Types.Z") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "^bnd^{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "^bnd^{arg:3}"))) + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (dry fuel)")) + .$ (var "<>" .$ var "Data.Fuel.Dry") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/run b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full-gend2/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/DerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/DerivedGen.idr new file mode 100644 index 000000000..7c24533a3 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import Data.Fin + +import Deriving.DepTyCheck.Gen + +%default total + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +%language ElabReflection + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ + Fuel -> {n : Nat} -> (v : Fin n) -> Gen MaybeEmpty $ IsFS n v diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/derive.ipkg b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/expected b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/expected new file mode 100644 index 000000000..546f1d57f --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/expected @@ -0,0 +1,68 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (v : Fin n) -> Gen MaybeEmpty (IsFS n v) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ImplicitArg (Just "outer^") implicitTrue +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}") + }) + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}") + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "^bnd^{k:3643}") + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ bindVar "i") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.ItIsFS (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.ItIsFS" .! ("{k:3643}", implicitTrue) .! ("i", var "i"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.IsFS[0, 1] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^<{arg:1}>") + } + ] + ] + , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/run b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-full/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/DerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/DerivedGen.idr new file mode 100644 index 000000000..1b212c923 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import Data.Fin + +import Deriving.DepTyCheck.Gen + +%default total + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS (S _) (FS i) + +%language ElabReflection + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ + Fuel -> {n : Nat} -> (v : Fin n) -> Gen MaybeEmpty $ IsFS n v diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/derive.ipkg b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/expected b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/expected new file mode 100644 index 000000000..834525554 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/expected @@ -0,0 +1,68 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (v : Fin n) -> Gen MaybeEmpty (IsFS n v) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ImplicitArg (Just "outer^") implicitTrue +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}") + }) + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.IsFS" .$ var "n" .$ var "{arg:1}") + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "^bnd^{_:3643}") + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ bindVar "i") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.ItIsFS (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.ItIsFS" .! ("{_:3643}", implicitTrue) .! ("i", var "i"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.IsFS[0, 1] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^<{arg:1}>") + } + ] + ] + , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/run b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-expl-partial/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/expected b/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/expected index f896d4019..f6e0a1eec 100644 --- a/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/expected +++ b/tests/derivation/least-effort/print/regression/unification-mismatch-dependent/expected @@ -77,7 +77,7 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (x : X) -> (x' : X) -> Gen .$ (var "fromString" .$ primVal (Str "DerivedGen.MkZ (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkZ" .! ("x", var "x") .$ var "prf")) + .$ (var "DerivedGen.MkZ" .! ("x", implicitTrue) .$ var "prf")) , var "<>" .$ bindVar "^cons_fuel^" .$ (var "DerivedGen.Cons" .$ bindVar "x" .$ bindVar "prf") diff --git a/tests/derivation/least-effort/print/regression/unification-name-mismatch/expected b/tests/derivation/least-effort/print/regression/unification-name-mismatch/expected index 051eda979..1008e0bde 100644 --- a/tests/derivation/least-effort/print/regression/unification-name-mismatch/expected +++ b/tests/derivation/least-effort/print/regression/unification-name-mismatch/expected @@ -129,8 +129,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (xs : X) -> (ys : X) -> Gen .$ ( var "DerivedGen.B" .! ("x", var "x") .! ("y", var "y") - .! ("ys", var "ys") - .! ("xs", var "xs") + .! ("ys", implicitTrue) + .! ("xs", implicitTrue) .$ var "^bnd^{arg:1}"))) , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] diff --git a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/expected b/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/expected index e82c07f60..f2400dae4 100644 --- a/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/expected +++ b/tests/derivation/least-effort/print/regression/unnamed-auto-implicit/expected @@ -107,9 +107,9 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (f : X) -> Gen MaybeEmpty ( .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue .$ ( var "DerivedGen.B" - .! ("x", var "x") - .! ("xs", var "xs") - .! ("n", var "n") + .! ("x", implicitTrue) + .! ("xs", implicitTrue) + .! ("n", implicitTrue) .$ var "^bnd^{arg:3}" .@ var "^bnd^{conArg:2}")) ] diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/DerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/DerivedGen.idr new file mode 100644 index 000000000..932aa877d --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import RunDerivedGen + +import Data.Fin + +%default total + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +Show (IsFS n vs) where show ItIsFS = "ItIsFS" + +%language ElabReflection + +checkedGen : Fuel -> (n : Nat) -> Gen MaybeEmpty (v ** IsFS n v) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl 3 + , G $ \fl => checkedGen fl 0 + ] diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/derive.ipkg b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected new file mode 100644 index 000000000..27a5e5d66 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected @@ -0,0 +1,20 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Error: While processing right hand side of checkedGen. Sorry, I can't find any elaboration which works. All errors: +Possible error: + Error during reflection: While processing right hand side of {u:1837},[0]. While processing right hand side of $resolved13830,<>. {k:1755} is not accessible in this context. + +Possible error: + Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present + + DerivedGen:17:14--17:23 + 13 | + 14 | %language ElabReflection + 15 | + 16 | checkedGen : Fuel -> (n : Nat) -> Gen MaybeEmpty (v ** IsFS n v) + 17 | checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + ^^^^^^^^^ + +[ fatal ] Error when executing system command. + Command: "build/exec/_tmppack" + Error code: 127 diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/run b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/DerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/DerivedGen.idr new file mode 100644 index 000000000..414bd25f4 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/DerivedGen.idr @@ -0,0 +1,22 @@ +module DerivedGen + +import RunDerivedGen + +import Data.Fin + +%default total + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +Show (IsFS n vs) where show ItIsFS = "ItIsFS" + +%language ElabReflection + +checkedGen : Fuel -> Gen MaybeEmpty (n ** v ** IsFS n v) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl + ] diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/derive.ipkg b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/expected b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/expected new file mode 100644 index 000000000..36e7faec3 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/expected @@ -0,0 +1,24 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +(22 ** (17 ** ItIsFS)) +----- +(29 ** (18 ** ItIsFS)) +----- +(29 ** (11 ** ItIsFS)) +----- +(11 ** (6 ** ItIsFS)) +----- +(25 ** (13 ** ItIsFS)) +----- +(25 ** (9 ** ItIsFS)) +----- +(20 ** (5 ** ItIsFS)) +----- +(13 ** (8 ** ItIsFS)) +----- +(13 ** (11 ** ItIsFS)) +----- +(37 ** (16 ** ItIsFS)) diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/run b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend2/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/DerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/DerivedGen.idr new file mode 100644 index 000000000..4e95b763c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import RunDerivedGen + +import Data.Fin + +%default total + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS _ (FS i) + +Show (IsFS n vs) where show ItIsFS = "ItIsFS" + +%language ElabReflection + +checkedGen : Fuel -> {n : Nat} -> (v : Fin n) -> Gen MaybeEmpty $ IsFS n v +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl $ the (Fin 4) 3 + , G $ \fl => checkedGen fl $ the (Fin 3) 0 + ] diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/derive.ipkg b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/expected b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/expected new file mode 100644 index 000000000..c2be1814b --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/run b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/DerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/DerivedGen.idr new file mode 100644 index 000000000..5f2278141 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import RunDerivedGen + +import Data.Fin + +%default total + +data IsFS : (n : _) -> Fin n -> Type where + ItIsFS : IsFS (S _) (FS i) + +Show (IsFS n vs) where show ItIsFS = "ItIsFS" + +%language ElabReflection + +checkedGen : Fuel -> {n : Nat} -> (v : Fin n) -> Gen MaybeEmpty $ IsFS n v +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl $ the (Fin 4) 3 + , G $ \fl => checkedGen fl $ the (Fin 3) 0 + ] diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/derive.ipkg b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/expected b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/expected new file mode 100644 index 000000000..c2be1814b --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/run b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-partial/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From ca7b6484825ccb7b2cdeb6703adec8dab11734fe Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 28 Aug 2024 16:19:05 +0300 Subject: [PATCH 45/53] [ derive ] Don't discard types with implciits --- .../DepTyCheck/Gen/Core/ConsEntry.idr | 6 +- src/Deriving/DepTyCheck/Gen/Entry.idr | 6 +- .../core/norec t-pi->.. noext 001/expected | 6 +- .../core/norec t-pi->.. noext 002/expected | 6 +- .../core/norec t-pi->.. noext 003/expected | 2 +- .../core/norec t-pi->.. noext 004/expected | 2 +- .../norec t-pi->.. noext 005/DerivedGen.idr | 2 +- .../core/norec t-pi->.. noext 005/expected | 55 +++++- .../core/norec t-pi->.. w_ext 002/expected | 6 +- .../core/norec t-pi->.. w_ext 003/expected | 55 +++++- .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../dependent-givens-impl-big/DerivedGen.idr | 68 +++++++ .../RunDerivedGen.idr | 0 .../dependent-givens-impl-big}/derive.ipkg | 0 .../dependent-givens-impl-big/expected | 185 ++++++++++++++++++ .../regression/dependent-givens-impl-big}/run | 0 .../DerivedGen.idr | 15 ++ .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../dependent-givens-impl-small-deep/expected | 70 +++++++ .../dependent-givens-impl-small-deep}/run | 0 .../DerivedGen.idr | 15 ++ .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 68 +++++++ .../dependent-givens-impl-small-shallow}/run | 0 .../DerivedGen.idr | 16 ++ .../RunDerivedGen.idr | 1 + .../underscore-in-cons-impl-full/derive.ipkg | 1 + .../underscore-in-cons-impl-full/expected | 68 +++++++ .../underscore-in-cons-impl-full/run | 1 + .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 1 + .../dependent-givens-expl-big/derive.ipkg | 1 + .../expected | 0 .../regression/dependent-givens-expl-big/run | 1 + .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../expected | 0 .../dependent-givens-expl-small-deep/run | 1 + .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../expected | 0 .../dependent-givens-expl-small-shallow/run | 1 + .../dependent-givens-impl-big/DerivedGen.idr | 96 +++++++++ .../RunDerivedGen.idr | 1 + .../dependent-givens-impl-big/derive.ipkg | 1 + .../dependent-givens-impl-big/expected | 25 +++ .../regression/dependent-givens-impl-big/run | 1 + .../DerivedGen.idr | 24 +++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../dependent-givens-impl-small-deep/expected | 25 +++ .../dependent-givens-impl-small-deep/run | 1 + .../DerivedGen.idr | 24 +++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../expected | 25 +++ .../dependent-givens-impl-small-shallow/run | 1 + .../expected | 2 +- .../DerivedGen.idr | 23 +++ .../RunDerivedGen.idr | 1 + .../underscore-in-cons-impl-full/derive.ipkg | 1 + .../underscore-in-cons-impl-full/expected | 25 +++ .../underscore-in-cons-impl-full/run | 1 + 81 files changed, 901 insertions(+), 43 deletions(-) rename tests/derivation/least-effort/print/regression/{dependent-givens-big => dependent-givens-expl-big}/DerivedGen.idr (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-big => dependent-givens-expl-big}/RunDerivedGen.idr (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-big => dependent-givens-expl-big}/derive.ipkg (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-big => dependent-givens-expl-big}/expected (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-big => dependent-givens-expl-big}/run (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-deep => dependent-givens-expl-small-deep}/DerivedGen.idr (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-deep => dependent-givens-expl-small-deep}/RunDerivedGen.idr (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-deep => dependent-givens-expl-small-deep}/derive.ipkg (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-deep => dependent-givens-expl-small-deep}/expected (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-deep => dependent-givens-expl-small-deep}/run (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-shallow => dependent-givens-expl-small-shallow}/DerivedGen.idr (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-shallow => dependent-givens-expl-small-shallow}/RunDerivedGen.idr (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-shallow => dependent-givens-expl-small-shallow}/derive.ipkg (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-shallow => dependent-givens-expl-small-shallow}/expected (100%) rename tests/derivation/least-effort/print/regression/{dependent-givens-small-shallow => dependent-givens-expl-small-shallow}/run (100%) create mode 100644 tests/derivation/least-effort/print/regression/dependent-givens-impl-big/DerivedGen.idr rename tests/derivation/least-effort/{run/regression/dependent-givens-big => print/regression/dependent-givens-impl-big}/RunDerivedGen.idr (100%) rename tests/derivation/least-effort/{run/regression/dependent-givens-big => print/regression/dependent-givens-impl-big}/derive.ipkg (100%) create mode 100644 tests/derivation/least-effort/print/regression/dependent-givens-impl-big/expected rename tests/derivation/least-effort/{run/regression/dependent-givens-big => print/regression/dependent-givens-impl-big}/run (100%) create mode 100644 tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/DerivedGen.idr rename tests/derivation/least-effort/{run/regression/dependent-givens-small-deep => print/regression/dependent-givens-impl-small-deep}/RunDerivedGen.idr (100%) rename tests/derivation/least-effort/{run/regression/dependent-givens-small-deep => print/regression/dependent-givens-impl-small-deep}/derive.ipkg (100%) create mode 100644 tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/expected rename tests/derivation/least-effort/{run/regression/dependent-givens-small-deep => print/regression/dependent-givens-impl-small-deep}/run (100%) create mode 100644 tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/DerivedGen.idr rename tests/derivation/least-effort/{run/regression/dependent-givens-small-shallow => print/regression/dependent-givens-impl-small-shallow}/RunDerivedGen.idr (100%) rename tests/derivation/least-effort/{run/regression/dependent-givens-small-shallow => print/regression/dependent-givens-impl-small-shallow}/derive.ipkg (100%) create mode 100644 tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/expected rename tests/derivation/least-effort/{run/regression/dependent-givens-small-shallow => print/regression/dependent-givens-impl-small-shallow}/run (100%) create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/derive.ipkg create mode 100644 tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/expected create mode 120000 tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/run rename tests/derivation/least-effort/run/regression/{dependent-givens-big => dependent-givens-expl-big}/DerivedGen.idr (100%) create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-big/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-big/derive.ipkg rename tests/derivation/least-effort/run/regression/{dependent-givens-big => dependent-givens-expl-big}/expected (100%) create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-big/run rename tests/derivation/least-effort/run/regression/{dependent-givens-small-deep => dependent-givens-expl-small-deep}/DerivedGen.idr (100%) create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/derive.ipkg rename tests/derivation/least-effort/run/regression/{dependent-givens-small-deep => dependent-givens-expl-small-deep}/expected (100%) create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/run rename tests/derivation/least-effort/run/regression/{dependent-givens-small-shallow => dependent-givens-expl-small-shallow}/DerivedGen.idr (100%) create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/derive.ipkg rename tests/derivation/least-effort/run/regression/{dependent-givens-small-shallow => dependent-givens-expl-small-shallow}/expected (100%) create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/run create mode 100644 tests/derivation/least-effort/run/regression/dependent-givens-impl-big/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-big/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-big/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/dependent-givens-impl-big/expected create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-big/run create mode 100644 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/expected create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/run create mode 100644 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/expected create mode 120000 tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/run create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/derive.ipkg create mode 100644 tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/expected create mode 120000 tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/run diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsEntry.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsEntry.idr index 45d369ace..1124ccdc4 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsEntry.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsEntry.idr @@ -28,11 +28,7 @@ canonicConsBody sig name con = do -- Acquire constructor's return type arguments let (conRetTy, conRetTypeArgs) = unAppAny con.type - conRetTypeArgs <- for conRetTypeArgs $ \case -- resembles similar management from `Entry` module; they must be consistent - PosApp e => pure e - NamedApp _ _ => failAt conFC "Named implicit applications (like to `\{show conRetTy}`) are not supported yet" - AutoApp _ => failAt conFC "Auto-implicit applications (like to `\{show conRetTy}`) are not supported yet" - WithApp _ => failAt conFC "Unexpected `with` application to `\{show conRetTy}` in a constructor's argument" + let conRetTypeArgs = conRetTypeArgs <&> getExpr -- Match lengths of `conRetTypeArgs` and `sig.targetType.args` let Yes conRetTypeArgsLengthCorrect = conRetTypeArgs.length `decEq` sig.targetType.args.length diff --git a/src/Deriving/DepTyCheck/Gen/Entry.idr b/src/Deriving/DepTyCheck/Gen/Entry.idr index 7ff973b99..fb33996b0 100644 --- a/src/Deriving/DepTyCheck/Gen/Entry.idr +++ b/src/Deriving/DepTyCheck/Gen/Entry.idr @@ -108,11 +108,7 @@ checkTypeIsGen checkSide sig = do let (targetType, targetTypeArgs) = unAppAny targetType -- check out applications types - targetTypeArgs <- for targetTypeArgs $ \case - PosApp arg => pure arg - NamedApp n arg => failAt targetTypeFC "Target types with implicit type parameters are not supported yet" - AutoApp arg => failAt targetTypeFC "Target types with `auto` implicit type parameters are not supported yet" - WithApp arg => failAt targetTypeFC "Unexpected `with`-application in the target type" + let targetTypeArgs = targetTypeArgs <&> getExpr ------------------------------------------ -- Working with the target type familly -- diff --git a/tests/derivation/core/norec t-pi->.. noext 001/expected b/tests/derivation/core/norec t-pi->.. noext 001/expected index c8ef1caae..98ad192ff 100644 --- a/tests/derivation/core/norec t-pi->.. noext 001/expected +++ b/tests/derivation/core/norec t-pi->.. noext 001/expected @@ -1,12 +1,12 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Target types with implicit type parameters are not supported yet +Error: While processing right hand side of checkedGen. Error during reflection: Target type `Builtin.(===)` is not a top-level data definition -DerivedGen:9:55--9:60 +DerivedGen:9:39--9:42 5 | %default total 6 | 7 | %language ElabReflection 8 | 9 | checkedGen : Fuel -> (a, b : Bool) -> Gen MaybeEmpty (a = b) - ^^^^^ + ^^^ diff --git a/tests/derivation/core/norec t-pi->.. noext 002/expected b/tests/derivation/core/norec t-pi->.. noext 002/expected index 52d4b1d12..bc185de78 100644 --- a/tests/derivation/core/norec t-pi->.. noext 002/expected +++ b/tests/derivation/core/norec t-pi->.. noext 002/expected @@ -1,12 +1,12 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Target types with implicit type parameters are not supported yet +Error: While processing right hand side of checkedGen. Error during reflection: Target type `Builtin.(===)` is not a top-level data definition -DerivedGen:10:54--10:59 +DerivedGen:10:38--10:41 06 | 07 | %language ElabReflection 08 | 09 | export 10 | checkedGen : Fuel -> (a, b : Nat) -> Gen MaybeEmpty (a = b) - ^^^^^ + ^^^ diff --git a/tests/derivation/core/norec t-pi->.. noext 003/expected b/tests/derivation/core/norec t-pi->.. noext 003/expected index 5319be912..ef9b97a98 100644 --- a/tests/derivation/core/norec t-pi->.. noext 003/expected +++ b/tests/derivation/core/norec t-pi->.. noext 003/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Named implicit applications (like to `Builtin.Equal`) are not supported yet +Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` DerivedGen:17:14--17:23 13 | Show (X b1 b2) where diff --git a/tests/derivation/core/norec t-pi->.. noext 004/expected b/tests/derivation/core/norec t-pi->.. noext 004/expected index a0d6f2d7a..c383f4a48 100644 --- a/tests/derivation/core/norec t-pi->.. noext 004/expected +++ b/tests/derivation/core/norec t-pi->.. noext 004/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Named implicit applications (like to `Builtin.Equal`) are not supported yet +Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` DerivedGen:19:14--19:23 15 | show (X0 b1 b2 _) = "X0 \{show b1} \{show b2} Refl" diff --git a/tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr b/tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr index 284af74cb..a96eb11d7 100644 --- a/tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr +++ b/tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr @@ -12,7 +12,7 @@ import RunDerivedGen data FinEq : Fin n -> Fin n -> Type where Here : FinEq FZ FZ - These : FinEq n m -> FinEq (FS n) (FS m) + These : {n : Nat} -> {0 i, j : Fin n} -> FinEq i j -> FinEq (FS i) (FS j) data X : (n : Nat) -> Fin n -> Fin n -> Type where MkX : (i1, i2 : Fin n) -> (i1 `FinEq` i2) -> X n i1 i2 diff --git a/tests/derivation/core/norec t-pi->.. noext 005/expected b/tests/derivation/core/norec t-pi->.. noext 005/expected index 0bbb77a96..bde9b1876 100644 --- a/tests/derivation/core/norec t-pi->.. noext 005/expected +++ b/tests/derivation/core/norec t-pi->.. noext 005/expected @@ -1,12 +1,47 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Named implicit applications (like to `DerivedGen.FinEq`) are not supported yet - -DerivedGen:14:11--14:22 - 10 | - 11 | %language ElabReflection - 12 | - 13 | data FinEq : Fin n -> Fin n -> Type where - 14 | Here : FinEq FZ FZ - ^^^^^^^^^^^ - +Generated values: +----- +----- +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +----- +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) diff --git a/tests/derivation/core/norec t-pi->.. w_ext 002/expected b/tests/derivation/core/norec t-pi->.. w_ext 002/expected index 9be5757c4..903039e8e 100644 --- a/tests/derivation/core/norec t-pi->.. w_ext 002/expected +++ b/tests/derivation/core/norec t-pi->.. w_ext 002/expected @@ -1,12 +1,12 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Target types with implicit type parameters are not supported yet +Error: While processing right hand side of checkedGen. Error during reflection: Target type `Builtin.(===)` is not a top-level data definition -DerivedGen:9:63--9:68 +DerivedGen:9:47--9:50 5 | %default total 6 | 7 | %language ElabReflection 8 | 9 | checkedGen : DecEq a => Fuel -> (x, y : a) -> Gen MaybeEmpty (x = y) - ^^^^^ + ^^^ diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/expected b/tests/derivation/core/norec t-pi->.. w_ext 003/expected index 37b409bfc..bde9b1876 100644 --- a/tests/derivation/core/norec t-pi->.. w_ext 003/expected +++ b/tests/derivation/core/norec t-pi->.. w_ext 003/expected @@ -1,12 +1,47 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Target types with implicit type parameters are not supported yet - -DerivedGen:25:81--25:92 - 21 | - 22 | Show (X n i1 i2) where - 23 | show $ MkX i1 i2 prf = "MkX \{show i1} \{show i2} \{show prf}" - 24 | - 25 | checkedGen : Fuel -> (Fuel -> {n : Nat} -> (i1, i2 : Fin n) -> Gen MaybeEmpty $ FinEq i1 i2) => - ^^^^^^^^^^^ - +Generated values: +----- +----- +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +MkX 1 1 These Here +----- +----- +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) +----- +MkX 2 2 These (These Here) diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-expl-big/DerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-big/DerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-big/DerivedGen.idr diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-expl-big/RunDerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-big/RunDerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-big/RunDerivedGen.idr diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/derive.ipkg b/tests/derivation/least-effort/print/regression/dependent-givens-expl-big/derive.ipkg similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-big/derive.ipkg rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-big/derive.ipkg diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/expected b/tests/derivation/least-effort/print/regression/dependent-givens-expl-big/expected similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-big/expected rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-big/expected diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-big/run b/tests/derivation/least-effort/print/regression/dependent-givens-expl-big/run similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-big/run rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-big/run diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/DerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-deep/DerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/DerivedGen.idr diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/RunDerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-deep/RunDerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/RunDerivedGen.idr diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/derive.ipkg b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/derive.ipkg similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-deep/derive.ipkg rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/derive.ipkg diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/expected similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-deep/expected rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/expected diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-deep/run b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/run similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-deep/run rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-deep/run diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/DerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/DerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/DerivedGen.idr diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/RunDerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/RunDerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/RunDerivedGen.idr diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/derive.ipkg b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/derive.ipkg similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/derive.ipkg rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/derive.ipkg diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/expected similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/expected rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/expected diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/run b/tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/run similarity index 100% rename from tests/derivation/least-effort/print/regression/dependent-givens-small-shallow/run rename to tests/derivation/least-effort/print/regression/dependent-givens-expl-small-shallow/run diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/DerivedGen.idr new file mode 100644 index 000000000..1503383f9 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/DerivedGen.idr @@ -0,0 +1,68 @@ +module DerivedGen + +import Data.Fin + +import Deriving.DepTyCheck.Gen + +%default total + +data AnyType = PrimTy | RefTy + +DecEq AnyType where + decEq PrimTy PrimTy = Yes Refl + decEq PrimTy RefTy = No $ \case Refl impossible + decEq RefTy PrimTy = No $ \case Refl impossible + decEq RefTy RefTy = Yes Refl + +namespace MaybeAnyType + + -- specialisation since we don't support polymorphism over types yet + public export + data MaybeAnyType + = Nothing + | Just AnyType + + export + Injective MaybeAnyType.Just where + injective Refl = Refl + + export + DecEq MaybeAnyType where + decEq Nothing Nothing = Yes Refl + decEq Nothing (Just _) = No $ \case Refl impossible + decEq (Just _) Nothing = No $ \case Refl impossible + decEq (Just x) (Just y) = decEqCong $ decEq x y + +namespace VectMaybeAnyType + + -- specialisation since we don't support polymorphism over types yet + public export + data VectMaybeAnyType : Nat -> Type where + Nil : VectMaybeAnyType Z + (::) : MaybeAnyType -> VectMaybeAnyType n -> VectMaybeAnyType (S n) + + public export + index : Fin n -> VectMaybeAnyType n -> MaybeAnyType + index FZ (x::_ ) = x + index (FS i) (_::xs) = index i xs + + export + Biinjective VectMaybeAnyType.(::) where + biinjective Refl = (Refl, Refl) + + export + DecEq (VectMaybeAnyType n) where + decEq [] [] = Yes Refl + decEq (x::xs) (y::ys) = decEqCong2 (decEq x y) (decEq xs ys) + + public export + data AtIndex : Fin n -> MaybeAnyType -> VectMaybeAnyType n -> Type where + Here : AtIndex FZ x (x::xs) + There : {n : Nat} -> {0 i : Fin n} -> {0 zs : VectMaybeAnyType n} -> + AtIndex i x zs -> AtIndex (FS i) x (z::zs) + +%language ElabReflection + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ + Fuel -> {n : Nat} -> (v : VectMaybeAnyType n) -> Gen MaybeEmpty (i ** t ** AtIndex i t v) diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-big/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/RunDerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-big/RunDerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-big/RunDerivedGen.idr diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-big/derive.ipkg b/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/derive.ipkg similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-big/derive.ipkg rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-big/derive.ipkg diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/expected b/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/expected new file mode 100644 index 000000000..1fc94226b --- /dev/null +++ b/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/expected @@ -0,0 +1,185 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (v : VectMaybeAnyType n) -> Gen MaybeEmpty (i : Fin n ** (t : MaybeAnyType ** AtIndex i t v)) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ImplicitArg (Just "outer^") implicitTrue +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 3]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "DerivedGen.VectMaybeAnyType.VectMaybeAnyType" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "n") + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Data.Fin.Fin" .$ var "n") + .=> var "Builtin.DPair.DPair" + .$ var "DerivedGen.MaybeAnyType.MaybeAnyType" + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") (var "DerivedGen.MaybeAnyType.MaybeAnyType") + .=> var "DerivedGen.VectMaybeAnyType.AtIndex" + .! ("n", var "n") + .$ var "{arg:2}" + .$ var "{arg:3}" + .$ var "{arg:1}"))) + }) + , IDef + emptyFC + "[0, 3]" + [ var "[0, 3]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "DerivedGen.VectMaybeAnyType.VectMaybeAnyType" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "n") + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Data.Fin.Fin" .$ var "n") + .=> var "Builtin.DPair.DPair" + .$ var "DerivedGen.MaybeAnyType.MaybeAnyType" + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") (var "DerivedGen.MaybeAnyType.MaybeAnyType") + .=> var "DerivedGen.VectMaybeAnyType.AtIndex" + .! ("n", var "n") + .$ var "{arg:2}" + .$ var "{arg:3}" + .$ var "{arg:1}"))) + }) + , IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "DerivedGen.VectMaybeAnyType.VectMaybeAnyType" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "n") + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Data.Fin.Fin" .$ var "n") + .=> var "Builtin.DPair.DPair" + .$ var "DerivedGen.MaybeAnyType.MaybeAnyType" + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") (var "DerivedGen.MaybeAnyType.MaybeAnyType") + .=> var "DerivedGen.VectMaybeAnyType.AtIndex" + .! ("n", var "n") + .$ var "{arg:2}" + .$ var "{arg:3}" + .$ var "{arg:1}"))) + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "^bnd^{n:4022}") + .$ (var "DerivedGen.VectMaybeAnyType.(::)" .! ("n", implicitTrue) .$ bindVar "x" .$ bindVar "xs") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.VectMaybeAnyType.Here (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.VectMaybeAnyType.Here" + .! ("{n:4022}", implicitTrue) + .! ("xs", var "xs") + .! ("x", var "x"))))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ (var "DerivedGen.VectMaybeAnyType.(::)" .! ("n", implicitTrue) .$ bindVar "z" .$ bindVar "zs") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.VectMaybeAnyType.There (orders)")) + .$ ( var ">>=" + .$ (var "[0, 3]" .$ var "^cons_fuel^" .$ var "n" .$ var "zs") + .$ ( MkArg MW ExplicitArg (Just "{lamc:0}") implicitFalse + .=> iCase + { sc = var "{lamc:0}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" + .$ bindVar "i" + .$ (var "Builtin.DPair.MkDPair" .$ bindVar "x" .$ bindVar "^bnd^{arg:4}") + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.VectMaybeAnyType.There" + .! ("z", var "z") + .! ("x", implicitTrue) + .! ("n", implicitTrue) + .! ("i", implicitTrue) + .! ("zs", implicitTrue) + .$ var "^bnd^{arg:4}"))) + ] + })) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + iCase + { sc = var "^fuel_arg^" + , ty = var "Data.Fuel.Fuel" + , clauses = + [ var "Data.Fuel.Dry" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.VectMaybeAnyType.AtIndex[0, 3] (dry fuel)")) + .$ ( var "<>" + .$ var "Data.Fuel.Dry" + .$ var "inter^" + .$ var "inter^<{arg:1}>") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.VectMaybeAnyType.AtIndex[0, 3] (spend fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:1}>")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Util.Reflection.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^<{arg:1}>")) + .$ var "Nil"))) + ] + } + } + ] + ] + , scope = var "[0, 3]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-big/run b/tests/derivation/least-effort/print/regression/dependent-givens-impl-big/run similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-big/run rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-big/run diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/DerivedGen.idr new file mode 100644 index 000000000..8530a597f --- /dev/null +++ b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/DerivedGen.idr @@ -0,0 +1,15 @@ +module DerivedGen + +import Data.Fin + +import Deriving.DepTyCheck.Gen + +%default total + +data X : Fin n -> Type where + MkX : (n : _) -> (f : Fin n) -> X (FS (FS f)) + +%language ElabReflection + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty $ X f diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-deep/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/RunDerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-deep/RunDerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/RunDerivedGen.idr diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-deep/derive.ipkg b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/derive.ipkg similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-deep/derive.ipkg rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/derive.ipkg diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/expected b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/expected new file mode 100644 index 000000000..a33ca544f --- /dev/null +++ b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/expected @@ -0,0 +1,70 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty (X f) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .! ("n", var "n") .$ var "{arg:1}") + }) + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .! ("n", var "n") .$ var "{arg:1}") + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ (var "Prelude.Types.S" .$ bindVar "n")) + .$ ( var "Data.Fin.FS" + .! ("k", var "Prelude.Types.S" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ bindVar "f")) + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ implicitTrue .$ var "f")) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0, 1] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^<{arg:1}>") + } + ] + ] + , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-deep/run b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/run similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-deep/run rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-small-deep/run diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/DerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/DerivedGen.idr new file mode 100644 index 000000000..c8643b51e --- /dev/null +++ b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/DerivedGen.idr @@ -0,0 +1,15 @@ +module DerivedGen + +import Data.Fin + +import Deriving.DepTyCheck.Gen + +%default total + +data X : Fin n -> Type where + MkX : (n : _) -> (f : Fin n) -> X (FS f) + +%language ElabReflection + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty $ X f diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/RunDerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/RunDerivedGen.idr rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/RunDerivedGen.idr diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/derive.ipkg b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/derive.ipkg similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/derive.ipkg rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/derive.ipkg diff --git a/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/expected b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/expected new file mode 100644 index 000000000..b123bf5d3 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/expected @@ -0,0 +1,68 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty (X f) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .! ("n", var "n") .$ var "{arg:1}") + }) + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .! ("n", var "n") .$ var "{arg:1}") + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "n") + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ bindVar "f") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ implicitTrue .$ var "f")) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0, 1] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^<{arg:1}>") + } + ] + ] + , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/run b/tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/run similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/run rename to tests/derivation/least-effort/print/regression/dependent-givens-impl-small-shallow/run diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/DerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/DerivedGen.idr new file mode 100644 index 000000000..172917855 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import Data.Fin + +import Deriving.DepTyCheck.Gen + +%default total + +data IsFS : Fin n -> Type where + ItIsFS : IsFS (FS i) + +%language ElabReflection + +%logging "deptycheck.derive.print" 5 +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ + Fuel -> {n : Nat} -> (v : Fin n) -> Gen MaybeEmpty $ IsFS v diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/RunDerivedGen.idr b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/derive.ipkg b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/expected b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/expected new file mode 100644 index 000000000..908255536 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/expected @@ -0,0 +1,68 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (v : Fin n) -> Gen MaybeEmpty (IsFS v) + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ImplicitArg (Just "outer^") implicitTrue +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.IsFS" .! ("n", var "n") .$ var "{arg:1}") + }) + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + emptyFC + MW + Export + [] + (mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fin.Fin" .$ var "n") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.IsFS" .! ("n", var "n") .$ var "{arg:1}") + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "^bnd^{k:3639}") + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ bindVar "i") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.ItIsFS (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.ItIsFS" .! ("{k:3639}", implicitTrue) .! ("i", var "i"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.IsFS[0, 1] (non-recursive)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^<{arg:1}>") + } + ] + ] + , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/run b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/regression/underscore-in-cons-impl-full/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-big/DerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/DerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-big/DerivedGen.idr rename to tests/derivation/least-effort/run/regression/dependent-givens-expl-big/DerivedGen.idr diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/derive.ipkg b/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-big/expected b/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/expected similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-big/expected rename to tests/derivation/least-effort/run/regression/dependent-givens-expl-big/expected diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/run b/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-big/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-deep/DerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/DerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-deep/DerivedGen.idr rename to tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/DerivedGen.idr diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/derive.ipkg b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-deep/expected b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/expected similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-deep/expected rename to tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/expected diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/run b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-deep/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/DerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/DerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/DerivedGen.idr rename to tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/DerivedGen.idr diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/derive.ipkg b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/expected b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/expected similarity index 100% rename from tests/derivation/least-effort/run/regression/dependent-givens-small-shallow/expected rename to tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/expected diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/run b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-expl-small-shallow/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/DerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/DerivedGen.idr new file mode 100644 index 000000000..e9bfd6b8f --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/DerivedGen.idr @@ -0,0 +1,96 @@ +module DerivedGen + +import RunDerivedGen + +import Data.Fin + +%default total + +data AnyType = PrimTy | RefTy + +DecEq AnyType where + decEq PrimTy PrimTy = Yes Refl + decEq PrimTy RefTy = No $ \case Refl impossible + decEq RefTy PrimTy = No $ \case Refl impossible + decEq RefTy RefTy = Yes Refl + +Show AnyType where + show PrimTy = "PrimTy" + show RefTy = "RefTy" + +namespace MaybeAnyType + + -- specialisation since we don't support polymorphism over types yet + public export + data MaybeAnyType + = Nothing + | Just AnyType + + public export + Show MaybeAnyType where + show Nothing = "Nothing" + show (Just x) = "Just \{show x}" + + export + Injective MaybeAnyType.Just where + injective Refl = Refl + + export + DecEq MaybeAnyType where + decEq Nothing Nothing = Yes Refl + decEq Nothing (Just _) = No $ \case Refl impossible + decEq (Just _) Nothing = No $ \case Refl impossible + decEq (Just x) (Just y) = decEqCong $ decEq x y + +namespace VectMaybeAnyType + + -- specialisation since we don't support polymorphism over types yet + public export + data VectMaybeAnyType : Nat -> Type where + Nil : VectMaybeAnyType Z + (::) : MaybeAnyType -> VectMaybeAnyType n -> VectMaybeAnyType (S n) + + public export + toVect : VectMaybeAnyType n -> Vect n MaybeAnyType + toVect [] = [] + toVect (x::xs) = x :: toVect xs + + public export + Show (VectMaybeAnyType n) where + show = show . toVect + + public export + index : Fin n -> VectMaybeAnyType n -> MaybeAnyType + index FZ (x::_ ) = x + index (FS i) (_::xs) = index i xs + + export + Biinjective VectMaybeAnyType.(::) where + biinjective Refl = (Refl, Refl) + + export + DecEq (VectMaybeAnyType n) where + decEq [] [] = Yes Refl + decEq (x::xs) (y::ys) = decEqCong2 (decEq x y) (decEq xs ys) + + public export + data AtIndex : Fin n -> MaybeAnyType -> VectMaybeAnyType n -> Type where + Here : AtIndex FZ x (x::xs) + There : {n : _} -> {0 i : Fin n} -> {0 zs : VectMaybeAnyType n} -> + AtIndex i x zs -> AtIndex (FS i) x (z::zs) + + export + Show (AtIndex i t vs) where + show Here = "!" + show (There x) = "." ++ show x + +%language ElabReflection + +checkedGen : Fuel -> {n : Nat} -> (v : VectMaybeAnyType n) -> Gen MaybeEmpty (i ** t ** AtIndex i t v) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl [Nothing, Just PrimTy, Just RefTy] + , G $ \fl => checkedGen fl [] + ] diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/derive.ipkg b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/expected b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/expected new file mode 100644 index 000000000..93330384a --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +(2 ** (Just RefTy ** ..!)) +----- +(2 ** (Just RefTy ** ..!)) +----- +(2 ** (Just RefTy ** ..!)) +----- +(2 ** (Just RefTy ** ..!)) +----- +(2 ** (Just RefTy ** ..!)) +----- +(1 ** (Just PrimTy ** .!)) +----- +(2 ** (Just RefTy ** ..!)) +----- +(2 ** (Just RefTy ** ..!)) +----- +(2 ** (Just RefTy ** ..!)) +----- +(2 ** (Just RefTy ** ..!)) +----- diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/run b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-big/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/DerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/DerivedGen.idr new file mode 100644 index 000000000..ec7f1aba9 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import RunDerivedGen + +import Data.Fin + +%default total + +data X : Fin n -> Type where + MkX : (n : _) -> (f : Fin n) -> X (FS (FS f)) + +Show (X f) where + show $ MkX n f = "MkX \{show n} \{show f}" + +%language ElabReflection + +checkedGen : Fuel -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty $ X f +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl 3 0 + , G $ \fl => checkedGen fl 5 4 + ] diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/derive.ipkg b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/expected b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/expected new file mode 100644 index 000000000..9ea1a4eeb --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +----- +MkX 3 2 +----- +MkX 3 2 +----- +MkX 3 2 +----- +MkX 3 2 +----- +MkX 3 2 +----- +MkX 3 2 +----- +MkX 3 2 +----- +MkX 3 2 +----- +MkX 3 2 +----- +MkX 3 2 diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/run b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-deep/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/DerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/DerivedGen.idr new file mode 100644 index 000000000..2864357ff --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import RunDerivedGen + +import Data.Fin + +%default total + +data X : Fin n -> Type where + MkX : (n : _) -> (f : Fin n) -> X (FS f) + +Show (X f) where + show $ MkX n f = "MkX \{show n} \{show f}" + +%language ElabReflection + +checkedGen : Fuel -> (n : Nat) -> (f : Fin n) -> Gen MaybeEmpty $ X f +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl 3 0 + , G $ \fl => checkedGen fl 2 1 + ] diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/derive.ipkg b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/expected b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/expected new file mode 100644 index 000000000..e2a9b3c95 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +----- +MkX 1 0 +----- +MkX 1 0 +----- +MkX 1 0 +----- +MkX 1 0 +----- +MkX 1 0 +----- +MkX 1 0 +----- +MkX 1 0 +----- +MkX 1 0 +----- +MkX 1 0 +----- +MkX 1 0 diff --git a/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/run b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/dependent-givens-impl-small-shallow/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected index 27a5e5d66..3f3b00acd 100644 --- a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Sorry, I can't find any elaboration which works. All errors: Possible error: - Error during reflection: While processing right hand side of {u:1837},[0]. While processing right hand side of $resolved13830,<>. {k:1755} is not accessible in this context. + Error during reflection: While processing right hand side of {u:1837},[0]. While processing right hand side of $resolved13823,<>. {k:1755} is not accessible in this context. Possible error: Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/DerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/DerivedGen.idr new file mode 100644 index 000000000..ac9136e1d --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import RunDerivedGen + +import Data.Fin + +%default total + +data IsFS : Fin n -> Type where + ItIsFS : IsFS (FS i) + +Show (IsFS vs) where show ItIsFS = "ItIsFS" + +%language ElabReflection + +checkedGen : Fuel -> {n : Nat} -> (v : Fin n) -> Gen MaybeEmpty $ IsFS v +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO () +main = runGs + [ G $ \fl => checkedGen fl $ the (Fin 4) 3 + , G $ \fl => checkedGen fl $ the (Fin 3) 0 + ] diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/RunDerivedGen.idr b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/derive.ipkg b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/expected b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/expected new file mode 100644 index 000000000..c2be1814b --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- +ItIsFS +----- diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/run b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-impl-full/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From f12099c9101bfb93787e2321154e74b7f4c29a45 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Tue, 17 Sep 2024 13:17:07 +0300 Subject: [PATCH 46/53] [ example ] Use implicit type arguments in `pil-fun` example --- examples/pil-fun/src/Language/PilFun.idr | 20 +++++++------- .../pil-fun/src/Language/PilFun/Pretty.idr | 26 +++++++++---------- .../src/Language/PilFun/Pretty/DSL.idr | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/pil-fun/src/Language/PilFun.idr b/examples/pil-fun/src/Language/PilFun.idr index 07e7b0ee8..46e670b63 100644 --- a/examples/pil-fun/src/Language/PilFun.idr +++ b/examples/pil-fun/src/Language/PilFun.idr @@ -113,10 +113,10 @@ namespace SnocListTyMut decEq ((:<) _ _ _) [<] = No $ \case Refl impossible public export - data AtIndex : (sx : SnocListTyMut) -> (idx : IndexIn sx) -> Ty -> Mut -> Type where + data AtIndex : {sx : SnocListTyMut} -> (idx : IndexIn sx) -> Ty -> Mut -> Type where [search sx idx] - Here' : AtIndex ((:<) sx ty mut) Here ty mut - There' : AtIndex sx i ty mut -> AtIndex ((:<) sx x m) (There i) ty mut + Here' : AtIndex {sx = (:<) sx ty mut} Here ty mut + There' : AtIndex {sx} i ty mut -> AtIndex {sx = (:<) sx x m} (There i) ty mut ||| Add a bunch of immutable variables public export @@ -167,10 +167,10 @@ namespace SnocListFunSig (.length) = length public export - data AtIndex : (sx : SnocListFunSig) -> (idx : IndexIn sx) -> FunSig -> Type where + data AtIndex : {sx : SnocListFunSig} -> (idx : IndexIn sx) -> FunSig -> Type where [search sx idx] - Here' : AtIndex (sx :< sig) Here sig - There' : AtIndex sx i sig -> AtIndex (sx :< x) (There i) sig + Here' : AtIndex {sx = sx :< sig} Here sig + There' : AtIndex {sx} i sig -> AtIndex {sx = sx :< x} (There i) sig public export Vars : Type @@ -189,11 +189,11 @@ data Expr : Funs -> Vars -> Ty -> Type where C : (x : Literal ty) -> Expr funs vars ty V : (n : IndexIn vars) -> - AtIndex vars n ty mut => + AtIndex n ty mut => Expr funs vars ty F : (n : IndexIn funs) -> - AtIndex funs n (from ==> Just to) => + AtIndex n (from ==> Just to) => ExprsSnocList funs vars from -> Expr funs vars to @@ -220,7 +220,7 @@ data Stmts : (funs : Funs) -> Stmts funs vars retTy (#=) : (n : IndexIn vars) -> - AtIndex vars n ty Mutable => + AtIndex n ty Mutable => (v : Expr funs vars ty) -> (cont : Stmts funs vars retTy) -> Stmts funs vars retTy @@ -231,7 +231,7 @@ data Stmts : (funs : Funs) -> Stmts funs vars retTy Call : (n : IndexIn funs) -> - AtIndex funs n (from ==> Nothing) => + AtIndex n (from ==> Nothing) => ExprsSnocList funs vars from -> (cont : Stmts funs vars retTy) -> Stmts funs vars retTy diff --git a/examples/pil-fun/src/Language/PilFun/Pretty.idr b/examples/pil-fun/src/Language/PilFun/Pretty.idr index 0d1d280b8..98d4bdaab 100644 --- a/examples/pil-fun/src/Language/PilFun/Pretty.idr +++ b/examples/pil-fun/src/Language/PilFun/Pretty.idr @@ -21,37 +21,37 @@ import System.Random.Pure.StdGen public export data UniqNames : Funs -> Vars -> Type public export -data NameIsNew : (funs : Funs) -> (vars : Vars) -> UniqNames funs vars -> String -> Type +data NameIsNew : UniqNames funs vars -> String -> Type data UniqNames : Funs -> Vars -> Type where Empty : UniqNames [<] [<] - JustNew : (ss : UniqNames funs vars) => (s : String) -> (0 _ : NameIsNew funs vars ss s) => UniqNames funs vars - NewFun : (ss : UniqNames funs vars) => (s : String) -> (0 _ : NameIsNew funs vars ss s) => + JustNew : (ss : UniqNames funs vars) => (s : String) -> (0 _ : NameIsNew ss s) => UniqNames funs vars + NewFun : (ss : UniqNames funs vars) => (s : String) -> (0 _ : NameIsNew ss s) => {default False isInfix : Bool} -> (0 infixCond : So $ not isInfix || fun.From.length >= 1) => UniqNames (funs: (s : String) -> (0 _ : NameIsNew funs vars ss s) => UniqNames funs ((:<) vars var mut) + NewVar : (ss : UniqNames funs vars) => (s : String) -> (0 _ : NameIsNew ss s) => UniqNames funs ((:<) vars var mut) -data NameIsNew : (funs : Funs) -> (vars : Vars) -> UniqNames funs vars -> String -> Type where - E : NameIsNew [<] [<] Empty x - J : (0 _ : So $ x /= s) -> NameIsNew funs vars ss x -> NameIsNew funs vars (JustNew @{ss} s @{sub}) x - F : (0 _ : So $ x /= s) -> NameIsNew funs vars ss x -> NameIsNew (funs: NameIsNew funs vars ss x -> NameIsNew funs ((:<) vars var mut) (NewVar @{ss} s @{sub}) x +data NameIsNew : UniqNames funs vars -> String -> Type where + E : NameIsNew {funs=[<]} {vars=[<]} Empty x + J : (0 _ : So $ x /= s) -> NameIsNew {funs} {vars} ss x -> NameIsNew {funs} {vars} (JustNew @{ss} s @{sub}) x + F : (0 _ : So $ x /= s) -> NameIsNew {funs} {vars} ss x -> NameIsNew {funs=funs: NameIsNew {funs} {vars} ss x -> NameIsNew {funs} {vars=(:<) vars var mut} (NewVar @{ss} s @{sub}) x public export interface NamesRestrictions where reservedKeywords : SortedSet String rawNewName : Fuel -> (Fuel -> Gen MaybeEmpty String) => - (funs : Funs) -> (vars : Vars) -> (names : UniqNames funs vars) -> - Gen MaybeEmpty (s ** NameIsNew funs vars names s) + (vars : Vars) -> (funs : Funs) -> (names : UniqNames funs vars) -> + Gen MaybeEmpty (s ** NameIsNew names s) export genNewName : Fuel -> (Fuel -> Gen MaybeEmpty String) => NamesRestrictions => (funs : Funs) -> (vars : Vars) -> (names : UniqNames funs vars) -> - Gen MaybeEmpty (s ** NameIsNew funs vars names s) + Gen MaybeEmpty (s ** NameIsNew names s) genNewName fl @{genStr} funs vars names = do - nn@(nm ** _) <- rawNewName fl @{genStr} funs vars names + nn@(nm ** _) <- rawNewName fl @{genStr} vars funs names if reservedKeywords `contains'` nm then assert_total $ genNewName fl @{genStr} funs vars names -- we could reduce fuel instead of `assert_total` else pure nn diff --git a/examples/pil-fun/src/Language/PilFun/Pretty/DSL.idr b/examples/pil-fun/src/Language/PilFun/Pretty/DSL.idr index 09c3a2a8b..29f98f207 100644 --- a/examples/pil-fun/src/Language/PilFun/Pretty/DSL.idr +++ b/examples/pil-fun/src/Language/PilFun/Pretty/DSL.idr @@ -17,7 +17,7 @@ public export %inline AddFun : (isInfix : Bool) -> (s : String) -> (fun : FunSig) -> (0 _ : So $ not isInfix || fun.From.length >= 1) => (ctx : NamedCtxt) -> - (0 _ : NameIsNew ctx.functions ctx.variables ctx.fvNames s) => + (0 _ : NameIsNew ctx.fvNames s) => NamedCtxt AddFun isInfix s fun $ MkNamedCtxt funs vars names = MkNamedCtxt (funs: Date: Tue, 17 Sep 2024 18:07:55 +0300 Subject: [PATCH 47/53] [ test ] Stabilize compilation output in tests --- tests/derivation/_common/run | 4 ++- .../non-cons given match 001-neg/expected | 2 +- .../core/norec nodep noext 003-neg/expected | 2 +- .../core/norec nodep noext 004-neg/expected | 2 +- .../core/norec nodep noext 005-neg/expected | 2 +- .../core/norec part noext 001-neg/expected | 2 +- .../core/norec part noext 002-neg/expected | 2 +- .../core/norec part noext 003/expected | 2 +- .../core/norec part noext 004/expected | 2 +- .../core/norec part noext 005/expected | 2 +- .../core/norec part w_ext 001/expected | 2 +- .../core/norec part w_ext 002/expected | 2 +- .../core/norec part w_ext 003/expected | 2 +- .../core/norec part w_ext 004-neg/expected | 2 +- .../core/norec part w_ext 005-neg/expected | 2 +- .../core/norec part w_ext 006-neg/expected | 2 +- .../core/norec t-p.->.. w_ext 001/expected | 2 +- .../core/norec t-p.->.. w_ext 002/expected | 2 +- .../norec t-p.->.. w_ext 003-neg/expected | 2 +- .../norec t-p.->.. w_ext 004-neg/expected | 2 +- .../core/norec t-p.->.. w_ext 005/expected | 2 +- .../core/norec t-p.->.. w_ext 006/expected | 2 +- .../core/norec t-pi->.. noext 001/expected | 2 +- .../core/norec t-pi->.. noext 002/expected | 2 +- .../core/norec t-pi->.. noext 003/expected | 2 +- .../core/norec t-pi->.. noext 004/expected | 2 +- .../core/norec t-pi->.. w_ext 002/expected | 2 +- .../derivation/core/trivial 002-neg/expected | 2 +- .../derivation/core/trivial 003-neg/expected | 2 +- .../derivation/core/trivial 004-neg/expected | 2 +- .../core/typealias con 003-neg/expected | 2 +- tests/derivation/inputvalidation/_common/run | 4 +++ .../bad-args-in-target-type/expected | 4 +-- .../inputvalidation/bad-fuel/expected | 34 +++++++++---------- .../inputvalidation/bad-param-names/expected | 6 ++-- .../inputvalidation/external-gens/expected | 18 +++++----- .../non-gen-target-type/expected | 8 ++--- .../odd-or-lacking-gen-params/expected | 12 +++---- .../unexpected-gen-target/expected | 32 ++++++++--------- .../unexpected-multiplicity/expected | 14 ++++---- .../wrong-params-order/expected | 14 ++++---- .../run/regression/function-in-cons/expected | 4 +-- .../expected | 4 +-- 43 files changed, 112 insertions(+), 106 deletions(-) diff --git a/tests/derivation/_common/run b/tests/derivation/_common/run index 2a6b6401c..dce1363e6 100755 --- a/tests/derivation/_common/run +++ b/tests/derivation/_common/run @@ -2,8 +2,10 @@ rm -rf build NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names +{ flock "$1" pack -q install-deps derive.ipkg && \ idris2 --check --no-color --console-width 0 --no-banner --find-ipkg DerivedGen.idr && \ -pack exec DerivedGen.idr | "$NAMES_CLEANER" +pack exec DerivedGen.idr +} | "$NAMES_CLEANER" rm -rf build diff --git a/tests/derivation/core/non-cons given match 001-neg/expected b/tests/derivation/core/non-cons given match 001-neg/expected index 6193a796d..400faaef1 100644 --- a/tests/derivation/core/non-cons given match 001-neg/expected +++ b/tests/derivation/core/non-cons given match 001-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Argument #0 is not supported yet, argument expression: DerivedGen.boolToNat x, reason: name `DerivedGen.boolToNat` is not a constructor -DerivedGen:16:22--16:37 +DerivedGen:1 12 | 13 | data X : Nat -> Type where 14 | X0 : X 0 diff --git a/tests/derivation/core/norec nodep noext 003-neg/expected b/tests/derivation/core/norec nodep noext 003-neg/expected index 438c2f507..007035d5a 100644 --- a/tests/derivation/core/norec nodep noext 003-neg/expected +++ b/tests/derivation/core/norec nodep noext 003-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: No constructors found for the type `Builtin.Void` -DerivedGen:16:14--16:23 +DerivedGen:1 12 | XShow : Show X 13 | XShow = %runElab derive 14 | diff --git a/tests/derivation/core/norec nodep noext 004-neg/expected b/tests/derivation/core/norec nodep noext 004-neg/expected index 438c2f507..007035d5a 100644 --- a/tests/derivation/core/norec nodep noext 004-neg/expected +++ b/tests/derivation/core/norec nodep noext 004-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: No constructors found for the type `Builtin.Void` -DerivedGen:16:14--16:23 +DerivedGen:1 12 | XShow : Show X 13 | XShow = %runElab derive 14 | diff --git a/tests/derivation/core/norec nodep noext 005-neg/expected b/tests/derivation/core/norec nodep noext 005-neg/expected index 438c2f507..007035d5a 100644 --- a/tests/derivation/core/norec nodep noext 005-neg/expected +++ b/tests/derivation/core/norec nodep noext 005-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: No constructors found for the type `Builtin.Void` -DerivedGen:16:14--16:23 +DerivedGen:1 12 | XShow : Show X 13 | XShow = %runElab derive 14 | diff --git a/tests/derivation/core/norec part noext 001-neg/expected b/tests/derivation/core/norec part noext 001-neg/expected index 0aa1333b3..020a98a89 100644 --- a/tests/derivation/core/norec part noext 001-neg/expected +++ b/tests/derivation/core/norec part noext 001-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type's argument must be a variable name -DerivedGen:9:44--9:48 +DerivedGen:1 5 | %default total 6 | 7 | %language ElabReflection diff --git a/tests/derivation/core/norec part noext 002-neg/expected b/tests/derivation/core/norec part noext 002-neg/expected index 66b800526..e206a685d 100644 --- a/tests/derivation/core/norec part noext 002-neg/expected +++ b/tests/derivation/core/norec part noext 002-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type's argument must be a variable name -DerivedGen:9:38--9:42 +DerivedGen:1 5 | %default total 6 | 7 | %language ElabReflection diff --git a/tests/derivation/core/norec part noext 003/expected b/tests/derivation/core/norec part noext 003/expected index 71c7da0f9..057ed2b9f 100644 --- a/tests/derivation/core/norec part noext 003/expected +++ b/tests/derivation/core/norec part noext 003/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `ty` -DerivedGen:16:14--16:23 +DerivedGen:1 12 | XShow : Show X 13 | XShow = %runElab derive 14 | diff --git a/tests/derivation/core/norec part noext 004/expected b/tests/derivation/core/norec part noext 004/expected index bb472c03b..21a81b3ab 100644 --- a/tests/derivation/core/norec part noext 004/expected +++ b/tests/derivation/core/norec part noext 004/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` -DerivedGen:17:14--17:23 +DerivedGen:1 13 | XShow = %runElab derive 14 | 15 | export diff --git a/tests/derivation/core/norec part noext 005/expected b/tests/derivation/core/norec part noext 005/expected index bb472c03b..21a81b3ab 100644 --- a/tests/derivation/core/norec part noext 005/expected +++ b/tests/derivation/core/norec part noext 005/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` -DerivedGen:17:14--17:23 +DerivedGen:1 13 | XShow = %runElab derive 14 | 15 | export diff --git a/tests/derivation/core/norec part w_ext 001/expected b/tests/derivation/core/norec part w_ext 001/expected index 299b55a66..53895c73d 100644 --- a/tests/derivation/core/norec part w_ext 001/expected +++ b/tests/derivation/core/norec part w_ext 001/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `ty` -DerivedGen:17:14--17:23 +DerivedGen:1 13 | XShow = %runElab derive 14 | 15 | export diff --git a/tests/derivation/core/norec part w_ext 002/expected b/tests/derivation/core/norec part w_ext 002/expected index ce57cd5c7..7ed07ef1e 100644 --- a/tests/derivation/core/norec part w_ext 002/expected +++ b/tests/derivation/core/norec part w_ext 002/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` -DerivedGen:17:14--17:23 +DerivedGen:1 13 | XShow = %runElab derive 14 | 15 | export diff --git a/tests/derivation/core/norec part w_ext 003/expected b/tests/derivation/core/norec part w_ext 003/expected index ce57cd5c7..7ed07ef1e 100644 --- a/tests/derivation/core/norec part w_ext 003/expected +++ b/tests/derivation/core/norec part w_ext 003/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` -DerivedGen:17:14--17:23 +DerivedGen:1 13 | XShow = %runElab derive 14 | 15 | export diff --git a/tests/derivation/core/norec part w_ext 004-neg/expected b/tests/derivation/core/norec part w_ext 004-neg/expected index 62cdeaa9e..6cfc3bb28 100644 --- a/tests/derivation/core/norec part w_ext 004-neg/expected +++ b/tests/derivation/core/norec part w_ext 004-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type's argument must be a variable name -DerivedGen:10:79--10:85 +DerivedGen:1 06 | 07 | %language ElabReflection 08 | diff --git a/tests/derivation/core/norec part w_ext 005-neg/expected b/tests/derivation/core/norec part w_ext 005-neg/expected index 89f451814..69a049e97 100644 --- a/tests/derivation/core/norec part w_ext 005-neg/expected +++ b/tests/derivation/core/norec part w_ext 005-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type's argument must be a variable name -DerivedGen:10:105--10:111 +DerivedGen:1 06 | 07 | %language ElabReflection 08 | diff --git a/tests/derivation/core/norec part w_ext 006-neg/expected b/tests/derivation/core/norec part w_ext 006-neg/expected index d68ed6986..3a34363f9 100644 --- a/tests/derivation/core/norec part w_ext 006-neg/expected +++ b/tests/derivation/core/norec part w_ext 006-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type's argument must be a variable name -DerivedGen:10:105--10:111 +DerivedGen:1 06 | 07 | %language ElabReflection 08 | diff --git a/tests/derivation/core/norec t-p.->.. w_ext 001/expected b/tests/derivation/core/norec t-p.->.. w_ext 001/expected index 0e5699003..154569e26 100644 --- a/tests/derivation/core/norec t-p.->.. w_ext 001/expected +++ b/tests/derivation/core/norec t-p.->.. w_ext 001/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type `a` is not a top-level data definition -DerivedGen:9:31--9:34 +DerivedGen:1 5 | %default total 6 | 7 | %language ElabReflection diff --git a/tests/derivation/core/norec t-p.->.. w_ext 002/expected b/tests/derivation/core/norec t-p.->.. w_ext 002/expected index df32a565b..cd7f60e18 100644 --- a/tests/derivation/core/norec t-p.->.. w_ext 002/expected +++ b/tests/derivation/core/norec t-p.->.. w_ext 002/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type `b` is not a top-level data definition -DerivedGen:9:31--9:34 +DerivedGen:1 5 | %default total 6 | 7 | %language ElabReflection diff --git a/tests/derivation/core/norec t-p.->.. w_ext 003-neg/expected b/tests/derivation/core/norec t-p.->.. w_ext 003-neg/expected index 173ec346d..8380c3efe 100644 --- a/tests/derivation/core/norec t-p.->.. w_ext 003-neg/expected +++ b/tests/derivation/core/norec t-p.->.. w_ext 003-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: All arguments of the target type must be different -DerivedGen:9:68--9:70 +DerivedGen:1 5 | %default total 6 | 7 | %language ElabReflection diff --git a/tests/derivation/core/norec t-p.->.. w_ext 004-neg/expected b/tests/derivation/core/norec t-p.->.. w_ext 004-neg/expected index 30d8c3fc7..84bc89dd3 100644 --- a/tests/derivation/core/norec t-p.->.. w_ext 004-neg/expected +++ b/tests/derivation/core/norec t-p.->.. w_ext 004-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type's argument must be a variable name -DerivedGen:9:101--9:103 +DerivedGen:1 5 | %default total 6 | 7 | %language ElabReflection diff --git a/tests/derivation/core/norec t-p.->.. w_ext 005/expected b/tests/derivation/core/norec t-p.->.. w_ext 005/expected index 4cd89e9c3..1455dba74 100644 --- a/tests/derivation/core/norec t-p.->.. w_ext 005/expected +++ b/tests/derivation/core/norec t-p.->.. w_ext 005/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type `a` is not a top-level data definition -DerivedGen:14:31--14:34 +DerivedGen:1 10 | 11 | Show a => Show (X a) where 12 | show (MkX m) = "MkX \{show m}" diff --git a/tests/derivation/core/norec t-p.->.. w_ext 006/expected b/tests/derivation/core/norec t-p.->.. w_ext 006/expected index bc1569e89..8df6a2362 100644 --- a/tests/derivation/core/norec t-p.->.. w_ext 006/expected +++ b/tests/derivation/core/norec t-p.->.. w_ext 006/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type `a` is not a top-level data definition -DerivedGen:14:31--14:34 +DerivedGen:1 10 | 11 | Show a => Show b => Show (X a b) where 12 | show (MkX m) = "MkX \{show m}" diff --git a/tests/derivation/core/norec t-pi->.. noext 001/expected b/tests/derivation/core/norec t-pi->.. noext 001/expected index 98ad192ff..6a22c94d4 100644 --- a/tests/derivation/core/norec t-pi->.. noext 001/expected +++ b/tests/derivation/core/norec t-pi->.. noext 001/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type `Builtin.(===)` is not a top-level data definition -DerivedGen:9:39--9:42 +DerivedGen:1 5 | %default total 6 | 7 | %language ElabReflection diff --git a/tests/derivation/core/norec t-pi->.. noext 002/expected b/tests/derivation/core/norec t-pi->.. noext 002/expected index bc185de78..1f97edd49 100644 --- a/tests/derivation/core/norec t-pi->.. noext 002/expected +++ b/tests/derivation/core/norec t-pi->.. noext 002/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type `Builtin.(===)` is not a top-level data definition -DerivedGen:10:38--10:41 +DerivedGen:1 06 | 07 | %language ElabReflection 08 | diff --git a/tests/derivation/core/norec t-pi->.. noext 003/expected b/tests/derivation/core/norec t-pi->.. noext 003/expected index ef9b97a98..3eed7426d 100644 --- a/tests/derivation/core/norec t-pi->.. noext 003/expected +++ b/tests/derivation/core/norec t-pi->.. noext 003/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` -DerivedGen:17:14--17:23 +DerivedGen:1 13 | Show (X b1 b2) where 14 | show (MkX b1 b2 _) = "MkX \{show b1} \{show b2} Refl" 15 | diff --git a/tests/derivation/core/norec t-pi->.. noext 004/expected b/tests/derivation/core/norec t-pi->.. noext 004/expected index c383f4a48..6fa52e62e 100644 --- a/tests/derivation/core/norec t-pi->.. noext 004/expected +++ b/tests/derivation/core/norec t-pi->.. noext 004/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Usupported applications to a non-concrete type `a` -DerivedGen:19:14--19:23 +DerivedGen:1 15 | show (X0 b1 b2 _) = "X0 \{show b1} \{show b2} Refl" 16 | show X1 = "X1" 17 | diff --git a/tests/derivation/core/norec t-pi->.. w_ext 002/expected b/tests/derivation/core/norec t-pi->.. w_ext 002/expected index 903039e8e..1e6b93fa5 100644 --- a/tests/derivation/core/norec t-pi->.. w_ext 002/expected +++ b/tests/derivation/core/norec t-pi->.. w_ext 002/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type `Builtin.(===)` is not a top-level data definition -DerivedGen:9:47--9:50 +DerivedGen:1 5 | %default total 6 | 7 | %language ElabReflection diff --git a/tests/derivation/core/trivial 002-neg/expected b/tests/derivation/core/trivial 002-neg/expected index 10448de01..d92bf5e1c 100644 --- a/tests/derivation/core/trivial 002-neg/expected +++ b/tests/derivation/core/trivial 002-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: No constructors found for the type `Builtin.Void` -DerivedGen:10:14--10:23 +DerivedGen:1 06 | 07 | %language ElabReflection 08 | diff --git a/tests/derivation/core/trivial 003-neg/expected b/tests/derivation/core/trivial 003-neg/expected index c1cbf2086..5b0bf9df8 100644 --- a/tests/derivation/core/trivial 003-neg/expected +++ b/tests/derivation/core/trivial 003-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type of a derived `Gen` cannot be a `Gen` -DerivedGen:13:14--13:23 +DerivedGen:1 09 | Show (x ** Gen MaybeEmpty x) where 10 | show _ = "a generator" 11 | diff --git a/tests/derivation/core/trivial 004-neg/expected b/tests/derivation/core/trivial 004-neg/expected index cbcf2bcba..a50e131d3 100644 --- a/tests/derivation/core/trivial 004-neg/expected +++ b/tests/derivation/core/trivial 004-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Target type of a derived `Gen` cannot be a `Gen` -DerivedGen:13:14--13:23 +DerivedGen:1 09 | Show (Gen em x) where 10 | show _ = "a generator" 11 | diff --git a/tests/derivation/core/typealias con 003-neg/expected b/tests/derivation/core/typealias con 003-neg/expected index 643a680c3..425e0a9b5 100644 --- a/tests/derivation/core/typealias con 003-neg/expected +++ b/tests/derivation/core/typealias con 003-neg/expected @@ -2,7 +2,7 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Error during reflection: Data type `DerivedGen.NonReducibleUseTypeAlias` is unavailable at the site of derivation (forgotten import?) -DerivedGen:16:22--16:46 +DerivedGen:1 12 | 13 | data X : Type where 14 | X0 : X diff --git a/tests/derivation/inputvalidation/_common/run b/tests/derivation/inputvalidation/_common/run index 0eb8a358f..12cade9be 100755 --- a/tests/derivation/inputvalidation/_common/run +++ b/tests/derivation/inputvalidation/_common/run @@ -1,6 +1,10 @@ rm -rf build +NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names + +{ flock "$1" pack -q install-deps validate-input.ipkg && \ idris2 --check --no-color --console-width 0 --no-banner --find-ipkg ValidateInput.idr +} | "$NAMES_CLEANER" rm -rf build diff --git a/tests/derivation/inputvalidation/bad-args-in-target-type/expected b/tests/derivation/inputvalidation/bad-args-in-target-type/expected index d9d83dcca..0caef74a1 100644 --- a/tests/derivation/inputvalidation/bad-args-in-target-type/expected +++ b/tests/derivation/inputvalidation/bad-args-in-target-type/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of genY_Int. Error during reflection: Target type's argument must be a variable name -ValidateInput:14:55--14:58 +ValidateInput:1 10 | MkY : Y Int String 11 | 12 | --- Non-variable arguments of the target type --- @@ -11,7 +11,7 @@ ValidateInput:14:55--14:58 Error: While processing right hand side of genY_same_param. Error during reflection: All arguments of the target type must be different -ValidateInput:17:58--17:63 +ValidateInput:2 13 | 14 | genY_Int : Fuel -> (a : Type) -> Gen MaybeEmpty $ Y a Int 15 | genY_Int = deriveGen diff --git a/tests/derivation/inputvalidation/bad-fuel/expected b/tests/derivation/inputvalidation/bad-fuel/expected index dcd2c608f..5841b01d3 100644 --- a/tests/derivation/inputvalidation/bad-fuel/expected +++ b/tests/derivation/inputvalidation/bad-fuel/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of genY_noFuel_given. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:16:29--16:33 +ValidateInput:1 12 | MkY : Y Int String 13 | 14 | --- No fuel argument --- @@ -11,7 +11,7 @@ ValidateInput:16:29--16:33 Error: While processing right hand side of genY_noFuel_given'. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:19:22--19:25 +ValidateInput:2 15 | 16 | genY_noFuel_given : (a, b : Type) -> Gen MaybeEmpty $ Y a b 17 | genY_noFuel_given = deriveGen @@ -21,7 +21,7 @@ ValidateInput:19:22--19:25 Error: While processing right hand side of genY_noFuel_given''. Error during reflection: The first argument must be of type `Fuel` -ValidateInput:22:23--22:24 +ValidateInput:3 18 | 19 | genY_noFuel_given' : Int -> (a, b : Type) -> Gen MaybeEmpty $ Y a b 20 | genY_noFuel_given' = deriveGen @@ -31,7 +31,7 @@ ValidateInput:22:23--22:24 Error: While processing right hand side of genY_noFuel_mid. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:25:24--25:28 +ValidateInput:4 21 | 22 | genY_noFuel_given'' : X -> (a, b : Type) -> Gen MaybeEmpty $ Y a b 23 | genY_noFuel_given'' = deriveGen @@ -41,7 +41,7 @@ ValidateInput:25:24--25:28 Error: While processing right hand side of genY_noFuel_mid'. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:28:25--28:29 +ValidateInput:5 24 | 25 | genY_noFuel_mid : (b : Type) -> Gen MaybeEmpty (a ** Y a b) 26 | genY_noFuel_mid = deriveGen @@ -51,7 +51,7 @@ ValidateInput:28:25--28:29 Error: While processing right hand side of genY_noFuel_gened. Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present -ValidateInput:31:21--31:53 +ValidateInput:6 27 | 28 | genY_noFuel_mid' : (b : Type) -> Gen MaybeEmpty $ DPair {a = Type, p = \a => Y a b} 29 | genY_noFuel_mid' = deriveGen @@ -61,7 +61,7 @@ ValidateInput:31:21--31:53 Error: While processing right hand side of genY_missplFuel_aft. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:36:31--36:35 +ValidateInput:7 32 | genY_noFuel_gened = deriveGen 33 | 34 | --- Misplaced fuel argument --- @@ -71,7 +71,7 @@ ValidateInput:36:31--36:35 Error: While processing right hand side of genY_missplFuel_mid. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:39:28--39:32 +ValidateInput:8 35 | 36 | genY_missplFuel_aft : (a, b : Type) -> Fuel -> Gen MaybeEmpty $ Y a b 37 | genY_missplFuel_aft = deriveGen @@ -81,7 +81,7 @@ ValidateInput:39:28--39:32 Error: While processing right hand side of genY_missplFuel_aft_imp. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:50:35--50:39 +ValidateInput:9 46 | -- because even explicit setting type argument of `deriveGen` makes two signatures incompatible. 47 | 48 | --- Misplaced + implicit fuel argument --- @@ -91,7 +91,7 @@ ValidateInput:50:35--50:39 Error: While processing right hand side of genY_missplFuel_mid_imp. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:53:32--53:36 +ValidateInput:10 49 | 50 | genY_missplFuel_aft_imp : (a, b : Type) -> {_ : Fuel} -> Gen MaybeEmpty $ Y a b 51 | genY_missplFuel_aft_imp = deriveGen @@ -101,7 +101,7 @@ ValidateInput:53:32--53:36 Error: While processing right hand side of genY_missplFuel_aft_autoimpl_imp. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:56:78--56:82 +ValidateInput:11 52 | 53 | genY_missplFuel_mid_imp : (a : Type) -> {_ : Fuel} -> (b : Type) -> Gen MaybeEmpty $ Y a b 54 | genY_missplFuel_mid_imp = deriveGen @@ -111,7 +111,7 @@ ValidateInput:56:78--56:82 Error: While processing right hand side of genY_unnamed_imp_fuel. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:61:47--61:51 +ValidateInput:12 57 | genY_missplFuel_aft_autoimpl_imp = deriveGen 58 | 59 | --- Implicit fuel argument --- @@ -121,7 +121,7 @@ ValidateInput:61:47--61:51 Error: While processing right hand side of genY_named_imp_fuel. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:64:45--64:49 +ValidateInput:13 60 | 61 | genY_unnamed_imp_fuel : {_ : Fuel} -> (a, b : Type) -> Gen MaybeEmpty $ Y a b 62 | genY_unnamed_imp_fuel = deriveGen @@ -131,7 +131,7 @@ ValidateInput:64:45--64:49 Error: While processing right hand side of genY_autoimp_fuel. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:67:37--67:41 +ValidateInput:14 63 | 64 | genY_named_imp_fuel : {f : Fuel} -> (a, b : Type) -> Gen MaybeEmpty $ Y a b 65 | genY_named_imp_fuel = deriveGen @@ -141,7 +141,7 @@ ValidateInput:67:37--67:41 Error: While processing right hand side of genY_defaulted_fuel. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:70:60--70:64 +ValidateInput:15 66 | 67 | genY_autoimp_fuel : Fuel => (a, b : Type) -> Gen MaybeEmpty $ Y a b 68 | genY_autoimp_fuel = deriveGen @@ -151,7 +151,7 @@ ValidateInput:70:60--70:64 Error: While processing right hand side of genY_defaulted_fuel'. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:73:69--73:73 +ValidateInput:16 69 | 70 | genY_defaulted_fuel : {default Dry fuel : Fuel} -> (a, b : Type) -> Gen MaybeEmpty $ Y a b 71 | genY_defaulted_fuel = deriveGen @@ -161,7 +161,7 @@ ValidateInput:73:69--73:73 Error: While processing right hand side of genY_exp_named_fuel. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:78:31--78:35 +ValidateInput:17 74 | genY_defaulted_fuel' = deriveGen 75 | 76 | --- Named explicit fuel --- diff --git a/tests/derivation/inputvalidation/bad-param-names/expected b/tests/derivation/inputvalidation/bad-param-names/expected index 694d834b3..982b55514 100644 --- a/tests/derivation/inputvalidation/bad-param-names/expected +++ b/tests/derivation/inputvalidation/bad-param-names/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of genY_unnamed_argument. Error during reflection: Explicit argument must be named and must not shadow any other name -ValidateInput:14:50--14:53 +ValidateInput:1 10 | MkY : Y Int String 11 | 12 | --- Not all arguments are named --- @@ -11,7 +11,7 @@ ValidateInput:14:50--14:53 Error: While processing right hand side of genY_shadowed_by_auto_argument. Error during reflection: Explicit argument must be named and must not shadow any other name -ValidateInput:19:58--19:62 +ValidateInput:2 15 | genY_unnamed_argument = deriveGen 16 | 17 | --- Arguments shadowing --- @@ -21,7 +21,7 @@ ValidateInput:19:58--19:62 Error: While processing right hand side of genY_shadowed_by_other_argument. Error during reflection: Explicit argument must be named and must not shadow any other name -ValidateInput:22:76--22:80 +ValidateInput:3 18 | 19 | genY_shadowed_by_auto_argument : DecEq a => Fuel -> (a : Type) -> (b : Type) -> Gen MaybeEmpty $ Y a b 20 | genY_shadowed_by_auto_argument = deriveGen diff --git a/tests/derivation/inputvalidation/external-gens/expected b/tests/derivation/inputvalidation/external-gens/expected index 305dd8884..69c742442 100644 --- a/tests/derivation/inputvalidation/external-gens/expected +++ b/tests/derivation/inputvalidation/external-gens/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of genY_repX_autoimpl. Error during reflection: Repetition of an auto-implicit external generator -ValidateInput:18:84--18:85 +ValidateInput:1 14 | MkY : Y Int String 15 | 16 | --- Repeating external gens --- @@ -11,7 +11,7 @@ ValidateInput:18:84--18:85 Error: While processing right hand side of genY_nongen_autoimpl_list. Error during reflection: The result type of the generator function must be of type "`Gen MaybeEmpty` of desired result" -ValidateInput:23:46--23:54 +ValidateInput:2 19 | genY_repX_autoimpl = deriveGen 20 | 21 | --- Non-gen externals --- @@ -21,7 +21,7 @@ ValidateInput:23:46--23:54 Error: While processing right hand side of genY_nongen_autoimpl_pair. Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present -ValidateInput:26:38--26:63 +ValidateInput:3 22 | 23 | genY_nongen_autoimpl_list : Fuel -> (Fuel -> List Int) => (a, b : Type) -> Gen MaybeEmpty $ Y a b 24 | genY_nongen_autoimpl_list = deriveGen @@ -31,7 +31,7 @@ ValidateInput:26:38--26:63 Error: While processing right hand side of genY_nongen_autoimpl_dpair. Error during reflection: The result type of the generator function must be of type "`Gen MaybeEmpty` of desired result" -ValidateInput:29:50--29:52 +ValidateInput:4 25 | 26 | genY_nongen_autoimpl_pair : Fuel -> (Fuel -> Gen MaybeEmpty X, Fuel -> Gen MaybeEmpty X') => (a, b : Type) -> Gen MaybeEmpty $ Y a b 27 | genY_nongen_autoimpl_pair = deriveGen @@ -41,7 +41,7 @@ ValidateInput:29:50--29:52 Error: While processing right hand side of genY_nongen_autoimpl_list_nofuel. Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present -ValidateInput:34:44--34:52 +ValidateInput:5 30 | genY_nongen_autoimpl_dpair = deriveGen 31 | 32 | --- Externals with no fuel --- @@ -51,7 +51,7 @@ ValidateInput:34:44--34:52 Error: While processing right hand side of genY_nongen_autoimpl_pair_nofuel. Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present -ValidateInput:37:45--37:62 +ValidateInput:6 33 | 34 | genY_nongen_autoimpl_list_nofuel : Fuel -> List Int => (a, b : Type) -> Gen MaybeEmpty $ Y a b 35 | genY_nongen_autoimpl_list_nofuel = deriveGen @@ -61,7 +61,7 @@ ValidateInput:37:45--37:62 Error: While processing right hand side of genY_nongen_autoimpl_dpair_nofuel. Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present -ValidateInput:40:48--40:50 +ValidateInput:7 36 | 37 | genY_nongen_autoimpl_pair_nofuel : Fuel -> (Gen MaybeEmpty X, Gen MaybeEmpty X') => (a, b : Type) -> Gen MaybeEmpty $ Y a b 38 | genY_nongen_autoimpl_pair_nofuel = deriveGen @@ -71,7 +71,7 @@ ValidateInput:40:48--40:50 Error: While processing right hand side of genY_require_self_autoimpl. Error during reflection: External generators contain the generator asked to be derived -ValidateInput:46:67--46:70 +ValidateInput:8 42 | 43 | --- Result is alteady in externals --- 44 | @@ -81,7 +81,7 @@ ValidateInput:46:67--46:70 Error: While processing right hand side of genY_autoimpl_in_autoimpl. Error during reflection: Auto-implicit argument should not contain its own auto-implicit arguments -ValidateInput:53:87--53:90 +ValidateInput:9 49 | 50 | --- Auto-implicits are present inside auto-implicits --- 51 | diff --git a/tests/derivation/inputvalidation/non-gen-target-type/expected b/tests/derivation/inputvalidation/non-gen-target-type/expected index 8f8d6dce5..5f4276e6c 100644 --- a/tests/derivation/inputvalidation/non-gen-target-type/expected +++ b/tests/derivation/inputvalidation/non-gen-target-type/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of list. Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present -ValidateInput:14:8--14:16 +ValidateInput:1 10 | MkY : Y Int String 11 | 12 | --- Non-Gen type --- @@ -11,7 +11,7 @@ ValidateInput:14:8--14:16 Error: While processing right hand side of list'. Error during reflection: The result type of the generator function must be of type "`Gen MaybeEmpty` of desired result" -ValidateInput:17:17--17:25 +ValidateInput:2 13 | 14 | list : List Int 15 | list = deriveGen @@ -21,7 +21,7 @@ ValidateInput:17:17--17:25 Error: While processing right hand side of y. Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present -ValidateInput:20:5--20:17 +ValidateInput:3 16 | 17 | list' : Fuel -> List Int 18 | list' = deriveGen @@ -31,7 +31,7 @@ ValidateInput:20:5--20:17 Error: While processing right hand side of y'. Error during reflection: The result type of the generator function must be of type "`Gen MaybeEmpty` of desired result" -ValidateInput:23:14--23:26 +ValidateInput:4 19 | 20 | y : Y Int String 21 | y = deriveGen diff --git a/tests/derivation/inputvalidation/odd-or-lacking-gen-params/expected b/tests/derivation/inputvalidation/odd-or-lacking-gen-params/expected index 42aef19d7..9dbf8dc2c 100644 --- a/tests/derivation/inputvalidation/odd-or-lacking-gen-params/expected +++ b/tests/derivation/inputvalidation/odd-or-lacking-gen-params/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of genY_with_unrelated. Error during reflection: Generated parameter is not used in the target type -ValidateInput:14:77--14:80 +ValidateInput:1 10 | MkY : Y Int String 11 | 12 | --- Unrelated stuff in the resulting dpair --- @@ -11,7 +11,7 @@ ValidateInput:14:77--14:80 Error: While processing right hand side of genY_with_repeating_name_equityped. Error during reflection: Argument of dependent pair under the resulting `Gen` must be named -ValidateInput:17:60--17:106 +ValidateInput:2 13 | 14 | genY_with_unrelated : Fuel -> (a : Type) -> Gen MaybeEmpty (b : Type ** n : Nat ** Y a b) 15 | genY_with_unrelated = deriveGen @@ -25,7 +25,7 @@ and: Type Mismatch between: Nat and Type. -ValidateInput:20:105--20:106 +ValidateInput:3 16 | 17 | genY_with_repeating_name_equityped : Fuel -> (a : Type) -> Gen MaybeEmpty (b : Type ** b : Type ** Y a b) 18 | genY_with_repeating_name_equityped = deriveGen @@ -35,7 +35,7 @@ ValidateInput:20:105--20:106 Error: No type declaration for ValidateInput.genY_with_repeating_name_difflytyped. -ValidateInput:21:1--21:49 +ValidateInput:4 17 | genY_with_repeating_name_equityped : Fuel -> (a : Type) -> Gen MaybeEmpty (b : Type ** b : Type ** Y a b) 18 | genY_with_repeating_name_equityped = deriveGen 19 | @@ -49,7 +49,7 @@ and: Type Mismatch between: Nat and Type. -ValidateInput:23:90--23:98 +ValidateInput:5 19 | 20 | genY_with_repeating_name_difflytyped : Fuel -> (a : Type) -> Gen MaybeEmpty (b : Type ** b : Nat ** Y a b) 21 | genY_with_repeating_name_difflytyped = deriveGen @@ -59,7 +59,7 @@ ValidateInput:23:90--23:98 Error: While processing right hand side of genY_unused_argument. Error during reflection: Given parameter is not used in the target type -ValidateInput:28:54--28:57 +ValidateInput:6 24 | genY_with_repeating_name_difflytyped' = deriveGen 25 | 26 | --- Not all arguments are used --- diff --git a/tests/derivation/inputvalidation/unexpected-gen-target/expected b/tests/derivation/inputvalidation/unexpected-gen-target/expected index 212b4804d..7fbb0aa18 100644 --- a/tests/derivation/inputvalidation/unexpected-gen-target/expected +++ b/tests/derivation/inputvalidation/unexpected-gen-target/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of genOfConcreteGen. Error during reflection: Target type's argument must be a variable name -ValidateInput:16:49--16:59 +ValidateInput:1 12 | MkY : Y Int String 13 | 14 | --- Gen MaybeEmpty of strange things --- @@ -11,7 +11,7 @@ ValidateInput:16:49--16:59 Error: While processing right hand side of genOfLazies. Error during reflection: Target type is not a simple name -ValidateInput:19:40--19:46 +ValidateInput:2 15 | 16 | genOfConcreteGen : Fuel -> Gen MaybeEmpty $ Gen MaybeEmpty X 17 | genOfConcreteGen = deriveGen @@ -21,7 +21,7 @@ ValidateInput:19:40--19:46 Error: While processing right hand side of genOfInfs. Error during reflection: Target type is not a simple name -ValidateInput:22:38--22:43 +ValidateInput:3 18 | 19 | genOfLazies : Fuel -> Gen MaybeEmpty $ Lazy X 20 | genOfLazies = deriveGen @@ -31,7 +31,7 @@ ValidateInput:22:38--22:43 Error: While processing right hand side of genOfDPair. Error during reflection: The result type of the generator function must be of type "`Gen MaybeEmpty` of desired result" -ValidateInput:25:25--25:27 +ValidateInput:4 21 | 22 | genOfInfs : Fuel -> Gen MaybeEmpty $ Inf X 23 | genOfInfs = deriveGen @@ -41,7 +41,7 @@ ValidateInput:25:25--25:27 Error: While processing right hand side of genOfPair. Error during reflection: The result type of the generator function must be of type "`Gen MaybeEmpty` of desired result" -ValidateInput:28:39--28:62 +ValidateInput:5 24 | 25 | genOfDPair : Fuel -> (a ** b ** Gen MaybeEmpty $ Y a b) 26 | genOfDPair = deriveGen @@ -51,7 +51,7 @@ ValidateInput:28:39--28:62 Error: While processing right hand side of genOfPair'. Error during reflection: The result type of the generator function must be of type "`Gen MaybeEmpty` of desired result" -ValidateInput:31:40--31:63 +ValidateInput:6 27 | 28 | genOfPair : Fuel -> (a, b : Type) -> (Gen MaybeEmpty (Y a b), Gen MaybeEmpty (Y a b)) 29 | genOfPair = deriveGen @@ -61,7 +61,7 @@ ValidateInput:31:40--31:63 Error: While processing right hand side of genOfFuns_pur. Error during reflection: Target type is not a simple name -ValidateInput:34:43--34:44 +ValidateInput:7 30 | 31 | genOfPair' : Fuel -> (a, b : Type) -> (Gen MaybeEmpty (Y a b), Gen MaybeEmpty X) 32 | genOfPair' = deriveGen @@ -71,7 +71,7 @@ ValidateInput:34:43--34:44 Error: While processing right hand side of genOfFuns_pur0s. Error during reflection: Target type is not a simple name -ValidateInput:37:47--37:48 +ValidateInput:8 33 | 34 | genOfFuns_pur : Fuel -> Gen MaybeEmpty $ (a : Type) -> (b : Type) -> Y a b 35 | genOfFuns_pur = deriveGen @@ -81,7 +81,7 @@ ValidateInput:37:47--37:48 Error: While processing right hand side of genOfFuns_pur1s. Error during reflection: Target type is not a simple name -ValidateInput:40:47--40:48 +ValidateInput:9 36 | 37 | genOfFuns_pur0s : Fuel -> Gen MaybeEmpty $ (0 a : Type) -> (0 b : Type) -> Y a b 38 | genOfFuns_pur0s = deriveGen @@ -91,7 +91,7 @@ ValidateInput:40:47--40:48 Error: While processing right hand side of genOfFuns_ins_pair. Error during reflection: Target type is not a simple name -ValidateInput:43:53--43:54 +ValidateInput:10 39 | 40 | genOfFuns_pur1s : Fuel -> Gen MaybeEmpty $ (1 a : Type) -> (1 b : Type) -> Y a b 41 | genOfFuns_pur1s = deriveGen @@ -101,7 +101,7 @@ ValidateInput:43:53--43:54 Error: While processing right hand side of genOfFuns_ins_pair0. Error during reflection: Target type is not a simple name -ValidateInput:46:56--46:57 +ValidateInput:11 42 | 43 | genOfFuns_ins_pair : Fuel -> Gen MaybeEmpty (a ** ((b : Type) -> Y a b)) 44 | genOfFuns_ins_pair = deriveGen @@ -111,7 +111,7 @@ ValidateInput:46:56--46:57 Error: While processing right hand side of genOfFuns_ins_pair1. Error during reflection: Target type is not a simple name -ValidateInput:49:56--49:57 +ValidateInput:12 45 | 46 | genOfFuns_ins_pair0 : Fuel -> Gen MaybeEmpty (a ** ((0 b : Type) -> Y a b)) 47 | genOfFuns_ins_pair0 = deriveGen @@ -121,7 +121,7 @@ ValidateInput:49:56--49:57 Error: While processing right hand side of genOfFuns_out_pair. Error during reflection: Target type is not a simple name -ValidateInput:52:48--52:49 +ValidateInput:13 48 | 49 | genOfFuns_ins_pair1 : Fuel -> Gen MaybeEmpty (a ** ((1 b : Type) -> Y a b)) 50 | genOfFuns_ins_pair1 = deriveGen @@ -131,7 +131,7 @@ ValidateInput:52:48--52:49 Error: While processing right hand side of genOfFuns_out_pair0. Error during reflection: Target type is not a simple name -ValidateInput:55:51--55:52 +ValidateInput:14 51 | 52 | genOfFuns_out_pair : Fuel -> Gen MaybeEmpty $ (b : Type) -> (a ** Y a b) 53 | genOfFuns_out_pair = deriveGen @@ -141,7 +141,7 @@ ValidateInput:55:51--55:52 Error: While processing right hand side of genOfFuns_out_pair1. Error during reflection: Target type is not a simple name -ValidateInput:58:51--58:52 +ValidateInput:15 54 | 55 | genOfFuns_out_pair0 : Fuel -> Gen MaybeEmpty $ (0 b : Type) -> (a ** Y a b) 56 | genOfFuns_out_pair0 = deriveGen @@ -151,7 +151,7 @@ ValidateInput:58:51--58:52 Error: While processing right hand side of nonEmptyGen. Error during reflection: Only `GenBeEmptyStatic` variant of generator is supported, `Test.DepTyCheck.Gen.Emptiness.NonEmpty` is given -ValidateInput:61:23--61:26 +ValidateInput:16 57 | 58 | genOfFuns_out_pair1 : Fuel -> Gen MaybeEmpty $ (1 b : Type) -> (a ** Y a b) 59 | genOfFuns_out_pair1 = deriveGen diff --git a/tests/derivation/inputvalidation/unexpected-multiplicity/expected b/tests/derivation/inputvalidation/unexpected-multiplicity/expected index 136b90875..8cbad615b 100644 --- a/tests/derivation/inputvalidation/unexpected-multiplicity/expected +++ b/tests/derivation/inputvalidation/unexpected-multiplicity/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of genY_given_zero_fuel. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:18:31--18:35 +ValidateInput:1 14 | MkY : Y Int String 15 | 16 | --- Unexpected zero and linear arguments --- @@ -11,7 +11,7 @@ ValidateInput:18:31--18:35 Error: While processing right hand side of genY_given_zero_arg1. Error during reflection: Erased arguments are not supported in generator function signatures -ValidateInput:21:39--21:43 +ValidateInput:2 17 | 18 | genY_given_zero_fuel : (0 _ : Fuel) -> (a, b : Type) -> Gen MaybeEmpty $ Y a b 19 | genY_given_zero_fuel = deriveGen @@ -21,7 +21,7 @@ ValidateInput:21:39--21:43 Error: While processing right hand side of genY_given_zero_args. Error during reflection: Erased arguments are not supported in generator function signatures -ValidateInput:24:42--24:46 +ValidateInput:3 20 | 21 | genY_given_zero_arg1 : Fuel -> (0 a : Type) -> (b : Type) -> Gen MaybeEmpty $ Y a b 22 | genY_given_zero_arg1 = deriveGen @@ -31,7 +31,7 @@ ValidateInput:24:42--24:46 Error: While processing right hand side of genY_given_lin_fuel. Error during reflection: The first argument must be explicit, unnamed, present at runtime and of type `Fuel` -ValidateInput:27:30--27:34 +ValidateInput:4 23 | 24 | genY_given_zero_args : Fuel -> (0 a, b : Type) -> Gen MaybeEmpty $ Y a b 25 | genY_given_zero_args = deriveGen @@ -41,7 +41,7 @@ ValidateInput:27:30--27:34 Error: While processing right hand side of genY_given_lin_arg1. Error during reflection: Linear arguments are not supported in generator function signatures -ValidateInput:30:38--30:42 +ValidateInput:5 26 | 27 | genY_given_lin_fuel : (1 _ : Fuel) -> (a, b : Type) -> Gen MaybeEmpty $ Y a b 28 | genY_given_lin_fuel = deriveGen @@ -51,7 +51,7 @@ ValidateInput:30:38--30:42 Error: While processing right hand side of genY_given_lin_args. Error during reflection: Linear arguments are not supported in generator function signatures -ValidateInput:33:41--33:45 +ValidateInput:6 29 | 30 | genY_given_lin_arg1 : Fuel -> (1 a : Type) -> (b : Type) -> Gen MaybeEmpty $ Y a b 31 | genY_given_lin_arg1 = deriveGen @@ -61,7 +61,7 @@ ValidateInput:33:41--33:45 Error: While processing right hand side of genY_given_zero_lin_args. Error during reflection: Erased arguments are not supported in generator function signatures -ValidateInput:36:43--36:47 +ValidateInput:7 32 | 33 | genY_given_lin_args : Fuel -> (1 a, b : Type) -> Gen MaybeEmpty $ Y a b 34 | genY_given_lin_args = deriveGen diff --git a/tests/derivation/inputvalidation/wrong-params-order/expected b/tests/derivation/inputvalidation/wrong-params-order/expected index 22efed62b..76369b571 100644 --- a/tests/derivation/inputvalidation/wrong-params-order/expected +++ b/tests/derivation/inputvalidation/wrong-params-order/expected @@ -1,7 +1,7 @@ 1/1: Building ValidateInput (ValidateInput.idr) Error: While processing right hand side of genY_wrong_giv_order. Error during reflection: Given arguments must go in the same order as in the target type -ValidateInput:20:40--20:44 +ValidateInput:1 16 | -- TODO to add if it is needed 17 | 18 | --- Wrong order of parameters --- @@ -11,7 +11,7 @@ ValidateInput:20:40--20:44 Error: While processing right hand side of genX_wrong_giv_order_autoimpl. Error during reflection: Given arguments must go in the same order as in the target type -ValidateInput:23:58--23:62 +ValidateInput:2 19 | 20 | genY_wrong_giv_order : Fuel -> (b, a : Type) -> Gen MaybeEmpty $ Y a b 21 | genY_wrong_giv_order = deriveGen @@ -21,7 +21,7 @@ ValidateInput:23:58--23:62 Error: While processing right hand side of genX_wrong_giv_order_autoimpl_rep. Error during reflection: Given arguments must go in the same order as in the target type -ValidateInput:27:28--27:32 +ValidateInput:3 23 | genX_wrong_giv_order_autoimpl : Fuel -> (Fuel -> (b, a : Type) -> Gen MaybeEmpty $ Y a b) => Gen MaybeEmpty X 24 | genX_wrong_giv_order_autoimpl = deriveGen 25 | @@ -31,7 +31,7 @@ ValidateInput:27:28--27:32 Error: While processing right hand side of genY_wrong_gened_order. Error during reflection: Generated arguments must go in the same order as in the target type -ValidateInput:30:66--30:70 +ValidateInput:4 26 | genX_wrong_giv_order_autoimpl_rep : 27 | Fuel -> (Fuel -> (b, a : Type) -> Gen MaybeEmpty $ Y a b) => (Fuel -> (a, b : Type) -> Gen MaybeEmpty $ Y a b) => Gen MaybeEmpty X 28 | genX_wrong_giv_order_autoimpl_rep = deriveGen @@ -41,7 +41,7 @@ ValidateInput:30:66--30:70 Error: While processing right hand side of genY_wrong_gened_order'. Error during reflection: Generated arguments must go in the same order as in the target type -ValidateInput:11:10--11:14 +ValidateInput:5 07 | %default total 08 | 09 | data X = MkX @@ -51,7 +51,7 @@ ValidateInput:11:10--11:14 Error: While processing right hand side of genX_wrong_gened_order_autoimpl. Error during reflection: Generated arguments must go in the same order as in the target type -ValidateInput:36:84--36:88 +ValidateInput:6 32 | 33 | genY_wrong_gened_order' : Fuel -> Gen MaybeEmpty (b ** a ** Y a b) 34 | genY_wrong_gened_order' = deriveGen @@ -61,7 +61,7 @@ ValidateInput:36:84--36:88 Error: While processing right hand side of genX_wrong_gened_order_autoimpl_rep. Error during reflection: Generated arguments must go in the same order as in the target type -ValidateInput:40:52--40:56 +ValidateInput:7 36 | genX_wrong_gened_order_autoimpl : Fuel -> (Fuel -> Gen MaybeEmpty (b : Type ** a : Type ** Y a b)) => Gen MaybeEmpty X 37 | genX_wrong_gened_order_autoimpl = deriveGen 38 | diff --git a/tests/derivation/least-effort/run/regression/function-in-cons/expected b/tests/derivation/least-effort/run/regression/function-in-cons/expected index 5cb6cd77c..5d53e626e 100644 --- a/tests/derivation/least-effort/run/regression/function-in-cons/expected +++ b/tests/derivation/least-effort/run/regression/function-in-cons/expected @@ -4,7 +4,7 @@ Error: While processing right hand side of checkedGen. Sorry, I can't find any e Possible error: Error during reflection: Fields with function types are not supported in constructors - DerivedGen:8:10--8:22 + DerivedGen:1 4 | 5 | %default total 6 | @@ -15,7 +15,7 @@ Possible error: Possible error: Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present - DerivedGen:16:14--16:23 + DerivedGen:2 12 | 13 | %language ElabReflection 14 | diff --git a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected index 3f3b00acd..c1738e7f1 100644 --- a/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected +++ b/tests/derivation/least-effort/run/regression/underscore-in-cons-expl-full-gend1/expected @@ -2,12 +2,12 @@ 2/2: Building DerivedGen (DerivedGen.idr) Error: While processing right hand side of checkedGen. Sorry, I can't find any elaboration which works. All errors: Possible error: - Error during reflection: While processing right hand side of {u:1837},[0]. While processing right hand side of $resolved13823,<>. {k:1755} is not accessible in this context. + Error during reflection: While processing right hand side of {u:1837},[0]. While processing right hand side of $resolved1,<>. {k:1755} is not accessible in this context. Possible error: Error during reflection: No arguments in the generator function signature, at least a fuel argument must be present - DerivedGen:17:14--17:23 + DerivedGen:1 13 | 14 | %language ElabReflection 15 | From 5666382addc8873e3566b6c1a825d1cced34a082 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Thu, 19 Sep 2024 12:46:35 +0300 Subject: [PATCH 48/53] [ test ] Rename and granulate some derivation performance tests --- .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../{big con 002 => big record 11}/expected | 0 .../core/{big con 001 => big record 11}/run | 0 .../core/big record 4/DerivedGen.idr | 24 ++++++++++++++++++ .../RunDerivedGen.idr | 0 .../{big con 002 => big record 4}/derive.ipkg | 0 tests/derivation/core/big record 4/expected | 24 ++++++++++++++++++ .../core/{big con 002 => big record 4}/run | 0 .../core/big record 5/DerivedGen.idr | 25 +++++++++++++++++++ .../core/big record 5/RunDerivedGen.idr | 1 + .../derivation/core/big record 5/derive.ipkg | 1 + tests/derivation/core/big record 5/expected | 24 ++++++++++++++++++ tests/derivation/core/big record 5/run | 1 + .../DerivedGen.idr | 0 .../core/big record 8/RunDerivedGen.idr | 1 + .../derivation/core/big record 8/derive.ipkg | 1 + .../{big con 001 => big record 8}/expected | 0 tests/derivation/core/big record 8/run | 1 + 20 files changed, 103 insertions(+) rename tests/derivation/core/{big con 002 => big record 11}/DerivedGen.idr (100%) rename tests/derivation/core/{big con 001 => big record 11}/RunDerivedGen.idr (100%) rename tests/derivation/core/{big con 001 => big record 11}/derive.ipkg (100%) rename tests/derivation/core/{big con 002 => big record 11}/expected (100%) rename tests/derivation/core/{big con 001 => big record 11}/run (100%) create mode 100644 tests/derivation/core/big record 4/DerivedGen.idr rename tests/derivation/core/{big con 002 => big record 4}/RunDerivedGen.idr (100%) rename tests/derivation/core/{big con 002 => big record 4}/derive.ipkg (100%) create mode 100644 tests/derivation/core/big record 4/expected rename tests/derivation/core/{big con 002 => big record 4}/run (100%) create mode 100644 tests/derivation/core/big record 5/DerivedGen.idr create mode 120000 tests/derivation/core/big record 5/RunDerivedGen.idr create mode 120000 tests/derivation/core/big record 5/derive.ipkg create mode 100644 tests/derivation/core/big record 5/expected create mode 120000 tests/derivation/core/big record 5/run rename tests/derivation/core/{big con 001 => big record 8}/DerivedGen.idr (100%) create mode 120000 tests/derivation/core/big record 8/RunDerivedGen.idr create mode 120000 tests/derivation/core/big record 8/derive.ipkg rename tests/derivation/core/{big con 001 => big record 8}/expected (100%) create mode 120000 tests/derivation/core/big record 8/run diff --git a/tests/derivation/core/big con 002/DerivedGen.idr b/tests/derivation/core/big record 11/DerivedGen.idr similarity index 100% rename from tests/derivation/core/big con 002/DerivedGen.idr rename to tests/derivation/core/big record 11/DerivedGen.idr diff --git a/tests/derivation/core/big con 001/RunDerivedGen.idr b/tests/derivation/core/big record 11/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/big con 001/RunDerivedGen.idr rename to tests/derivation/core/big record 11/RunDerivedGen.idr diff --git a/tests/derivation/core/big con 001/derive.ipkg b/tests/derivation/core/big record 11/derive.ipkg similarity index 100% rename from tests/derivation/core/big con 001/derive.ipkg rename to tests/derivation/core/big record 11/derive.ipkg diff --git a/tests/derivation/core/big con 002/expected b/tests/derivation/core/big record 11/expected similarity index 100% rename from tests/derivation/core/big con 002/expected rename to tests/derivation/core/big record 11/expected diff --git a/tests/derivation/core/big con 001/run b/tests/derivation/core/big record 11/run similarity index 100% rename from tests/derivation/core/big con 001/run rename to tests/derivation/core/big record 11/run diff --git a/tests/derivation/core/big record 4/DerivedGen.idr b/tests/derivation/core/big record 4/DerivedGen.idr new file mode 100644 index 000000000..484a48c5a --- /dev/null +++ b/tests/derivation/core/big record 4/DerivedGen.idr @@ -0,0 +1,24 @@ +module DerivedGen + +import RunDerivedGen + +import Deriving.Show + +%default total + +%language ElabReflection + +record X where + constructor MkX + field1 : Nat + field2 : Nat + field3 : Nat + field4 : Nat + +%hint ShowX : Show X; ShowX = %runElab derive + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen + +main : IO () +main = runGs [ G checkedGen ] diff --git a/tests/derivation/core/big con 002/RunDerivedGen.idr b/tests/derivation/core/big record 4/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/big con 002/RunDerivedGen.idr rename to tests/derivation/core/big record 4/RunDerivedGen.idr diff --git a/tests/derivation/core/big con 002/derive.ipkg b/tests/derivation/core/big record 4/derive.ipkg similarity index 100% rename from tests/derivation/core/big con 002/derive.ipkg rename to tests/derivation/core/big record 4/derive.ipkg diff --git a/tests/derivation/core/big record 4/expected b/tests/derivation/core/big record 4/expected new file mode 100644 index 000000000..d0b44bca1 --- /dev/null +++ b/tests/derivation/core/big record 4/expected @@ -0,0 +1,24 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +MkX 16 4 17 10 +----- +MkX 10 17 5 4 +----- +MkX 12 11 8 15 +----- +MkX 4 14 7 4 +----- +MkX 10 1 15 20 +----- +MkX 0 17 13 17 +----- +MkX 17 12 2 18 +----- +MkX 13 10 14 16 +----- +MkX 16 11 1 3 +----- +MkX 3 10 12 17 diff --git a/tests/derivation/core/big con 002/run b/tests/derivation/core/big record 4/run similarity index 100% rename from tests/derivation/core/big con 002/run rename to tests/derivation/core/big record 4/run diff --git a/tests/derivation/core/big record 5/DerivedGen.idr b/tests/derivation/core/big record 5/DerivedGen.idr new file mode 100644 index 000000000..9237888ce --- /dev/null +++ b/tests/derivation/core/big record 5/DerivedGen.idr @@ -0,0 +1,25 @@ +module DerivedGen + +import RunDerivedGen + +import Deriving.Show + +%default total + +%language ElabReflection + +record X where + constructor MkX + field1 : Nat + field2 : Nat + field3 : Nat + field4 : Nat + field5 : Nat + +%hint ShowX : Show X; ShowX = %runElab derive + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen + +main : IO () +main = runGs [ G checkedGen ] diff --git a/tests/derivation/core/big record 5/RunDerivedGen.idr b/tests/derivation/core/big record 5/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/big record 5/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/big record 5/derive.ipkg b/tests/derivation/core/big record 5/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/big record 5/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/big record 5/expected b/tests/derivation/core/big record 5/expected new file mode 100644 index 000000000..284b16465 --- /dev/null +++ b/tests/derivation/core/big record 5/expected @@ -0,0 +1,24 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +Generated values: +----- +----- +MkX 16 4 17 10 10 +----- +MkX 17 5 4 12 11 +----- +MkX 8 15 4 14 7 +----- +MkX 4 10 1 15 20 +----- +MkX 0 17 13 17 17 +----- +MkX 12 2 18 13 10 +----- +MkX 14 16 16 11 1 +----- +MkX 3 3 10 12 17 +----- +MkX 19 7 3 16 6 +----- +MkX 12 18 2 8 1 diff --git a/tests/derivation/core/big record 5/run b/tests/derivation/core/big record 5/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/big record 5/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/core/big con 001/DerivedGen.idr b/tests/derivation/core/big record 8/DerivedGen.idr similarity index 100% rename from tests/derivation/core/big con 001/DerivedGen.idr rename to tests/derivation/core/big record 8/DerivedGen.idr diff --git a/tests/derivation/core/big record 8/RunDerivedGen.idr b/tests/derivation/core/big record 8/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/big record 8/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/big record 8/derive.ipkg b/tests/derivation/core/big record 8/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/big record 8/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/big con 001/expected b/tests/derivation/core/big record 8/expected similarity index 100% rename from tests/derivation/core/big con 001/expected rename to tests/derivation/core/big record 8/expected diff --git a/tests/derivation/core/big record 8/run b/tests/derivation/core/big record 8/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/big record 8/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 6d3699adb25d246dfda15aadb27279105c3bb399 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 25 Sep 2024 19:28:46 +0300 Subject: [PATCH 49/53] [ derive, refactor, perf ] Refactor `TypeApp`, make derivation faster --- .../DepTyCheck/Gen/Core/ConsDerive.idr | 77 ++++++++++--------- src/Deriving/DepTyCheck/Util/Reflection.idr | 24 +++--- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr index 609147733..fc2f8b4d7 100644 --- a/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr +++ b/src/Deriving/DepTyCheck/Gen/Core/ConsDerive.idr @@ -13,6 +13,41 @@ import public Deriving.DepTyCheck.Gen.Derive %default total +record TypeApp (0 con : Con) where + constructor MkTypeApp + argHeadType : TypeInfo + {auto 0 argHeadTypeGood : AllTyArgsNamed argHeadType} + argApps : Vect argHeadType.args.length .| Either (Fin con.args.length) TTImp + +getTypeApps : Elaboration m => NamesInfoInTypes => (con : Con) -> m $ Vect con.args.length $ TypeApp con +getTypeApps con = do + let conArgIdxs = SortedMap.fromList $ mapI con.args $ \idx, arg => (argName arg, idx) + + -- Analyse that we can do subgeneration for each constructor argument + -- Fails using `Elaboration` if the given expression is not an application to a type constructor + let analyseTypeApp : TTImp -> m $ TypeApp con + analyseTypeApp expr = do + let (lhs, args) = unAppAny expr + ty <- case lhs of + IVar _ lhsName => do let Nothing = lookupType lhsName -- TODO to support `lhsName` to be a type parameter of type `Type` + | Just found => pure found + -- we didn't found, failing, there are at least two reasons + failAt (getFC lhs) $ if isNamespaced lhsName + then "Data type `\{lhsName}` is unavailable at the site of derivation (forgotten import?)" + else "Usupported applications to a non-concrete type `\{lhsName}`" + IPrimVal _ (PrT t) => pure $ typeInfoForPrimType t + IType _ => pure typeInfoForTypeOfTypes + lhs@(IPi {}) => failAt (getFC lhs) "Fields with function types are not supported in constructors" + lhs => failAt (getFC lhs) "Unsupported type of a constructor field: \{show lhs}" + let Yes lengthCorrect = decEq ty.args.length args.length + | No _ => failAt (getFC lhs) "INTERNAL ERROR: wrong count of unapp when analysing type application" + _ <- ensureTyArgsNamed ty + pure $ MkTypeApp ty $ rewrite lengthCorrect in args.asVect <&> \arg => case getExpr arg of + expr@(IVar _ n) => mirror . maybeToEither expr $ lookup n conArgIdxs + expr => Right expr + + for con.args.asVect $ analyseTypeApp . type + ------------------------------------------------- --- Derivation of a generator for constructor --- ------------------------------------------------- @@ -52,37 +87,11 @@ namespace NonObligatoryExts -- Prepare intermediate data and functions using this data -- ------------------------------------------------------------- - -- Get file position of the constructor definition (for better error reporting) - let conFC = getFC con.type - -- Build a map from constructor's argument name to its index let conArgIdxs = SortedMap.fromList $ mapI con.args $ \idx, arg => (argName arg, idx) - -- Analyse that we can do subgeneration for each constructor argument - -- Fails using `Elaboration` if the given expression is not an application to a type constructor - let analyseTypeApp : TTImp -> m TypeApp - analyseTypeApp expr = do - let (lhs, args) = unAppAny expr - ty <- case lhs of - IVar _ lhsName => do let Nothing = lookupType lhsName -- TODO to support `lhsName` to be a type parameter of type `Type` - | Just found => pure found - -- we didn't found, failing, there are at least two reasons - failAt (getFC lhs) $ if isNamespaced lhsName - then "Data type `\{lhsName}` is unavailable at the site of derivation (forgotten import?)" - else "Usupported applications to a non-concrete type `\{lhsName}`" - IPrimVal _ (PrT t) => pure $ typeInfoForPrimType t - IType _ => pure typeInfoForTypeOfTypes - lhs@(IPi {}) => failAt (getFC lhs) "Fields with function types are not supported in constructors" - lhs => failAt (getFC lhs) "Unsupported type of a constructor field: \{show lhs}" - let Yes lengthCorrect = decEq ty.args.length args.length - | No _ => failAt (getFC lhs) "INTERNAL ERROR: wrong count of unapp when analysing type application" - _ <- ensureTyArgsNamed ty - pure $ MkTypeApp ty $ rewrite lengthCorrect in args.asVect <&> \arg => case getExpr arg of - expr@(IVar _ n) => mirror . maybeToEither expr $ lookup n conArgIdxs - expr => Right expr - -- Compute left-to-right need of generation when there are non-trivial types at the left - argsTypeApps <- for con.args.asVect $ analyseTypeApp . type + argsTypeApps <- getTypeApps con -- Get dependencies of constructor's arguments let rawDeps' = argDeps con.args @@ -107,7 +116,7 @@ namespace NonObligatoryExts genForOrder order = map (foldr apply callCons) $ evalStateT givs $ for order $ \genedArg => do -- Get info for the `genedArg` - let MkTypeApp typeOfGened argsOfTypeOfGened = index genedArg $ the (Vect _ TypeApp) argsTypeApps + let MkTypeApp typeOfGened argsOfTypeOfGened = index genedArg $ the (Vect _ $ TypeApp con) argsTypeApps -- Acquire the set of arguments that are already present presentArguments <- get @@ -161,14 +170,14 @@ namespace NonObligatoryExts ------------------------------------------------- -- Determine which arguments need to be generated in a left-to-right manner - let (leftToRightArgsTypeApp, leftToRightArgs) = unzip $ filter (\((MkTypeApp _ as), _) => any isRight as) $ toListI argsTypeApps + let (leftToRightArgsTypeApp, leftToRightArgs) = unzip $ filter (\(ta, _) => any isRight ta.argApps) $ toListI argsTypeApps -------------------------------------------------------------------------------- -- Preparation of input for the left-to-right phase (1st right-to-left phase) -- -------------------------------------------------------------------------------- -- Acquire those variables that appear in non-trivial type expressions, i.e. those which needs to be generated before the left-to-right phase - let preLTR = leftToRightArgsTypeApp >>= \(MkTypeApp _ as) => rights (toList as) >>= allVarNames + let preLTR = leftToRightArgsTypeApp >>= \ta => rights (toList ta.argApps) >>= allVarNames let preLTR = SortedSet.fromList $ mapMaybe (lookup' conArgIdxs) preLTR -- Find rightmost arguments among `preLTR` @@ -218,14 +227,6 @@ namespace NonObligatoryExts Foldable f => Interpolation (f $ Fin con.args.length) where interpolate = ("[" ++) . (++ "]") . joinBy ", " . map interpolate . toList - -- TODO make this to be a `record` as soon as #2177 is fixed - data TypeApp : Type where - MkTypeApp : - (type : TypeInfo) -> - (0 _ : AllTyArgsNamed type) => - (argTypes : Vect type.args.length .| Either (Fin con.args.length) TTImp) -> - TypeApp - ||| Best effort non-obligatory tactic tries to use as much external generators as possible ||| but discards some there is a conflict between them. ||| All possible non-conflicting layouts may be produced in the generated values list. diff --git a/src/Deriving/DepTyCheck/Util/Reflection.idr b/src/Deriving/DepTyCheck/Util/Reflection.idr index 18e6fc7d2..e4212aaa3 100644 --- a/src/Deriving/DepTyCheck/Util/Reflection.idr +++ b/src/Deriving/DepTyCheck/Util/Reflection.idr @@ -389,6 +389,18 @@ export allVarNames : TTImp -> List Name allVarNames = SortedSet.toList . allVarNames' +public export +0 ArgDeps : Nat -> Type +ArgDeps n = DVect n $ SortedSet . Fin . Fin.finToNat + +export +argDeps : (args : List Arg) -> ArgDeps args.length +argDeps args = do + let nameToIndices = SortedMap.fromList $ mapI args $ \i, arg => (argName arg, SortedSet.singleton i) + let args = Vect.fromList args <&> \arg => allVarNames arg.type |> map (fromMaybe empty . lookup' nameToIndices) + flip upmapI args $ \i, deps => flip concatMap deps $ \candidates => + maybe empty singleton $ last' $ mapMaybe tryToFit $ SortedSet.toList candidates + export record NamesInfoInTypes where constructor Names @@ -612,15 +624,3 @@ genTypeName g = do let (IVar _ genTy, _) = unApp genTy | (genTy, _) => failAt (getFC genTy) "Expected a type name" pure genTy - ----------------------------------------------- ---- Analyzing dependently typed signatures --- ----------------------------------------------- - -export -argDeps : (args : List Arg) -> DVect args.length $ SortedSet . Fin . Fin.finToNat -argDeps args = do - let nameToIndices = SortedMap.fromList $ mapI args $ \i, arg => (argName arg, SortedSet.singleton i) - let args = Vect.fromList args <&> \arg => allVarNames arg.type |> map (fromMaybe empty . lookup' nameToIndices) - flip upmapI args $ \i, argDeps => flip concatMap argDeps $ \candidates => - maybe empty singleton $ last' $ mapMaybe tryToFit $ SortedSet.toList candidates From 30b14fba3aff9ad2be40bb6c806d55c1029607c3 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Wed, 2 Oct 2024 13:34:38 +0300 Subject: [PATCH 50/53] [ refactor ] Move `NamesInfoInTypes` into a separate module section --- src/Deriving/DepTyCheck/Util/Reflection.idr | 213 ++++++++++---------- 1 file changed, 108 insertions(+), 105 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Reflection.idr b/src/Deriving/DepTyCheck/Util/Reflection.idr index e4212aaa3..b9619c1db 100644 --- a/src/Deriving/DepTyCheck/Util/Reflection.idr +++ b/src/Deriving/DepTyCheck/Util/Reflection.idr @@ -401,111 +401,6 @@ argDeps args = do flip upmapI args $ \i, deps => flip concatMap deps $ \candidates => maybe empty singleton $ last' $ mapMaybe tryToFit $ SortedSet.toList candidates -export -record NamesInfoInTypes where - constructor Names - types : SortedMap Name TypeInfo - cons : SortedMap Name (TypeInfo, Con) - namesInTypes : SortedMap TypeInfo $ SortedSet Name - -lookupByType : NamesInfoInTypes => Name -> Maybe $ SortedSet Name -lookupByType @{tyi} = lookup' tyi.types >=> lookup' tyi.namesInTypes - -lookupByCon : NamesInfoInTypes => Name -> Maybe $ SortedSet Name -lookupByCon @{tyi} = concatMap @{Deep} lookupByType . SortedSet.toList . concatMap allVarNames' . conSubexprs . snd <=< lookup' tyi.cons - -typeByCon : NamesInfoInTypes => Con -> Maybe TypeInfo -typeByCon @{tyi} = map fst . lookup' tyi.cons . name - -export -lookupType : NamesInfoInTypes => Name -> Maybe TypeInfo -lookupType @{tyi} = lookup' tyi.types - -export -lookupCon : NamesInfoInTypes => Name -> Maybe Con -lookupCon @{tyi} n = snd <$> lookup n tyi.cons - <|> typeCon <$> lookup n tyi.types - -||| Returns either resolved expression, or a non-unique name and the set of alternatives. --- We could use `Validated (SortedMap Name $ SortedSet Name) TTImp` as the result, if we depended on `contrib`. --- NOTICE: this function does not resolve re-export aliases, say, it does not resolve `Prelude.Nil` to `Prelude.Basics.Nil`. -export -resolveNamesUniquely : NamesInfoInTypes => (freeNames : SortedSet Name) -> TTImp -> Either (Name, SortedSet Name) TTImp -resolveNamesUniquely @{tyi} freeNames = do - let allConsideredNames = keySet tyi.types `union` keySet tyi.cons - let reverseNamesMap = concatMap (uncurry SortedMap.singleton) $ allConsideredNames.asList >>= \n => allNameSuffixes n <&> (, SortedSet.singleton n) - mapATTImp' $ \case - v@(IVar fc n) => if contains n freeNames then id else do - let Just resolvedAlts = lookup n reverseNamesMap | Nothing => id - let [resolved] = SortedSet.toList resolvedAlts - | _ => const $ Left (n, resolvedAlts) - const $ pure $ IVar fc resolved - _ => id - -Semigroup NamesInfoInTypes where - Names ts cs nit <+> Names ts' cs' nit' = Names (ts `mergeLeft` ts') (cs `mergeLeft` cs') (nit <+> nit') - -Eq TypeInfo where (==) = (==) `on` name -Ord TypeInfo where compare = comparing name - -Monoid NamesInfoInTypes where - neutral = Names empty empty empty - -export -hasNameInsideDeep : NamesInfoInTypes => Name -> TTImp -> Bool -hasNameInsideDeep @{tyi} nm = hasInside empty . allVarNames where - - hasInside : (visited : SortedSet Name) -> (toLook : List Name) -> Bool - hasInside visited [] = False - hasInside visited (curr::rest) = if curr == nm then True else do - let new = if contains curr visited then [] else maybe [] SortedSet.toList $ lookupByType curr - -- visited is limited and either growing or `new` is empty, thus `toLook` is strictly less - assert_total $ hasInside (insert curr visited) (new ++ rest) - -export -isRecursive : NamesInfoInTypes => (con : Con) -> {default Nothing containingType : Maybe TypeInfo} -> Bool -isRecursive con = case the (Maybe TypeInfo) $ containingType <|> typeByCon con of - Just containingType => any (hasNameInsideDeep containingType.name) $ conSubexprs con - Nothing => False - --- returns `Nothing` if given name is not a constructor -export -isRecursiveConstructor : NamesInfoInTypes => Name -> Maybe Bool -isRecursiveConstructor @{tyi} n = lookup' tyi.cons n <&> \(ty, con) => isRecursive {containingType=Just ty} con - -export -getNamesInfoInTypes : Elaboration m => TypeInfo -> m NamesInfoInTypes -getNamesInfoInTypes ty = go neutral [ty] - where - - subexprs : TypeInfo -> List TTImp - subexprs ty = map type ty.args ++ (ty.cons >>= conSubexprs) - - go : NamesInfoInTypes -> List TypeInfo -> m NamesInfoInTypes - go tyi [] = pure tyi - go tyi (ti::rest) = do - ti <- normaliseCons ti - let subes = concatMap allVarNames' $ subexprs ti - new <- map join $ for (SortedSet.toList subes) $ \n => - if isNothing $ lookupByType n - then map toList $ catch $ getInfo' n - else pure [] - let next = { types $= insert ti.name ti - , namesInTypes $= insert ti subes - , cons $= mergeLeft $ fromList $ ti.cons <&> \con => (con.name, ti, con) - } tyi - assert_total $ go next (new ++ rest) - -export -getNamesInfoInTypes' : Elaboration m => TTImp -> m NamesInfoInTypes -getNamesInfoInTypes' expr = do - let varsFirstOrder = allVarNames expr - varsSecondOrder <- map concat $ Prelude.for varsFirstOrder $ \n => do - ns <- getType n - pure $ SortedSet.insert n $ flip concatMap ns $ \(n', ty) => insert n' $ allVarNames' ty - tys <- map (mapMaybe id) $ for (SortedSet.toList varsSecondOrder) $ catch . getInfo' - concat <$> Prelude.for tys getNamesInfoInTypes - public export isVar : TTImp -> Bool isVar $ IVar {} = True @@ -624,3 +519,111 @@ genTypeName g = do let (IVar _ genTy, _) = unApp genTy | (genTy, _) => failAt (getFC genTy) "Expected a type name" pure genTy + +--------------------------- +--- Names info in types --- +--------------------------- + +export +record NamesInfoInTypes where + constructor Names + types : SortedMap Name TypeInfo + cons : SortedMap Name (TypeInfo, Con) + namesInTypes : SortedMap TypeInfo $ SortedSet Name + +lookupByType : NamesInfoInTypes => Name -> Maybe $ SortedSet Name +lookupByType @{tyi} = lookup' tyi.types >=> lookup' tyi.namesInTypes + +lookupByCon : NamesInfoInTypes => Name -> Maybe $ SortedSet Name +lookupByCon @{tyi} = concatMap @{Deep} lookupByType . SortedSet.toList . concatMap allVarNames' . conSubexprs . snd <=< lookup' tyi.cons + +typeByCon : NamesInfoInTypes => Con -> Maybe TypeInfo +typeByCon @{tyi} = map fst . lookup' tyi.cons . name + +export +lookupType : NamesInfoInTypes => Name -> Maybe TypeInfo +lookupType @{tyi} = lookup' tyi.types + +export +lookupCon : NamesInfoInTypes => Name -> Maybe Con +lookupCon @{tyi} n = snd <$> lookup n tyi.cons + <|> typeCon <$> lookup n tyi.types + +||| Returns either resolved expression, or a non-unique name and the set of alternatives. +-- We could use `Validated (SortedMap Name $ SortedSet Name) TTImp` as the result, if we depended on `contrib`. +-- NOTICE: this function does not resolve re-export aliases, say, it does not resolve `Prelude.Nil` to `Prelude.Basics.Nil`. +export +resolveNamesUniquely : NamesInfoInTypes => (freeNames : SortedSet Name) -> TTImp -> Either (Name, SortedSet Name) TTImp +resolveNamesUniquely @{tyi} freeNames = do + let allConsideredNames = keySet tyi.types `union` keySet tyi.cons + let reverseNamesMap = concatMap (uncurry SortedMap.singleton) $ allConsideredNames.asList >>= \n => allNameSuffixes n <&> (, SortedSet.singleton n) + mapATTImp' $ \case + v@(IVar fc n) => if contains n freeNames then id else do + let Just resolvedAlts = lookup n reverseNamesMap | Nothing => id + let [resolved] = SortedSet.toList resolvedAlts + | _ => const $ Left (n, resolvedAlts) + const $ pure $ IVar fc resolved + _ => id + +Semigroup NamesInfoInTypes where + Names ts cs nit <+> Names ts' cs' nit' = Names (ts `mergeLeft` ts') (cs `mergeLeft` cs') (nit <+> nit') + +Monoid NamesInfoInTypes where + neutral = Names empty empty empty where + Eq TypeInfo where (==) = (==) `on` name + Ord TypeInfo where compare = comparing name + +export +hasNameInsideDeep : NamesInfoInTypes => Name -> TTImp -> Bool +hasNameInsideDeep @{tyi} nm = hasInside empty . allVarNames where + + hasInside : (visited : SortedSet Name) -> (toLook : List Name) -> Bool + hasInside visited [] = False + hasInside visited (curr::rest) = if curr == nm then True else do + let new = if contains curr visited then [] else maybe [] SortedSet.toList $ lookupByType curr + -- visited is limited and either growing or `new` is empty, thus `toLook` is strictly less + assert_total $ hasInside (insert curr visited) (new ++ rest) + +export +isRecursive : NamesInfoInTypes => (con : Con) -> {default Nothing containingType : Maybe TypeInfo} -> Bool +isRecursive con = case the (Maybe TypeInfo) $ containingType <|> typeByCon con of + Just containingType => any (hasNameInsideDeep containingType.name) $ conSubexprs con + Nothing => False + +-- returns `Nothing` if given name is not a constructor +export +isRecursiveConstructor : NamesInfoInTypes => Name -> Maybe Bool +isRecursiveConstructor @{tyi} n = lookup' tyi.cons n <&> \(ty, con) => isRecursive {containingType=Just ty} con + +export +getNamesInfoInTypes : Elaboration m => TypeInfo -> m NamesInfoInTypes +getNamesInfoInTypes ty = go neutral [ty] + where + + subexprs : TypeInfo -> List TTImp + subexprs ty = map type ty.args ++ (ty.cons >>= conSubexprs) + + go : NamesInfoInTypes -> List TypeInfo -> m NamesInfoInTypes + go tyi [] = pure tyi + go tyi (ti::rest) = do + ti <- normaliseCons ti + let subes = concatMap allVarNames' $ subexprs ti + new <- map join $ for (SortedSet.toList subes) $ \n => + if isNothing $ lookupByType n + then map toList $ catch $ getInfo' n + else pure [] + let next = { types $= insert ti.name ti + , namesInTypes $= insert ti subes + , cons $= mergeLeft $ fromList $ ti.cons <&> \con => (con.name, ti, con) + } tyi + assert_total $ go next (new ++ rest) + +export +getNamesInfoInTypes' : Elaboration m => TTImp -> m NamesInfoInTypes +getNamesInfoInTypes' expr = do + let varsFirstOrder = allVarNames expr + varsSecondOrder <- map concat $ Prelude.for varsFirstOrder $ \n => do + ns <- getType n + pure $ SortedSet.insert n $ flip concatMap ns $ \(n', ty) => insert n' $ allVarNames' ty + tys <- map (mapMaybe id) $ for (SortedSet.toList varsSecondOrder) $ catch . getInfo' + concat <$> Prelude.for tys getNamesInfoInTypes From d33db7293ae2b0688e168f13d4d9d5906fc8bc77 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 7 Oct 2024 10:47:54 +0300 Subject: [PATCH 51/53] [ compat ] Be more friendly to non-friendly OSes --- .github/workflows/ci-non-primary-os.yml | 30 +++++++++++++++++++ .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../dont-run | 0 .../expected | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../dont-run | 0 .../expected | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 .../DerivedGen.idr | 0 .../RunDerivedGen.idr | 0 .../derive.ipkg | 0 .../expected | 0 .../run | 0 tests/derivation/core/tests-roadmap | 2 ++ 107 files changed, 32 insertions(+) create mode 100644 .github/workflows/ci-non-primary-os.yml rename tests/derivation/core/{norec t-..->p. noext 001-shdw => norec t-..--p. noext 001-shdw}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-..->p. noext 001-shdw => norec t-..--p. noext 001-shdw}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-..->p. noext 001-shdw => norec t-..--p. noext 001-shdw}/derive.ipkg (100%) rename tests/derivation/core/{norec t-..->p. noext 001-shdw => norec t-..--p. noext 001-shdw}/expected (100%) rename tests/derivation/core/{norec t-..->p. noext 001-shdw => norec t-..--p. noext 001-shdw}/run (100%) rename tests/derivation/core/{norec t-..->p. noext 001 => norec t-..--p. noext 001}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-..->p. noext 001 => norec t-..--p. noext 001}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-..->p. noext 001 => norec t-..--p. noext 001}/derive.ipkg (100%) rename tests/derivation/core/{norec t-..->p. noext 001 => norec t-..--p. noext 001}/expected (100%) rename tests/derivation/core/{norec t-..->p. noext 001 => norec t-..--p. noext 001}/run (100%) rename tests/derivation/core/{norec t-..->p. noext 002 => norec t-..--p. noext 002}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-..->p. noext 002 => norec t-..--p. noext 002}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-..->p. noext 002 => norec t-..--p. noext 002}/derive.ipkg (100%) rename tests/derivation/core/{norec t-..->p. noext 002 => norec t-..--p. noext 002}/expected (100%) rename tests/derivation/core/{norec t-..->p. noext 002 => norec t-..--p. noext 002}/run (100%) rename tests/derivation/core/{norec t-p.->.. noext 001 => norec t-p.--.. noext 001}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. noext 001 => norec t-p.--.. noext 001}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. noext 001 => norec t-p.--.. noext 001}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. noext 001 => norec t-p.--.. noext 001}/expected (100%) rename tests/derivation/core/{norec t-p.->.. noext 001 => norec t-p.--.. noext 001}/run (100%) rename tests/derivation/core/{norec t-p.->.. noext 002 => norec t-p.--.. noext 002}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. noext 002 => norec t-p.--.. noext 002}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. noext 002 => norec t-p.--.. noext 002}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. noext 002 => norec t-p.--.. noext 002}/expected (100%) rename tests/derivation/core/{norec t-p.->.. noext 002 => norec t-p.--.. noext 002}/run (100%) rename tests/derivation/core/{norec t-p.->.. noext 003 => norec t-p.--.. noext 003}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. noext 003 => norec t-p.--.. noext 003}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. noext 003 => norec t-p.--.. noext 003}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. noext 003 => norec t-p.--.. noext 003}/expected (100%) rename tests/derivation/core/{norec t-p.->.. noext 003 => norec t-p.--.. noext 003}/run (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 001 => norec t-p.--.. w_ext 001}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 001 => norec t-p.--.. w_ext 001}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 001 => norec t-p.--.. w_ext 001}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 001 => norec t-p.--.. w_ext 001}/expected (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 001 => norec t-p.--.. w_ext 001}/run (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 002 => norec t-p.--.. w_ext 002}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 002 => norec t-p.--.. w_ext 002}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 002 => norec t-p.--.. w_ext 002}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 002 => norec t-p.--.. w_ext 002}/expected (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 002 => norec t-p.--.. w_ext 002}/run (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 003-neg => norec t-p.--.. w_ext 003-neg}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 003-neg => norec t-p.--.. w_ext 003-neg}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 003-neg => norec t-p.--.. w_ext 003-neg}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 003-neg => norec t-p.--.. w_ext 003-neg}/expected (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 003-neg => norec t-p.--.. w_ext 003-neg}/run (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 004-neg => norec t-p.--.. w_ext 004-neg}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 004-neg => norec t-p.--.. w_ext 004-neg}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 004-neg => norec t-p.--.. w_ext 004-neg}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 004-neg => norec t-p.--.. w_ext 004-neg}/expected (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 004-neg => norec t-p.--.. w_ext 004-neg}/run (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 005 => norec t-p.--.. w_ext 005}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 005 => norec t-p.--.. w_ext 005}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 005 => norec t-p.--.. w_ext 005}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 005 => norec t-p.--.. w_ext 005}/expected (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 005 => norec t-p.--.. w_ext 005}/run (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 006 => norec t-p.--.. w_ext 006}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 006 => norec t-p.--.. w_ext 006}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 006 => norec t-p.--.. w_ext 006}/derive.ipkg (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 006 => norec t-p.--.. w_ext 006}/expected (100%) rename tests/derivation/core/{norec t-p.->.. w_ext 006 => norec t-p.--.. w_ext 006}/run (100%) rename tests/derivation/core/{norec t-pi->.. noext 001 => norec t-pi--.. noext 001}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 001 => norec t-pi--.. noext 001}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 001 => norec t-pi--.. noext 001}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. noext 001 => norec t-pi--.. noext 001}/expected (100%) rename tests/derivation/core/{norec t-pi->.. noext 001 => norec t-pi--.. noext 001}/run (100%) rename tests/derivation/core/{norec t-pi->.. noext 002 => norec t-pi--.. noext 002}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 002 => norec t-pi--.. noext 002}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 002 => norec t-pi--.. noext 002}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. noext 002 => norec t-pi--.. noext 002}/expected (100%) rename tests/derivation/core/{norec t-pi->.. noext 002 => norec t-pi--.. noext 002}/run (100%) rename tests/derivation/core/{norec t-pi->.. noext 003 => norec t-pi--.. noext 003}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 003 => norec t-pi--.. noext 003}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 003 => norec t-pi--.. noext 003}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. noext 003 => norec t-pi--.. noext 003}/expected (100%) rename tests/derivation/core/{norec t-pi->.. noext 003 => norec t-pi--.. noext 003}/run (100%) rename tests/derivation/core/{norec t-pi->.. noext 004 => norec t-pi--.. noext 004}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 004 => norec t-pi--.. noext 004}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 004 => norec t-pi--.. noext 004}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. noext 004 => norec t-pi--.. noext 004}/expected (100%) rename tests/derivation/core/{norec t-pi->.. noext 004 => norec t-pi--.. noext 004}/run (100%) rename tests/derivation/core/{norec t-pi->.. noext 005 => norec t-pi--.. noext 005}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 005 => norec t-pi--.. noext 005}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. noext 005 => norec t-pi--.. noext 005}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. noext 005 => norec t-pi--.. noext 005}/expected (100%) rename tests/derivation/core/{norec t-pi->.. noext 005 => norec t-pi--.. noext 005}/run (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001-shdw => norec t-pi--.. w_ext 001-shdw}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001-shdw => norec t-pi--.. w_ext 001-shdw}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001-shdw => norec t-pi--.. w_ext 001-shdw}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001-shdw => norec t-pi--.. w_ext 001-shdw}/dont-run (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001-shdw => norec t-pi--.. w_ext 001-shdw}/expected (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001 => norec t-pi--.. w_ext 001}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001 => norec t-pi--.. w_ext 001}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001 => norec t-pi--.. w_ext 001}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001 => norec t-pi--.. w_ext 001}/dont-run (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 001 => norec t-pi--.. w_ext 001}/expected (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 002 => norec t-pi--.. w_ext 002}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 002 => norec t-pi--.. w_ext 002}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 002 => norec t-pi--.. w_ext 002}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 002 => norec t-pi--.. w_ext 002}/expected (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 002 => norec t-pi--.. w_ext 002}/run (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 003 => norec t-pi--.. w_ext 003}/DerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 003 => norec t-pi--.. w_ext 003}/RunDerivedGen.idr (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 003 => norec t-pi--.. w_ext 003}/derive.ipkg (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 003 => norec t-pi--.. w_ext 003}/expected (100%) rename tests/derivation/core/{norec t-pi->.. w_ext 003 => norec t-pi--.. w_ext 003}/run (100%) diff --git a/.github/workflows/ci-non-primary-os.yml b/.github/workflows/ci-non-primary-os.yml new file mode 100644 index 000000000..486cbf202 --- /dev/null +++ b/.github/workflows/ci-non-primary-os.yml @@ -0,0 +1,30 @@ +--- +name: Non-primary OS + +on: + push: + branches: + - main + - master + tags: + - '*' + pull_request: + branches: + - main + - master + +permissions: + statuses: write + +concurrency: + group: ${{ github.workflow }}@${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Clone on Windows + runs-on: windows-latest + steps: + + - name: Checkout + uses: actions/checkout@v4 diff --git a/tests/derivation/core/norec t-..->p. noext 001-shdw/DerivedGen.idr b/tests/derivation/core/norec t-..--p. noext 001-shdw/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001-shdw/DerivedGen.idr rename to tests/derivation/core/norec t-..--p. noext 001-shdw/DerivedGen.idr diff --git a/tests/derivation/core/norec t-..->p. noext 001-shdw/RunDerivedGen.idr b/tests/derivation/core/norec t-..--p. noext 001-shdw/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001-shdw/RunDerivedGen.idr rename to tests/derivation/core/norec t-..--p. noext 001-shdw/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-..->p. noext 001-shdw/derive.ipkg b/tests/derivation/core/norec t-..--p. noext 001-shdw/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001-shdw/derive.ipkg rename to tests/derivation/core/norec t-..--p. noext 001-shdw/derive.ipkg diff --git a/tests/derivation/core/norec t-..->p. noext 001-shdw/expected b/tests/derivation/core/norec t-..--p. noext 001-shdw/expected similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001-shdw/expected rename to tests/derivation/core/norec t-..--p. noext 001-shdw/expected diff --git a/tests/derivation/core/norec t-..->p. noext 001-shdw/run b/tests/derivation/core/norec t-..--p. noext 001-shdw/run similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001-shdw/run rename to tests/derivation/core/norec t-..--p. noext 001-shdw/run diff --git a/tests/derivation/core/norec t-..->p. noext 001/DerivedGen.idr b/tests/derivation/core/norec t-..--p. noext 001/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001/DerivedGen.idr rename to tests/derivation/core/norec t-..--p. noext 001/DerivedGen.idr diff --git a/tests/derivation/core/norec t-..->p. noext 001/RunDerivedGen.idr b/tests/derivation/core/norec t-..--p. noext 001/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001/RunDerivedGen.idr rename to tests/derivation/core/norec t-..--p. noext 001/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-..->p. noext 001/derive.ipkg b/tests/derivation/core/norec t-..--p. noext 001/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001/derive.ipkg rename to tests/derivation/core/norec t-..--p. noext 001/derive.ipkg diff --git a/tests/derivation/core/norec t-..->p. noext 001/expected b/tests/derivation/core/norec t-..--p. noext 001/expected similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001/expected rename to tests/derivation/core/norec t-..--p. noext 001/expected diff --git a/tests/derivation/core/norec t-..->p. noext 001/run b/tests/derivation/core/norec t-..--p. noext 001/run similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 001/run rename to tests/derivation/core/norec t-..--p. noext 001/run diff --git a/tests/derivation/core/norec t-..->p. noext 002/DerivedGen.idr b/tests/derivation/core/norec t-..--p. noext 002/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 002/DerivedGen.idr rename to tests/derivation/core/norec t-..--p. noext 002/DerivedGen.idr diff --git a/tests/derivation/core/norec t-..->p. noext 002/RunDerivedGen.idr b/tests/derivation/core/norec t-..--p. noext 002/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 002/RunDerivedGen.idr rename to tests/derivation/core/norec t-..--p. noext 002/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-..->p. noext 002/derive.ipkg b/tests/derivation/core/norec t-..--p. noext 002/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 002/derive.ipkg rename to tests/derivation/core/norec t-..--p. noext 002/derive.ipkg diff --git a/tests/derivation/core/norec t-..->p. noext 002/expected b/tests/derivation/core/norec t-..--p. noext 002/expected similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 002/expected rename to tests/derivation/core/norec t-..--p. noext 002/expected diff --git a/tests/derivation/core/norec t-..->p. noext 002/run b/tests/derivation/core/norec t-..--p. noext 002/run similarity index 100% rename from tests/derivation/core/norec t-..->p. noext 002/run rename to tests/derivation/core/norec t-..--p. noext 002/run diff --git a/tests/derivation/core/norec t-p.->.. noext 001/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. noext 001/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 001/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. noext 001/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. noext 001/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. noext 001/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 001/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. noext 001/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. noext 001/derive.ipkg b/tests/derivation/core/norec t-p.--.. noext 001/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 001/derive.ipkg rename to tests/derivation/core/norec t-p.--.. noext 001/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. noext 001/expected b/tests/derivation/core/norec t-p.--.. noext 001/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 001/expected rename to tests/derivation/core/norec t-p.--.. noext 001/expected diff --git a/tests/derivation/core/norec t-p.->.. noext 001/run b/tests/derivation/core/norec t-p.--.. noext 001/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 001/run rename to tests/derivation/core/norec t-p.--.. noext 001/run diff --git a/tests/derivation/core/norec t-p.->.. noext 002/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. noext 002/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 002/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. noext 002/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. noext 002/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. noext 002/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 002/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. noext 002/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. noext 002/derive.ipkg b/tests/derivation/core/norec t-p.--.. noext 002/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 002/derive.ipkg rename to tests/derivation/core/norec t-p.--.. noext 002/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. noext 002/expected b/tests/derivation/core/norec t-p.--.. noext 002/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 002/expected rename to tests/derivation/core/norec t-p.--.. noext 002/expected diff --git a/tests/derivation/core/norec t-p.->.. noext 002/run b/tests/derivation/core/norec t-p.--.. noext 002/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 002/run rename to tests/derivation/core/norec t-p.--.. noext 002/run diff --git a/tests/derivation/core/norec t-p.->.. noext 003/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. noext 003/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 003/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. noext 003/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. noext 003/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. noext 003/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 003/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. noext 003/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. noext 003/derive.ipkg b/tests/derivation/core/norec t-p.--.. noext 003/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 003/derive.ipkg rename to tests/derivation/core/norec t-p.--.. noext 003/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. noext 003/expected b/tests/derivation/core/norec t-p.--.. noext 003/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 003/expected rename to tests/derivation/core/norec t-p.--.. noext 003/expected diff --git a/tests/derivation/core/norec t-p.->.. noext 003/run b/tests/derivation/core/norec t-p.--.. noext 003/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. noext 003/run rename to tests/derivation/core/norec t-p.--.. noext 003/run diff --git a/tests/derivation/core/norec t-p.->.. w_ext 001/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 001/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 001/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 001/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 001/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 001/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 001/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 001/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 001/derive.ipkg b/tests/derivation/core/norec t-p.--.. w_ext 001/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 001/derive.ipkg rename to tests/derivation/core/norec t-p.--.. w_ext 001/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. w_ext 001/expected b/tests/derivation/core/norec t-p.--.. w_ext 001/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 001/expected rename to tests/derivation/core/norec t-p.--.. w_ext 001/expected diff --git a/tests/derivation/core/norec t-p.->.. w_ext 001/run b/tests/derivation/core/norec t-p.--.. w_ext 001/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 001/run rename to tests/derivation/core/norec t-p.--.. w_ext 001/run diff --git a/tests/derivation/core/norec t-p.->.. w_ext 002/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 002/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 002/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 002/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 002/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 002/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 002/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 002/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 002/derive.ipkg b/tests/derivation/core/norec t-p.--.. w_ext 002/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 002/derive.ipkg rename to tests/derivation/core/norec t-p.--.. w_ext 002/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. w_ext 002/expected b/tests/derivation/core/norec t-p.--.. w_ext 002/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 002/expected rename to tests/derivation/core/norec t-p.--.. w_ext 002/expected diff --git a/tests/derivation/core/norec t-p.->.. w_ext 002/run b/tests/derivation/core/norec t-p.--.. w_ext 002/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 002/run rename to tests/derivation/core/norec t-p.--.. w_ext 002/run diff --git a/tests/derivation/core/norec t-p.->.. w_ext 003-neg/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 003-neg/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 003-neg/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 003-neg/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 003-neg/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 003-neg/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 003-neg/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 003-neg/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 003-neg/derive.ipkg b/tests/derivation/core/norec t-p.--.. w_ext 003-neg/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 003-neg/derive.ipkg rename to tests/derivation/core/norec t-p.--.. w_ext 003-neg/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. w_ext 003-neg/expected b/tests/derivation/core/norec t-p.--.. w_ext 003-neg/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 003-neg/expected rename to tests/derivation/core/norec t-p.--.. w_ext 003-neg/expected diff --git a/tests/derivation/core/norec t-p.->.. w_ext 003-neg/run b/tests/derivation/core/norec t-p.--.. w_ext 003-neg/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 003-neg/run rename to tests/derivation/core/norec t-p.--.. w_ext 003-neg/run diff --git a/tests/derivation/core/norec t-p.->.. w_ext 004-neg/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 004-neg/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 004-neg/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 004-neg/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 004-neg/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 004-neg/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 004-neg/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 004-neg/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 004-neg/derive.ipkg b/tests/derivation/core/norec t-p.--.. w_ext 004-neg/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 004-neg/derive.ipkg rename to tests/derivation/core/norec t-p.--.. w_ext 004-neg/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. w_ext 004-neg/expected b/tests/derivation/core/norec t-p.--.. w_ext 004-neg/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 004-neg/expected rename to tests/derivation/core/norec t-p.--.. w_ext 004-neg/expected diff --git a/tests/derivation/core/norec t-p.->.. w_ext 004-neg/run b/tests/derivation/core/norec t-p.--.. w_ext 004-neg/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 004-neg/run rename to tests/derivation/core/norec t-p.--.. w_ext 004-neg/run diff --git a/tests/derivation/core/norec t-p.->.. w_ext 005/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 005/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 005/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 005/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 005/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 005/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 005/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 005/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 005/derive.ipkg b/tests/derivation/core/norec t-p.--.. w_ext 005/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 005/derive.ipkg rename to tests/derivation/core/norec t-p.--.. w_ext 005/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. w_ext 005/expected b/tests/derivation/core/norec t-p.--.. w_ext 005/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 005/expected rename to tests/derivation/core/norec t-p.--.. w_ext 005/expected diff --git a/tests/derivation/core/norec t-p.->.. w_ext 005/run b/tests/derivation/core/norec t-p.--.. w_ext 005/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 005/run rename to tests/derivation/core/norec t-p.--.. w_ext 005/run diff --git a/tests/derivation/core/norec t-p.->.. w_ext 006/DerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 006/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 006/DerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 006/DerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 006/RunDerivedGen.idr b/tests/derivation/core/norec t-p.--.. w_ext 006/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 006/RunDerivedGen.idr rename to tests/derivation/core/norec t-p.--.. w_ext 006/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-p.->.. w_ext 006/derive.ipkg b/tests/derivation/core/norec t-p.--.. w_ext 006/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 006/derive.ipkg rename to tests/derivation/core/norec t-p.--.. w_ext 006/derive.ipkg diff --git a/tests/derivation/core/norec t-p.->.. w_ext 006/expected b/tests/derivation/core/norec t-p.--.. w_ext 006/expected similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 006/expected rename to tests/derivation/core/norec t-p.--.. w_ext 006/expected diff --git a/tests/derivation/core/norec t-p.->.. w_ext 006/run b/tests/derivation/core/norec t-p.--.. w_ext 006/run similarity index 100% rename from tests/derivation/core/norec t-p.->.. w_ext 006/run rename to tests/derivation/core/norec t-p.--.. w_ext 006/run diff --git a/tests/derivation/core/norec t-pi->.. noext 001/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 001/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 001/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 001/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 001/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 001/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 001/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 001/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 001/derive.ipkg b/tests/derivation/core/norec t-pi--.. noext 001/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 001/derive.ipkg rename to tests/derivation/core/norec t-pi--.. noext 001/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. noext 001/expected b/tests/derivation/core/norec t-pi--.. noext 001/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 001/expected rename to tests/derivation/core/norec t-pi--.. noext 001/expected diff --git a/tests/derivation/core/norec t-pi->.. noext 001/run b/tests/derivation/core/norec t-pi--.. noext 001/run similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 001/run rename to tests/derivation/core/norec t-pi--.. noext 001/run diff --git a/tests/derivation/core/norec t-pi->.. noext 002/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 002/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 002/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 002/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 002/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 002/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 002/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 002/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 002/derive.ipkg b/tests/derivation/core/norec t-pi--.. noext 002/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 002/derive.ipkg rename to tests/derivation/core/norec t-pi--.. noext 002/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. noext 002/expected b/tests/derivation/core/norec t-pi--.. noext 002/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 002/expected rename to tests/derivation/core/norec t-pi--.. noext 002/expected diff --git a/tests/derivation/core/norec t-pi->.. noext 002/run b/tests/derivation/core/norec t-pi--.. noext 002/run similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 002/run rename to tests/derivation/core/norec t-pi--.. noext 002/run diff --git a/tests/derivation/core/norec t-pi->.. noext 003/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 003/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 003/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 003/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 003/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 003/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 003/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 003/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 003/derive.ipkg b/tests/derivation/core/norec t-pi--.. noext 003/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 003/derive.ipkg rename to tests/derivation/core/norec t-pi--.. noext 003/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. noext 003/expected b/tests/derivation/core/norec t-pi--.. noext 003/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 003/expected rename to tests/derivation/core/norec t-pi--.. noext 003/expected diff --git a/tests/derivation/core/norec t-pi->.. noext 003/run b/tests/derivation/core/norec t-pi--.. noext 003/run similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 003/run rename to tests/derivation/core/norec t-pi--.. noext 003/run diff --git a/tests/derivation/core/norec t-pi->.. noext 004/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 004/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 004/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 004/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 004/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 004/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 004/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 004/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 004/derive.ipkg b/tests/derivation/core/norec t-pi--.. noext 004/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 004/derive.ipkg rename to tests/derivation/core/norec t-pi--.. noext 004/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. noext 004/expected b/tests/derivation/core/norec t-pi--.. noext 004/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 004/expected rename to tests/derivation/core/norec t-pi--.. noext 004/expected diff --git a/tests/derivation/core/norec t-pi->.. noext 004/run b/tests/derivation/core/norec t-pi--.. noext 004/run similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 004/run rename to tests/derivation/core/norec t-pi--.. noext 004/run diff --git a/tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 005/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 005/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 005/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 005/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. noext 005/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 005/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. noext 005/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. noext 005/derive.ipkg b/tests/derivation/core/norec t-pi--.. noext 005/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 005/derive.ipkg rename to tests/derivation/core/norec t-pi--.. noext 005/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. noext 005/expected b/tests/derivation/core/norec t-pi--.. noext 005/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 005/expected rename to tests/derivation/core/norec t-pi--.. noext 005/expected diff --git a/tests/derivation/core/norec t-pi->.. noext 005/run b/tests/derivation/core/norec t-pi--.. noext 005/run similarity index 100% rename from tests/derivation/core/norec t-pi->.. noext 005/run rename to tests/derivation/core/norec t-pi--.. noext 005/run diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001-shdw/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. w_ext 001-shdw/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001-shdw/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. w_ext 001-shdw/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001-shdw/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. w_ext 001-shdw/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001-shdw/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. w_ext 001-shdw/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001-shdw/derive.ipkg b/tests/derivation/core/norec t-pi--.. w_ext 001-shdw/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001-shdw/derive.ipkg rename to tests/derivation/core/norec t-pi--.. w_ext 001-shdw/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001-shdw/dont-run b/tests/derivation/core/norec t-pi--.. w_ext 001-shdw/dont-run similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001-shdw/dont-run rename to tests/derivation/core/norec t-pi--.. w_ext 001-shdw/dont-run diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001-shdw/expected b/tests/derivation/core/norec t-pi--.. w_ext 001-shdw/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001-shdw/expected rename to tests/derivation/core/norec t-pi--.. w_ext 001-shdw/expected diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. w_ext 001/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. w_ext 001/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. w_ext 001/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. w_ext 001/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001/derive.ipkg b/tests/derivation/core/norec t-pi--.. w_ext 001/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001/derive.ipkg rename to tests/derivation/core/norec t-pi--.. w_ext 001/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001/dont-run b/tests/derivation/core/norec t-pi--.. w_ext 001/dont-run similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001/dont-run rename to tests/derivation/core/norec t-pi--.. w_ext 001/dont-run diff --git a/tests/derivation/core/norec t-pi->.. w_ext 001/expected b/tests/derivation/core/norec t-pi--.. w_ext 001/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 001/expected rename to tests/derivation/core/norec t-pi--.. w_ext 001/expected diff --git a/tests/derivation/core/norec t-pi->.. w_ext 002/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. w_ext 002/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 002/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. w_ext 002/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. w_ext 002/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. w_ext 002/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 002/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. w_ext 002/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. w_ext 002/derive.ipkg b/tests/derivation/core/norec t-pi--.. w_ext 002/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 002/derive.ipkg rename to tests/derivation/core/norec t-pi--.. w_ext 002/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. w_ext 002/expected b/tests/derivation/core/norec t-pi--.. w_ext 002/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 002/expected rename to tests/derivation/core/norec t-pi--.. w_ext 002/expected diff --git a/tests/derivation/core/norec t-pi->.. w_ext 002/run b/tests/derivation/core/norec t-pi--.. w_ext 002/run similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 002/run rename to tests/derivation/core/norec t-pi--.. w_ext 002/run diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/DerivedGen.idr b/tests/derivation/core/norec t-pi--.. w_ext 003/DerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 003/DerivedGen.idr rename to tests/derivation/core/norec t-pi--.. w_ext 003/DerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/RunDerivedGen.idr b/tests/derivation/core/norec t-pi--.. w_ext 003/RunDerivedGen.idr similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 003/RunDerivedGen.idr rename to tests/derivation/core/norec t-pi--.. w_ext 003/RunDerivedGen.idr diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/derive.ipkg b/tests/derivation/core/norec t-pi--.. w_ext 003/derive.ipkg similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 003/derive.ipkg rename to tests/derivation/core/norec t-pi--.. w_ext 003/derive.ipkg diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/expected b/tests/derivation/core/norec t-pi--.. w_ext 003/expected similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 003/expected rename to tests/derivation/core/norec t-pi--.. w_ext 003/expected diff --git a/tests/derivation/core/norec t-pi->.. w_ext 003/run b/tests/derivation/core/norec t-pi--.. w_ext 003/run similarity index 100% rename from tests/derivation/core/norec t-pi->.. w_ext 003/run rename to tests/derivation/core/norec t-pi--.. w_ext 003/run diff --git a/tests/derivation/core/tests-roadmap b/tests/derivation/core/tests-roadmap index 0365096d1..dbc926dd9 100644 --- a/tests/derivation/core/tests-roadmap +++ b/tests/derivation/core/tests-roadmap @@ -17,6 +17,8 @@ Independent metrics: - type indices (GADTs) (i) - use of external generators (noext, ext) +`->` is replaced by `--` for compatibility with Windows file naming rules. + ------------------------ --- Particular cases --- ------------------------ From 2a816ca384e8fa94fd330356865543d22d306dfc Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 7 Oct 2024 10:31:34 +0300 Subject: [PATCH 52/53] [ compat ] Remove deprecated sphinx theme option --- docs/source/conf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 384310818..c1d8e6daf 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -68,7 +68,6 @@ # html_theme = "sphinx_rtd_theme" html_theme_options = { - "display_version": True, "prev_next_buttons_location": "bottom", } html_logo = "../../icons/deptycheck-lib-html-logo.png" From 4f29cdf6420a39693d7807b826bcfaf7fdd77a43 Mon Sep 17 00:00:00 2001 From: Simon Tsirikov Date: Sun, 20 Oct 2024 13:30:53 +0300 Subject: [PATCH 53/53] creation of GenSignature for fused type added --- src/Deriving/DepTyCheck/Gen/Derive.idr | 2 +- src/Deriving/DepTyCheck/Util/Fusion.idr | 31 +++++++++++++------ .../011 simple gen signature/DerivedGen.idr | 31 +++++++++++++++++++ .../011 simple gen signature/derive.ipkg | 1 + .../011 simple gen signature/expected | 2 ++ .../generator/011 simple gen signature/run | 1 + 6 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 tests/derivation/utils/fusion/print/generator/011 simple gen signature/DerivedGen.idr create mode 120000 tests/derivation/utils/fusion/print/generator/011 simple gen signature/derive.ipkg create mode 100644 tests/derivation/utils/fusion/print/generator/011 simple gen signature/expected create mode 120000 tests/derivation/utils/fusion/print/generator/011 simple gen signature/run diff --git a/src/Deriving/DepTyCheck/Gen/Derive.idr b/src/Deriving/DepTyCheck/Gen/Derive.idr index 6388446cb..a764d2bd9 100644 --- a/src/Deriving/DepTyCheck/Gen/Derive.idr +++ b/src/Deriving/DepTyCheck/Gen/Derive.idr @@ -17,7 +17,7 @@ import public Deriving.DepTyCheck.Util.Reflection public export record GenSignature where - constructor MkGenSignature -- to use for genXY (later because you don't have TypeInfo before declare) + constructor MkGenSignature targetType : TypeInfo {auto 0 targetTypeCorrect : AllTyArgsNamed targetType} givenParams : SortedSet $ Fin targetType.args.length diff --git a/src/Deriving/DepTyCheck/Util/Fusion.idr b/src/Deriving/DepTyCheck/Util/Fusion.idr index d330fe52c..d92cdf80c 100644 --- a/src/Deriving/DepTyCheck/Util/Fusion.idr +++ b/src/Deriving/DepTyCheck/Util/Fusion.idr @@ -165,8 +165,8 @@ deriveFusion l = do let False = any isNothing typeArgs | True => Nothing - let uniqueNames = buildOrdering $ toList $ map snd l -- names from target type constructor - let uniqueArgs = nub $ (sortBy (comparing (\x => findIndex ((==) $ fst x) uniqueNames))) $ join $ catMaybes $ toList typeArgs -- arg types from type signature + let uniqueNames = buildOrdering $ toList $ map snd l -- names from target type constructor and arg types from type signature + let uniqueArgs = nub $ (sortBy (comparing (\x => findIndex ((==) $ fst x) uniqueNames))) $ join $ catMaybes $ toList typeArgs let True = length uniqueArgs == length uniqueNames -- same parameter name could not be associated with different types | False => Nothing @@ -231,13 +231,15 @@ deriveFusion l = do clauses = [ genRMkDPair (bindVar fusedVarName) uniqueNames .= iCase { - sc = var splitName .$ (var $ UN $ Basic fusedVarName), - ty = implicitTrue, - clauses = - [ (splitRhsDef (map bindVar typeVarNames)) - .= var `{pure} - .$ foldConstructor (var originalConsName) (map var uniqueNames ++ map (var . UN . Basic) typeVarNames) - ] + sc = var splitName .$ (var $ UN $ Basic fusedVarName), + ty = implicitTrue, + clauses = [ + (splitRhsDef (map bindVar typeVarNames)) + .= var `{pure} + .$ foldConstructor + (var originalConsName) + (map var uniqueNames ++ map (var . UN . Basic) typeVarNames) + ] } ] } @@ -303,6 +305,17 @@ runFusionList l = do pure $ deriveFusion l' +public export +createGenSignature : Name -> Elab (Maybe GenSignature) +createGenSignature fusionName = do + ti <- getInfo' fusionName + let args = allFins ti.args.length + let Yes _ = areAllTyArgsNamed ti + | No _ => pure Nothing + let signature = MkGenSignature ti $ fromList args + pure $ Just signature + + public export getFusion : Maybe FusionDecl -> List Decl getFusion Nothing = [] diff --git a/tests/derivation/utils/fusion/print/generator/011 simple gen signature/DerivedGen.idr b/tests/derivation/utils/fusion/print/generator/011 simple gen signature/DerivedGen.idr new file mode 100644 index 000000000..16ee2b97f --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/011 simple gen signature/DerivedGen.idr @@ -0,0 +1,31 @@ +module DerivedGen + +import public Deriving.DepTyCheck.Util.Fusion +import public Deriving.DepTyCheck.Gen.Core + +%default total + +data X : Type -> Type where + MkX : X n + +data Y : Type -> Type where + MkY : Y n + +data Z : Type where + MkZ : (n : Type) -> X n -> Y n -> Z + +%language ElabReflection + +decl : Maybe FusionDecl +decl = %runElab runFusion `{X} [`{n}] `{Y} [`{n}] + +declared : () +declared = %runElab declare $ getFusion decl + +sign : Maybe GenSignature +sign = %runElab createGenSignature `{XY} + +main : IO () +main = case sign of + Nothing => printLn "no signature generated" + Just x => printLn "signature generated" diff --git a/tests/derivation/utils/fusion/print/generator/011 simple gen signature/derive.ipkg b/tests/derivation/utils/fusion/print/generator/011 simple gen signature/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/011 simple gen signature/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/fusion/print/generator/011 simple gen signature/expected b/tests/derivation/utils/fusion/print/generator/011 simple gen signature/expected new file mode 100644 index 000000000..a7dbe393a --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/011 simple gen signature/expected @@ -0,0 +1,2 @@ +1/1: Building DerivedGen (DerivedGen.idr) +"signature generated" diff --git a/tests/derivation/utils/fusion/print/generator/011 simple gen signature/run b/tests/derivation/utils/fusion/print/generator/011 simple gen signature/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/fusion/print/generator/011 simple gen signature/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file