From 18c16e3da8fd5f46beed57748c7efd2144e6eb7f Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 11 Nov 2025 18:08:24 +0300 Subject: [PATCH 01/81] [ refactor ] Rename specialisation functions --- .../src/Deriving/SpecialiseData.idr | 20 +++++++++---------- .../specdata-001-listNat/Test.idr | 6 +++--- .../specdata-002-maybeFin/Test.idr | 2 +- .../specdata-003-listVectNat/Test.idr | 2 +- .../specdata-004-list/Test.idr | 2 +- .../specdata-005-vect/Test.idr | 4 ++-- .../specdata-006-eitherVoid/Test.idr | 2 +- .../specdata-007-vectConst/Test.idr | 6 +++--- .../specdata-008-depOnArg/Test.idr | 6 +++--- .../specdata-009-finConst/Test.idr | 6 +++--- .../specdata-010-name/Test.idr | 2 +- .../specialise-data/specdata-011-nat/Test.idr | 2 +- .../specdata-012-void/Test.idr | 2 +- .../specdata-013-vectSum/Test.idr | 2 +- .../specdata-014-autoImplicitInArg/Test.idr | 2 +- .../specdata-015-autoImplicitInArg2/Test.idr | 2 +- .../specdata-016-higherKindedType/Test.idr | 2 +- .../specdata-017-defaultInArgConst/Test.idr | 2 +- .../specdata-018-defaultInArgVal/Test.idr | 2 +- .../specdata-019-defaultInArgDep/Test.idr | 2 +- .../specdata-020-defaultInArgDep2/Test.idr | 4 ++-- .../specdata-021-eqTy/Test.idr | 10 +++++----- .../specdata-022-eqVal/Test.idr | 6 +++--- .../specdata-023-omegaTy/Test.idr | 2 +- .../specdata-024-customNS/Test.idr | 2 +- 25 files changed, 50 insertions(+), 50 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index f976db47f..702339321 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -1093,7 +1093,7 @@ specialiseDataRaw resultName resultKind resultContent = do ||| specialiseData `{VF} $ \n => Fin n ||| ``` export -specialiseData : +specialiseDataLam : TaskLambda taskT => Monad m => Elaboration m => @@ -1104,7 +1104,7 @@ specialiseData : (resultName : Name) -> (0 task : taskT) -> m (TypeInfo, List Decl) -specialiseData resultName task = do +specialiseDataLam resultName task = do -- Quote spec lambda type resultKind <- quote taskT -- Quote spec lambda @@ -1122,10 +1122,10 @@ specialiseData resultName task = do ||| ``` ||| ...you may use this function as follows: ||| ``` -||| specialiseData'' `{VF} $ \n => Fin n +||| specialiseDataLam'' `{VF} $ \n => Fin n ||| ``` export -specialiseData'' : +specialiseDataLam'' : Elaboration m => (nsProvider : NamespaceProvider m) => (unifier : CanUnify m) => @@ -1133,12 +1133,12 @@ specialiseData'' : Name -> (0 task: taskT) -> m $ List Decl -specialiseData'' resultName task = do +specialiseDataLam'' resultName task = do tq <- quote task nit <- getNamesInfoInTypes' tq Right (specTy, decls) <- runEitherT {m} {e=SpecialisationError} $ - specialiseData resultName task + specialiseDataLam resultName task | Left err => fail "Specialisation error: \{show err}" pure decls @@ -1152,10 +1152,10 @@ specialiseData'' resultName task = do ||| ``` ||| ...you may use this function as follows: ||| ``` -||| %runElab specialiseData' `{VF} $ \n => Fin n +||| %runElab specialiseDataLam' `{VF} $ \n => Fin n ||| ``` export -specialiseData' : +specialiseDataLam' : Elaboration m => (nsProvider : NamespaceProvider m) => (unifier : CanUnify m) => @@ -1163,5 +1163,5 @@ specialiseData' : Name -> (0 task: taskT) -> m () -specialiseData' resultName task = - specialiseData'' resultName task >>= declare +specialiseDataLam' resultName task = + specialiseDataLam'' resultName task >>= declare diff --git a/elab-util-extra/tests/specialise-data/specdata-001-listNat/Test.idr b/elab-util-extra/tests/specialise-data/specdata-001-listNat/Test.idr index 51e98798c..e66de7e99 100644 --- a/elab-util-extra/tests/specialise-data/specdata-001-listNat/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-001-listNat/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "ListNat" $ List Nat +%runElab specialiseDataLam' "ListNat" $ List Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 ln' = %runElab verifySpecialisation (List Nat) ListNat @@ -26,7 +26,7 @@ failing "Can't find an implementation for FromString Nat" ln1 : ListNat ln1 = ["test"] -%runElab specialiseData' "ListListString" (List (List String)) +%runElab specialiseDataLam' "ListListString" (List (List String)) --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 lss' = %runElab verifySpecialisation (List (List String)) ListListString @@ -45,7 +45,7 @@ lss'' = %runElab verifyInvalidConstructors (List (List String)) ListListString , `( [[1,2],[3,4]] ) ] -%runElab specialiseData' "ListType" (List Type) +%runElab specialiseDataLam' "ListType" (List Type) --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 lt' = %runElab verifySpecialisation (List Type) ListType diff --git a/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/Test.idr b/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/Test.idr index d6fe593e2..b32cf8002 100644 --- a/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "MFin" $ \a => Maybe $ Fin a +%runElab specialiseDataLam' "MFin" $ \a => Maybe $ Fin a mFin0NoJust : MFin 0 -> Unit mFin0NoJust (Nothing) = MkUnit diff --git a/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/Test.idr b/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/Test.idr index 00e11dcb6..ceb80ff8c 100644 --- a/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "ListVectNat" $ \a => List $ Vect a Nat +%runElab specialiseDataLam' "ListVectNat" $ \a => List $ Vect a Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 lvn0' = %runElab verifySpecialisation (List $ Vect 0 Nat) (ListVectNat 0) diff --git a/elab-util-extra/tests/specialise-data/specdata-004-list/Test.idr b/elab-util-extra/tests/specialise-data/specdata-004-list/Test.idr index 92630361a..ee25aedec 100644 --- a/elab-util-extra/tests/specialise-data/specdata-004-list/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-004-list/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "MyList" $ \a => List a +%runElab specialiseDataLam' "MyList" $ \a => List a --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 l0' = %runElab verifySpecialisation (List Nat) (MyList Nat) diff --git a/elab-util-extra/tests/specialise-data/specdata-005-vect/Test.idr b/elab-util-extra/tests/specialise-data/specdata-005-vect/Test.idr index 8ee36c68c..1352ad6b9 100644 --- a/elab-util-extra/tests/specialise-data/specdata-005-vect/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-005-vect/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "MyVect" $ \n, a => Vect n a +%runElab specialiseDataLam' "MyVect" $ \n, a => Vect n a --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 v0' = %runElab verifySpecialisation (Vect 0 Nat) (MyVect 0 Nat) [`([])] @@ -26,7 +26,7 @@ v2' = %runElab verifySpecialisation (Vect 1 String) (MyVect 1 String) ] -%runElab specialiseData' "FlipVect" $ \a, n => Vect n a +%runElab specialiseDataLam' "FlipVect" $ \a, n => Vect n a --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 fv0' = %runElab verifySpecialisation (Vect 0 Nat) (FlipVect Nat 0) [`([])] diff --git a/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/Test.idr b/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/Test.idr index 43b840ef2..ef0ec8d5f 100644 --- a/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "EitherVoid" $ \a => Either Void a +%runElab specialiseDataLam' "EitherVoid" $ \a => Either Void a --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0' = %runElab verifySpecialisation (Either Void Nat) (EitherVoid Nat) diff --git a/elab-util-extra/tests/specialise-data/specdata-007-vectConst/Test.idr b/elab-util-extra/tests/specialise-data/specdata-007-vectConst/Test.idr index 685cc1660..0e143fbb1 100644 --- a/elab-util-extra/tests/specialise-data/specdata-007-vectConst/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-007-vectConst/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "Vect0" (\a => Vect 0 a) +%runElab specialiseDataLam' "Vect0" (\a => Vect 0 a) --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0' = %runElab verifySpecialisation (Vect 0 Nat) (Vect0 Nat) [`([])] @@ -12,7 +12,7 @@ e0' = %runElab verifySpecialisation (Vect 0 Nat) (Vect0 Nat) [`([])] e0NoCons : Vect0 Nat -> Nat e0NoCons [] = 0 -%runElab specialiseData' "Vect2" $ \a => Vect 2 a +%runElab specialiseDataLam' "Vect2" $ \a => Vect 2 a --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e1' = %runElab verifySpecialisation (Vect 2 Nat) (Vect2 Nat) @@ -21,7 +21,7 @@ e1' = %runElab verifySpecialisation (Vect 2 Nat) (Vect2 Nat) , `( [2, 1] ) ] -%runElab specialiseData' "VectString" $ \a => Vect a String +%runElab specialiseDataLam' "VectString" $ \a => Vect a String --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e2' = %runElab verifySpecialisation (Vect 0 String) (VectString 0) diff --git a/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/Test.idr b/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/Test.idr index 60417ffcd..c7455e22a 100644 --- a/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/Test.idr @@ -8,7 +8,7 @@ data X : (Nat -> Type) -> Type where X5 : t 5 -> X t Xn : t n -> X t -%runElab specialiseData' "XFin" $ X Fin +%runElab specialiseDataLam' "XFin" $ X Fin --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 x0' = %runElab verifySpecialisation (X Fin) XFin @@ -21,7 +21,7 @@ x0' = %runElab verifySpecialisation (X Fin) XFin , `(Xn (the (Fin 6) 3)) ] -%runElab specialiseData' "XVNat" $ X (\n => Vect n Nat) +%runElab specialiseDataLam' "XVNat" $ X (\n => Vect n Nat) --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 x1' = %runElab verifySpecialisation (X (\n => Vect n Nat)) XVNat @@ -33,7 +33,7 @@ x1' = %runElab verifySpecialisation (X (\n => Vect n Nat)) XVNat ] -%runElab specialiseData' "XVFin" $ X (\n => Vect n $ Fin n) +%runElab specialiseDataLam' "XVFin" $ X (\n => Vect n $ Fin n) --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 x2' = %runElab verifySpecialisation (X (\n => Vect n $ Fin n)) XVFin diff --git a/elab-util-extra/tests/specialise-data/specdata-009-finConst/Test.idr b/elab-util-extra/tests/specialise-data/specdata-009-finConst/Test.idr index d79d1a0de..c9b636b01 100644 --- a/elab-util-extra/tests/specialise-data/specdata-009-finConst/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-009-finConst/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "Fin0" $ Fin 0 +%runElab specialiseDataLam' "Fin0" $ Fin 0 --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0' = %runElab verifySpecialisation (Fin 0) Fin0 [] @@ -16,14 +16,14 @@ e0NoCons _ impossible e0'' = %runElab verifyEmptyType (Fin 0) Fin0 -%runElab specialiseData' "Fin1" $ Fin 1 +%runElab specialiseDataLam' "Fin1" $ Fin 1 --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e1' = %runElab verifySpecialisation (Fin 1) Fin1 [ `( FZ ) ] -%runElab specialiseData' "Fin2" $ Fin 2 +%runElab specialiseDataLam' "Fin2" $ Fin 2 --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e2' = %runElab verifySpecialisation (Fin 2) Fin2 diff --git a/elab-util-extra/tests/specialise-data/specdata-010-name/Test.idr b/elab-util-extra/tests/specialise-data/specdata-010-name/Test.idr index 367f158ad..d6b0125c2 100644 --- a/elab-util-extra/tests/specialise-data/specdata-010-name/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-010-name/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "MyName" Name +%runElab specialiseDataLam' "MyName" Name --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0' = %runElab verifySpecialisation Name MyName diff --git a/elab-util-extra/tests/specialise-data/specdata-011-nat/Test.idr b/elab-util-extra/tests/specialise-data/specdata-011-nat/Test.idr index 4a6dd6a0f..b05b91a0b 100644 --- a/elab-util-extra/tests/specialise-data/specdata-011-nat/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-011-nat/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "MyNat" Nat +%runElab specialiseDataLam' "MyNat" Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0' = %runElab verifySpecialisation Nat MyNat diff --git a/elab-util-extra/tests/specialise-data/specdata-012-void/Test.idr b/elab-util-extra/tests/specialise-data/specdata-012-void/Test.idr index 29dbdd6ee..260f9f262 100644 --- a/elab-util-extra/tests/specialise-data/specdata-012-void/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-012-void/Test.idr @@ -4,7 +4,7 @@ import Shared %language ElabReflection -%runElab specialiseData' "MyVoid" Void +%runElab specialiseDataLam' "MyVoid" Void --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0' = %runElab verifyEmptyType Void MyVoid diff --git a/elab-util-extra/tests/specialise-data/specdata-013-vectSum/Test.idr b/elab-util-extra/tests/specialise-data/specdata-013-vectSum/Test.idr index 19d70427b..17ca0d96d 100644 --- a/elab-util-extra/tests/specialise-data/specdata-013-vectSum/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-013-vectSum/Test.idr @@ -9,7 +9,7 @@ import Shared --- This is not the desired behaviour. Once we implement unifyManually and fording, --- It should be possible to represent such constructors using condition auto-implicits. -%runElab specialiseData' "VectSum" $ \a,b => Vect (a + b) Nat +%runElab specialiseDataLam' "VectSum" $ \a,b => Vect (a + b) Nat failing "x _ is not a valid impossible case." x : Vect (a + b) Nat -> Nat diff --git a/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/Test.idr b/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/Test.idr index f2a032ed9..b12e25a7e 100644 --- a/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/Test.idr @@ -7,7 +7,7 @@ import Shared data Y : (Type -> Type) -> Type where MkY : Functor f => f Nat -> Y f -%runElab specialiseData' "Y'" $ Y List +%runElab specialiseDataLam' "Y'" $ Y List y0 : Y' y0 = MkY [] diff --git a/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/Test.idr b/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/Test.idr index 7b56cbcd7..c2eca23c2 100644 --- a/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/Test.idr @@ -7,7 +7,7 @@ import Shared data Z : Type -> Type where MkZ : Semigroup x => (a, b : x) -> (f : x -> Type) -> f (a <+> b) -> Z x -%runElab specialiseData' "Z'" $ Z (List Nat) +%runElab specialiseDataLam' "Z'" $ Z (List Nat) z0 : Z' z0 = MkZ [0] [1, 2] (Any $ \x => x = 0) (Here Refl) diff --git a/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/Test.idr b/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/Test.idr index dc45b19d6..11da7c460 100644 --- a/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/Test.idr @@ -7,7 +7,7 @@ import Shared data X : Type -> (Type -> Type) -> Type where MkX : f a -> f Nat -> f String -> f (f a) -> X a f -%runElab specialiseData' "X'" $ X (Fin 5) List +%runElab specialiseDataLam' "X'" $ X (Fin 5) List --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 x0' = %runElab verifySpecialisation (X (Fin 5) List) X' diff --git a/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/Test.idr b/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/Test.idr index 40a8488fb..73c51aa66 100644 --- a/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/Test.idr @@ -7,7 +7,7 @@ import Shared data V : Type where MkV : (0 n : Nat) -> {default 0 p : Fin (S n)} -> V -%runElab specialiseData' "V'" V +%runElab specialiseDataLam' "V'" V v0 : V' v0 = MkV 10 diff --git a/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/Test.idr b/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/Test.idr index 4f6a6eaf8..197334f70 100644 --- a/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/Test.idr @@ -7,7 +7,7 @@ import Shared data W : Type where MkW : (0 n : Nat) -> (k : Fin (S n)) -> {default k p : Fin (S n)} -> W -%runElab specialiseData' "W'" W +%runElab specialiseDataLam' "W'" W w0 : W' w0 = MkW 10 5 diff --git a/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/Test.idr b/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/Test.idr index 1c6aa7236..30014208d 100644 --- a/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/Test.idr @@ -7,7 +7,7 @@ import Shared data X : Nat -> Type where MkX : {0 n : Nat} -> {default 0 p : Fin (S n)} -> X (S n) -%runElab specialiseData' "X'" $ X 2 +%runElab specialiseDataLam' "X'" $ X 2 x0 : X' x0 = MkX diff --git a/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/Test.idr b/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/Test.idr index a9f8208eb..3caf9b47c 100644 --- a/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/Test.idr @@ -7,7 +7,7 @@ import Shared data Y : Type -> Type where MkY : Monoid x => {default neutral p : x} -> Y x -%runElab specialiseData' "Y'" $ Y String +%runElab specialiseDataLam' "Y'" $ Y String y0 : Y' y0 = MkY @@ -15,7 +15,7 @@ y0 = MkY y1 : Y' y1 = MkY {p="Hello world"} -%runElab specialiseData' "Y''" $ Y Nat +%runElab specialiseDataLam' "Y''" $ Y Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0' = %runElab verifyEmptyType (Y Nat) Y'' diff --git a/elab-util-extra/tests/specialise-data/specdata-021-eqTy/Test.idr b/elab-util-extra/tests/specialise-data/specdata-021-eqTy/Test.idr index 8c81cc2fb..c35995493 100644 --- a/elab-util-extra/tests/specialise-data/specdata-021-eqTy/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-021-eqTy/Test.idr @@ -6,9 +6,9 @@ import Shared -- The specialiser in its current form does *not* support type aliases! failing "MissingTypeInfoError Builtin.(===)" - %runElab specialiseData' "EqNat" $ \x => x = Nat + %runElab specialiseDataLam' "EqNat" $ \x => x = Nat -%runElab specialiseData' "EqNatMW" $ \x : Type => Builtin.Equal x Nat +%runElab specialiseDataLam' "EqNatMW" $ \x : Type => Builtin.Equal x Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0' = %runElab verifySpecialisation (Nat = Nat) (EqNatMW Nat) [`(Refl)] @@ -16,7 +16,7 @@ e0' = %runElab verifySpecialisation (Nat = Nat) (EqNatMW Nat) [`(Refl)] --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e0'' = %runElab verifyEmptyType (String === Nat) (EqNatMW String) -%runElab specialiseData' "EqNatM0" $ \0 x : Type => Builtin.Equal x Nat +%runElab specialiseDataLam' "EqNatM0" $ \0 x : Type => Builtin.Equal x Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e1' = %runElab verifySpecialisation (Nat = Nat) (EqNatM0 Nat) [`(Refl)] @@ -24,12 +24,12 @@ e1' = %runElab verifySpecialisation (Nat = Nat) (EqNatM0 Nat) [`(Refl)] --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e1'' = %runElab verifyEmptyType (String === Nat) (EqNatM0 String) -%runElab specialiseData' "EqNat2" $ Builtin.Equal Nat Nat +%runElab specialiseDataLam' "EqNat2" $ Builtin.Equal Nat Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e2' = %runElab verifySpecialisation (Nat = Nat) (EqNat2) [`(Refl)] -%runElab specialiseData' "EqNat3" $ Builtin.Equal String Nat +%runElab specialiseDataLam' "EqNat3" $ Builtin.Equal String Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e2'' = %runElab verifyEmptyType (String === Nat) (EqNat3) diff --git a/elab-util-extra/tests/specialise-data/specdata-022-eqVal/Test.idr b/elab-util-extra/tests/specialise-data/specdata-022-eqVal/Test.idr index 6279b2bec..3f999346e 100644 --- a/elab-util-extra/tests/specialise-data/specdata-022-eqVal/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-022-eqVal/Test.idr @@ -6,15 +6,15 @@ import Shared -- The specialiser in its current form does *not* support type aliases! failing "MissingTypeInfoError Builtin.(===)" - %runElab specialiseData' "Eq3" $ \x => x = 3 + %runElab specialiseDataLam' "Eq3" $ \x => x = 3 -%runElab specialiseData' "Eq3'" $ \x : Nat => Builtin.Equal x 3 +%runElab specialiseDataLam' "Eq3'" $ \x : Nat => Builtin.Equal x 3 failing "Mismatch between: ?x = ?x and Eq3' 3." e0 : Eq3' 3 e0 = Refl -%runElab specialiseData' "Eq3" $ \x : Nat => Builtin.Equal x (the Nat 3) +%runElab specialiseDataLam' "Eq3" $ \x : Nat => Builtin.Equal x (the Nat 3) --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 e1' = %runElab verifySpecialisation diff --git a/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/Test.idr b/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/Test.idr index 317ac5895..57da5dba8 100644 --- a/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/Test.idr @@ -7,7 +7,7 @@ import Shared data X : Type -> Type -> Type where MkX : (t, f : Type) -> X t f -%runElab specialiseData' "X'" $ \x => X x Nat +%runElab specialiseDataLam' "X'" $ \x => X x Nat --- The variable assignment is a workaround for https://github.com/idris-lang/Idris2/issues/3651 x1' = %runElab verifySpecialisation' (X Nat Nat) (X' Nat) diff --git a/elab-util-extra/tests/specialise-data/specdata-024-customNS/Test.idr b/elab-util-extra/tests/specialise-data/specdata-024-customNS/Test.idr index c0c9d5ba0..8ce5dd365 100644 --- a/elab-util-extra/tests/specialise-data/specdata-024-customNS/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-024-customNS/Test.idr @@ -5,7 +5,7 @@ import public Shared %language ElabReflection decls : List Decl -decls = %runElab specialiseData'' {nsProvider = inNS $ MkNS ["Custom", "Test"]} {unifier = DefaultUnifier} "MyNat" Nat +decls = %runElab specialiseDataLam'' {nsProvider = inNS $ MkNS ["Custom", "Test"]} {unifier = DefaultUnifier} "MyNat" Nat namespace Custom %runElab declare decls From 32af2c36af45aac38bf3480e40ed5860db2a5df7 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 11 Nov 2025 18:08:45 +0300 Subject: [PATCH 02/81] [ new ] Implement normaliseTask --- .../src/Deriving/SpecialiseData.idr | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 702339321..a5990e7fa 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -1081,6 +1081,29 @@ specialiseDataRaw resultName resultKind resultContent = do decls <- specDecls task uniResults specTy pure (specTy, decls) +export +normaliseTask : Elaboration m => List Arg -> TTImp -> m (TTImp, TTImp) +normaliseTask fvs ret = do + lamTy : Type <- check $ piAll `(Type) fvs + lam <- normaliseAs lamTy $ foldr lam ret fvs + lamTy' <- quote lamTy + pure (lamTy', lam) + +export +specialiseDataArgs : + Elaboration m => + (nsProvider : NamespaceProvider m) => + (unifier : CanUnify m) => + MonadLog m => + MonadError SpecialisationError m => + (namesInfo : NamesInfoInTypes) => + (resultName : Name) -> + (lambdaArgs : List Arg) -> + (lambdaRHS : TTImp) -> + m (TypeInfo, List Decl) +specialiseDataArgs resultName fvArgs lambdaRHS = + uncurry (specialiseDataRaw resultName) =<< normaliseTask fvArgs lambdaRHS + ||| Perform a specialisation for a given type name and content lambda ||| ||| In order to generate a specialised type declaration equivalent to the following type alias: From 7457335a687e53644e2c589afd47685ae89ce8a3 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 11 Nov 2025 18:09:08 +0300 Subject: [PATCH 03/81] [ new ] Sketch out specialiseIfNeeded --- .../DepTyCheck/Gen/ForAllNeededTypes/Impl.idr | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr index 23ccfd6a6..0e8b3bcda 100644 --- a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr +++ b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr @@ -5,14 +5,119 @@ import public Control.Monad.State import public Data.DPair import public Data.List.Set +import public Data.List.Ex +import public Data.List.Map import public Data.SortedMap import public Decidable.Equality import public Deriving.DepTyCheck.Gen.ForOneType.Interface +import public Deriving.SpecialiseData +import public Language.Reflection.Unify + %default total +isSimpleN : Name -> Bool +isSimpleN (UN (Basic str)) = (fst $ span isLower str) /= "" +isSimpleN _ = False + +||| Given an argument, a possible given value for it, and a set of free variable names in scope, +||| return argument value in the specialisation lambda body, +||| as well as a list of newly introduced free variables and their given values +processArg : Arg -> Maybe TTImp -> SortedSet Name -> (TTImp, List (Arg, Maybe TTImp)) +processArg arg Nothing fvNames = (IVar EmptyFC $ fromMaybe "_" arg.name, [(arg, Nothing)]) +processArg arg (Just given) fvNames = + case snd $ unPi arg.type of + `(Type) => do + let simpleNames = filter isSimpleN $ allVarNames given + let newNames = filter (not . contains' fvNames) simpleNames + let newArgs : List (Arg, Maybe TTImp) = (\x => (MkArg MW ExplicitArg (Just x) `(_), Just $ IVar EmptyFC x)) <$> newNames + (given, newArgs) + _ => (IVar EmptyFC $ fromMaybe "_" arg.name, [(arg, Just given)]) + +processArgs' : + List (Fin x, Arg) -> + List (Fin x, TTImp) -> + SnocList (Arg, Maybe TTImp) -> + SortedSet Name -> + (List AnyApp, SnocList (Arg, Maybe TTImp), SortedSet Name) +processArgs' [] _ fvArgs fvNames = ([], fvArgs, fvNames) +processArgs' ((argIdx, arg) :: xs) givens fvArgs fvNames = do + let (givens, argVal, newFVs) : (List _, TTImp, List _) = case givens of + [] => ([], processArg arg Nothing fvNames) + ((givenIdx, givenVal) :: ys) => + if (givenIdx == argIdx) + then (ys, processArg arg (Just givenVal) fvNames) + else (givens, processArg arg Nothing fvNames) + let newFVNames = SortedSet.fromList $ fromMaybe "_" . name . fst <$> newFVs + let fvArgs = fvArgs <>< newFVs + let fvNames = union fvNames newFVNames + mapFst (appArg arg argVal ::) $ processArgs' xs givens fvArgs fvNames + +processArgs : + (sig : GenSignature) -> + List (Fin sig.targetType.args.length, Arg) -> + List (Fin sig.targetType.args.length, TTImp) -> + (TTImp, List Arg, List $ Maybe TTImp) +processArgs sig args givens = do + let (argVals, fvArgs, _) = processArgs' args givens [<] empty + (reAppAny (IVar EmptyFC sig.targetType.name) argVals, unzip $ toList fvArgs) + +remap : List (Maybe TTImp, Fin x, Arg) -> List (TTImp, Fin x, Arg) +remap [] = [] +remap ((Nothing, _, _) :: xs) = remap xs +remap ((Just x, y, z) :: xs) = (x,y,z) :: remap xs + +formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp +formGivenVals [] _ = [] +formGivenVals (_ :: xs) [] = (`(_) :: formGivenVals xs []) +formGivenVals (x :: xs) (y :: ys) = y :: formGivenVals xs ys + +genSS : List (TTImp, Fin x, Arg) -> (s : SortedSet (Fin x) ** Vect s.size TTImp) +genSS l = do + let (l1, l2) = unzip l + let (l2, l3) = unzip l2 + let s = SortedSet.fromList l2 + let gv = formGivenVals (Vect.fromList $ Prelude.toList s) l1 + (s ** gv) + +%tcinline +specialiseIfNeeded : + Monad m => + Elaboration m => + NamesInfoInTypes => + DerivationClosure m => + (sig : GenSignature) -> + (specTaskToName : TTImp -> Name) -> + (fuel : TTImp) -> + Vect sig.givenParams.size TTImp -> + m $ Maybe (List Decl, TypeInfo, TTImp) +specialiseIfNeeded sig specTaskToName fuel givenParamValues = do + let givenIdxVals = (Prelude.toList sig.givenParams) `zipV` givenParamValues + -- Check if there are any given type args, if not return Nothing + let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams + | False => pure Nothing + let argsWithIdx = withIndex sig.targetType.args + let (lambdaRet, fvArgs, givenSubst) = processArgs sig argsWithIdx givenIdxVals + (lambdaTy, lambdaBody) <- normaliseTask fvArgs lambdaRet + let specName = specTaskToName lambdaBody + (specTy, specDecls) : (TypeInfo, List Decl) <- case lookupType specName of + Nothing => do + Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody + | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." + pure (specTy, specDecls) + Just specTy => pure (specTy, []) + let Yes stNamed = areAllTyArgsNamed specTy + | No _ => fail "INTERNAL ERROR: Specialised type \{show specTy.name} does not have fully named arguments and constructors." + let (newGP ** newGVals) = genSS $ remap $ zip givenSubst $ withIndex specTy.args + (inv, cg_rhs) <- callGen (MkGenSignature specTy newGP) fuel newGVals + let inv = case cg_rhs of + Nothing => inv + Just (n ** perm) => reorderGend False perm inv + pure $ Just (specDecls, specTy, inv) + + --- Particular implementations producing the-core-derivation-function closure --- ClosuringContext : (Type -> Type) -> Type From 97ab446d8b33ab5f0de47e19282665e748285411 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 11 Nov 2025 18:22:27 +0300 Subject: [PATCH 04/81] [ cleanup ] Remove unneeded lets from specialiseIfNeeded --- src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr index 0e8b3bcda..9e36a42a2 100644 --- a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr +++ b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr @@ -94,12 +94,11 @@ specialiseIfNeeded : Vect sig.givenParams.size TTImp -> m $ Maybe (List Decl, TypeInfo, TTImp) specialiseIfNeeded sig specTaskToName fuel givenParamValues = do - let givenIdxVals = (Prelude.toList sig.givenParams) `zipV` givenParamValues -- Check if there are any given type args, if not return Nothing let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams | False => pure Nothing - let argsWithIdx = withIndex sig.targetType.args - let (lambdaRet, fvArgs, givenSubst) = processArgs sig argsWithIdx givenIdxVals + let givenIdxVals = (Prelude.toList sig.givenParams) `zipV` givenParamValues + let (lambdaRet, fvArgs, givenSubst) = processArgs sig (withIndex sig.targetType.args) givenIdxVals (lambdaTy, lambdaBody) <- normaliseTask fvArgs lambdaRet let specName = specTaskToName lambdaBody (specTy, specDecls) : (TypeInfo, List Decl) <- case lookupType specName of From 5bd402ef9cc61f3723a2badd55d6b07f1db1352d Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 12 Nov 2025 15:09:30 +0300 Subject: [PATCH 05/81] [ refactor ] Move specialisation-related code to Util.Specialisation --- deptycheck.ipkg | 1 + .../DepTyCheck/Gen/ForAllNeededTypes/Impl.idr | 102 +--------------- .../DepTyCheck/Util/Specialisation.idr | 115 ++++++++++++++++++ 3 files changed, 117 insertions(+), 101 deletions(-) create mode 100644 src/Deriving/DepTyCheck/Util/Specialisation.idr diff --git a/deptycheck.ipkg b/deptycheck.ipkg index 0567ce555..4b02a8841 100644 --- a/deptycheck.ipkg +++ b/deptycheck.ipkg @@ -26,6 +26,7 @@ modules = Deriving.DepTyCheck.Gen , Deriving.DepTyCheck.Util.ArgsPerm , Deriving.DepTyCheck.Util.DeepConsApp , Deriving.DepTyCheck.Util.Primitives + , Deriving.DepTyCheck.Util.Specialisation , Test.DepTyCheck.Gen , Test.DepTyCheck.Gen.Coverage , Test.DepTyCheck.Gen.Emptiness diff --git a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr index 9e36a42a2..505b93f83 100644 --- a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr +++ b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr @@ -13,110 +13,10 @@ import public Decidable.Equality import public Deriving.DepTyCheck.Gen.ForOneType.Interface -import public Deriving.SpecialiseData -import public Language.Reflection.Unify +import Deriving.DepTyCheck.Util.Specialisation %default total -isSimpleN : Name -> Bool -isSimpleN (UN (Basic str)) = (fst $ span isLower str) /= "" -isSimpleN _ = False - -||| Given an argument, a possible given value for it, and a set of free variable names in scope, -||| return argument value in the specialisation lambda body, -||| as well as a list of newly introduced free variables and their given values -processArg : Arg -> Maybe TTImp -> SortedSet Name -> (TTImp, List (Arg, Maybe TTImp)) -processArg arg Nothing fvNames = (IVar EmptyFC $ fromMaybe "_" arg.name, [(arg, Nothing)]) -processArg arg (Just given) fvNames = - case snd $ unPi arg.type of - `(Type) => do - let simpleNames = filter isSimpleN $ allVarNames given - let newNames = filter (not . contains' fvNames) simpleNames - let newArgs : List (Arg, Maybe TTImp) = (\x => (MkArg MW ExplicitArg (Just x) `(_), Just $ IVar EmptyFC x)) <$> newNames - (given, newArgs) - _ => (IVar EmptyFC $ fromMaybe "_" arg.name, [(arg, Just given)]) - -processArgs' : - List (Fin x, Arg) -> - List (Fin x, TTImp) -> - SnocList (Arg, Maybe TTImp) -> - SortedSet Name -> - (List AnyApp, SnocList (Arg, Maybe TTImp), SortedSet Name) -processArgs' [] _ fvArgs fvNames = ([], fvArgs, fvNames) -processArgs' ((argIdx, arg) :: xs) givens fvArgs fvNames = do - let (givens, argVal, newFVs) : (List _, TTImp, List _) = case givens of - [] => ([], processArg arg Nothing fvNames) - ((givenIdx, givenVal) :: ys) => - if (givenIdx == argIdx) - then (ys, processArg arg (Just givenVal) fvNames) - else (givens, processArg arg Nothing fvNames) - let newFVNames = SortedSet.fromList $ fromMaybe "_" . name . fst <$> newFVs - let fvArgs = fvArgs <>< newFVs - let fvNames = union fvNames newFVNames - mapFst (appArg arg argVal ::) $ processArgs' xs givens fvArgs fvNames - -processArgs : - (sig : GenSignature) -> - List (Fin sig.targetType.args.length, Arg) -> - List (Fin sig.targetType.args.length, TTImp) -> - (TTImp, List Arg, List $ Maybe TTImp) -processArgs sig args givens = do - let (argVals, fvArgs, _) = processArgs' args givens [<] empty - (reAppAny (IVar EmptyFC sig.targetType.name) argVals, unzip $ toList fvArgs) - -remap : List (Maybe TTImp, Fin x, Arg) -> List (TTImp, Fin x, Arg) -remap [] = [] -remap ((Nothing, _, _) :: xs) = remap xs -remap ((Just x, y, z) :: xs) = (x,y,z) :: remap xs - -formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp -formGivenVals [] _ = [] -formGivenVals (_ :: xs) [] = (`(_) :: formGivenVals xs []) -formGivenVals (x :: xs) (y :: ys) = y :: formGivenVals xs ys - -genSS : List (TTImp, Fin x, Arg) -> (s : SortedSet (Fin x) ** Vect s.size TTImp) -genSS l = do - let (l1, l2) = unzip l - let (l2, l3) = unzip l2 - let s = SortedSet.fromList l2 - let gv = formGivenVals (Vect.fromList $ Prelude.toList s) l1 - (s ** gv) - -%tcinline -specialiseIfNeeded : - Monad m => - Elaboration m => - NamesInfoInTypes => - DerivationClosure m => - (sig : GenSignature) -> - (specTaskToName : TTImp -> Name) -> - (fuel : TTImp) -> - Vect sig.givenParams.size TTImp -> - m $ Maybe (List Decl, TypeInfo, TTImp) -specialiseIfNeeded sig specTaskToName fuel givenParamValues = do - -- Check if there are any given type args, if not return Nothing - let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams - | False => pure Nothing - let givenIdxVals = (Prelude.toList sig.givenParams) `zipV` givenParamValues - let (lambdaRet, fvArgs, givenSubst) = processArgs sig (withIndex sig.targetType.args) givenIdxVals - (lambdaTy, lambdaBody) <- normaliseTask fvArgs lambdaRet - let specName = specTaskToName lambdaBody - (specTy, specDecls) : (TypeInfo, List Decl) <- case lookupType specName of - Nothing => do - Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody - | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." - pure (specTy, specDecls) - Just specTy => pure (specTy, []) - let Yes stNamed = areAllTyArgsNamed specTy - | No _ => fail "INTERNAL ERROR: Specialised type \{show specTy.name} does not have fully named arguments and constructors." - let (newGP ** newGVals) = genSS $ remap $ zip givenSubst $ withIndex specTy.args - (inv, cg_rhs) <- callGen (MkGenSignature specTy newGP) fuel newGVals - let inv = case cg_rhs of - Nothing => inv - Just (n ** perm) => reorderGend False perm inv - pure $ Just (specDecls, specTy, inv) - - --- Particular implementations producing the-core-derivation-function closure --- ClosuringContext : (Type -> Type) -> Type diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr new file mode 100644 index 000000000..c41061dcd --- /dev/null +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -0,0 +1,115 @@ +module Deriving.DepTyCheck.Util.Specialisation + +import public Control.Monad.Either + +import public Data.DPair +import public Data.List.Ex +import public Data.List.Map +import public Data.SortedMap +import public Data.SortedMap.Extra +import public Data.SortedSet + +import public Deriving.DepTyCheck.Gen.ForOneType.Interface + +import public Deriving.SpecialiseData +import public Language.Reflection.Unify + +%default total + +isSimpleN : Name -> Bool +isSimpleN (UN (Basic str)) = (fst $ span isLower str) /= "" +isSimpleN _ = False + +||| Given an argument, a possible given value for it, and a set of free variable names in scope, +||| return argument value in the specialisation lambda body, +||| as well as a list of newly introduced free variables and their given values +processArg : Arg -> Maybe TTImp -> SortedSet Name -> (TTImp, List (Arg, Maybe TTImp)) +processArg arg Nothing fvNames = (IVar EmptyFC $ fromMaybe "_" arg.name, [(arg, Nothing)]) +processArg arg (Just given) fvNames = + case snd $ unPi arg.type of + `(Type) => do + let simpleNames = filter isSimpleN $ allVarNames given + let newNames = filter (not . contains' fvNames) simpleNames + let newArgs : List (Arg, Maybe TTImp) = newNames <&> \x => (MkArg MW ExplicitArg (Just x) `(_), Just $ IVar EmptyFC x) + (given, newArgs) + _ => (IVar EmptyFC $ fromMaybe "_" arg.name, [(arg, Just given)]) + +processArgs' : + List (Fin x, Arg) -> + List (Fin x, TTImp) -> + SnocList (Arg, Maybe TTImp) -> + SortedSet Name -> + (List AnyApp, SnocList (Arg, Maybe TTImp), SortedSet Name) +processArgs' [] _ fvArgs fvNames = ([], fvArgs, fvNames) +processArgs' ((argIdx, arg) :: xs) givens fvArgs fvNames = do + let (givens, argVal, newFVs) : (List _, TTImp, List _) = case givens of + [] => ([], processArg arg Nothing fvNames) + (givenIdx, givenVal) :: ys => + if givenIdx == argIdx + then (ys, processArg arg (Just givenVal) fvNames) + else (givens, processArg arg Nothing fvNames) + let newFVNames = SortedSet.fromList $ fromMaybe "_" . name . fst <$> newFVs + let fvArgs = fvArgs <>< newFVs + let fvNames = union fvNames newFVNames + mapFst (appArg arg argVal ::) $ processArgs' xs givens fvArgs fvNames + +processArgs : + (sig : GenSignature) -> + List (Fin sig.targetType.args.length, Arg) -> + List (Fin sig.targetType.args.length, TTImp) -> + (TTImp, List Arg, List $ Maybe TTImp) +processArgs sig args givens = do + let (argVals, fvArgs, _) = processArgs' args givens [<] empty + (reAppAny (IVar EmptyFC sig.targetType.name) argVals, unzip $ toList fvArgs) + +remap : List (Maybe TTImp, Fin x, Arg) -> List (TTImp, Fin x, Arg) +remap [] = [] +remap ((Nothing, _, _) :: xs) = remap xs +remap ((Just x, y, z) :: xs) = (x,y,z) :: remap xs + +formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp +formGivenVals [] _ = [] +formGivenVals (_ :: xs) [] = (`(_) :: formGivenVals xs []) +formGivenVals (x :: xs) (y :: ys) = y :: formGivenVals xs ys + +genSS : List (TTImp, Fin x, Arg) -> (s : SortedSet (Fin x) ** Vect s.size TTImp) +genSS l = do + let (l1, l2) = unzip l + let (l2, l3) = unzip l2 + let s = SortedSet.fromList l2 + let gv = formGivenVals (Vect.fromList $ Prelude.toList s) l1 + (s ** gv) + +%tcinline +specialiseIfNeeded : + Monad m => + Elaboration m => + NamesInfoInTypes => + DerivationClosure m => + (sig : GenSignature) -> + (specTaskToName : TTImp -> Name) -> + (fuel : TTImp) -> + Vect sig.givenParams.size TTImp -> + m $ Maybe (List Decl, TypeInfo, TTImp) +specialiseIfNeeded sig specTaskToName fuel givenParamValues = do + -- Check if there are any given type args, if not return Nothing + let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams + | False => pure Nothing + let givenIdxVals = (Prelude.toList sig.givenParams) `zipV` givenParamValues + let (lambdaRet, fvArgs, givenSubst) = processArgs sig (withIndex sig.targetType.args) givenIdxVals + (lambdaTy, lambdaBody) <- normaliseTask fvArgs lambdaRet + let specName = specTaskToName lambdaBody + (specTy, specDecls) : (TypeInfo, List Decl) <- case lookupType specName of + Nothing => do + Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody + | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." + pure (specTy, specDecls) + Just specTy => pure (specTy, []) + let Yes stNamed = areAllTyArgsNamed specTy + | No _ => fail "INTERNAL ERROR: Specialised type \{show specTy.name} does not have fully named arguments and constructors." + let (newGP ** newGVals) = genSS $ remap $ zip givenSubst $ withIndex specTy.args + (inv, cg_rhs) <- callGen (MkGenSignature specTy newGP) fuel newGVals + let inv = case cg_rhs of + Nothing => inv + Just (n ** perm) => reorderGend False perm inv + pure $ Just (specDecls, specTy, inv) From 88a24255282060414c4df4df56c4e631104ccf6b Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 25 Nov 2025 18:11:05 +0300 Subject: [PATCH 06/81] [refactor, new] Add first test for specialiseIfNeeded --- .../src/Deriving/SpecialiseData.idr | 30 +++-- .../src/Language/Reflection/Compat.idr | 39 ++++++ .../Language/Reflection/Unify/Interface.idr | 87 +++++++++++-- .../Reflection/Unify/WithCompiler.idr | 18 +-- .../src/Language/Reflection/VarSubst.idr | 4 +- .../tests/specialise-data/_shared/Shared.idr | 38 ------ .../unify-with-compiler/_shared/Shared.idr | 14 -- .../DepTyCheck/Util/Specialisation.idr | 77 ++++++----- tests/Tests.idr | 1 + .../specialise-if-needed/_common/Shared.idr | 121 ++++++++++++++++++ .../specialise-if-needed/_common/Test.idr | 1 + .../utils/specialise-if-needed/_common/run | 8 ++ .../specialise-if-needed/_common/test.ipkg | 3 + .../spec-if-needed-001/Shared.idr | 1 + .../spec-if-needed-001/Test.idr | 7 + .../spec-if-needed-001/expected | 4 + .../spec-if-needed-001/run | 1 + .../spec-if-needed-001/test.ipkg | 1 + 18 files changed, 333 insertions(+), 122 deletions(-) create mode 100644 tests/derivation/utils/specialise-if-needed/_common/Shared.idr create mode 100644 tests/derivation/utils/specialise-if-needed/_common/Test.idr create mode 100644 tests/derivation/utils/specialise-if-needed/_common/run create mode 100644 tests/derivation/utils/specialise-if-needed/_common/test.ipkg create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Shared.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-001/run create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-001/test.ipkg diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index a5990e7fa..849292e84 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -1,31 +1,33 @@ module Deriving.SpecialiseData import Control.Monad.Either -import Control.Monad.Error.Either -import Control.Monad.Error.Interface -import Control.Monad.Reader.Tuple import Control.Monad.Trans -import Data.SnocList import Data.DPair -import Data.List1 -import Data.Vect -import Data.Vect.Quantifiers +import Data.Either +import Data.Fin.Set import Data.List +import public Data.List.Map -- workaround for compiler bug import Data.List.Quantifiers -import Data.Either +import Data.List1 +import Data.Maybe +import Data.SnocList import Data.SortedMap -import Data.SortedSet import Data.SortedMap.Dependent -import Decidable.Equality +import Data.SortedSet +import Data.Vect +import Data.Vect.Quantifiers +import public Decidable.Decidable +import public Decidable.Equality import Deriving.Show import public Language.Mk import Language.Reflection.Compat import Language.Reflection.Compat.Constr -import Language.Reflection.Compat.TypeInfo +import public Language.Reflection.Compat.TypeInfo -- workaround for compiler bug import Language.Reflection.Expr +import Language.Reflection.Syntax import Language.Reflection.Logging -import Language.Reflection.Unify -import Language.Reflection.VarSubst +import public Language.Reflection.Unify.Interface +import public Language.Reflection.VarSubst -- workaround for compiler bug import Syntax.IHateParens %language ElabReflection @@ -331,7 +333,7 @@ getTask resultName resultKind resultContent = do , ttArgs , ttArgsNamed , currentNs - , resultName + , resultName = snd $ unNS resultName , fullInvocation = tqRet --- TODO: intelligent full invocation , polyTy , polyTyNamed diff --git a/elab-util-extra/src/Language/Reflection/Compat.idr b/elab-util-extra/src/Language/Reflection/Compat.idr index c4468d3ba..0ce76c110 100644 --- a/elab-util-extra/src/Language/Reflection/Compat.idr +++ b/elab-util-extra/src/Language/Reflection/Compat.idr @@ -10,6 +10,8 @@ import public Data.List1 import public Data.String import public Data.Vect +import public Deriving.Show + import public Language.Reflection import Language.Reflection.Expr import Language.Reflection.Logging @@ -18,6 +20,8 @@ import public Language.Reflection.Syntax.Ops %default total +%language ElabReflection + -------------------------------------------------------------------------------- -- General Types -------------------------------------------------------------------------------- @@ -30,6 +34,34 @@ record Con where args : List Arg type : TTImp +countShow : Show Count +countShow = %runElab derive + +export +Show Count where + show = show @{countShow} + +piInfoShow : Show a => Show (PiInfo a) +piInfoShow = %runElab derive + +export +Show a => Show (PiInfo a) where + show = show @{piInfoShow} + +argShow : Show Arg +argShow = %runElab derive + +export +Show Arg where + show = show @{argShow} + +conShow : Show Con +conShow = %runElab derive + +export +Show Con where + show = show @{conShow} + ||| Tries to lookup a constructor by name. export getCon : Elaboration m => Name -> m Con @@ -62,6 +94,13 @@ export LogPosition TypeInfo where logPosition = show . name +tiShow : Show TypeInfo +tiShow = %runElab derive + +export +Show TypeInfo where + show = show @{tiShow} + ||| Tries to get information about the data type specified ||| by name. The name need not be fully qualified, but ||| needs to be unambiguous. diff --git a/elab-util-extra/src/Language/Reflection/Unify/Interface.idr b/elab-util-extra/src/Language/Reflection/Unify/Interface.idr index 42fbf1eca..a03bc8d34 100644 --- a/elab-util-extra/src/Language/Reflection/Unify/Interface.idr +++ b/elab-util-extra/src/Language/Reflection/Unify/Interface.idr @@ -5,12 +5,11 @@ import Data.Either import Data.Fin.Set import Data.SortedMap import Data.Vect +import Data.Vect.Quantifiers import Decidable.Equality -import Derive.Prelude +import Deriving.Show import Language.Reflection import Language.Reflection.Expr -import Language.Reflection.TTImp -import Language.Reflection.TT import Language.Reflection.Syntax %language ElabReflection @@ -38,9 +37,24 @@ record UnificationTask where %name UnificationTask task -%runElab derive "Count" [Show] -%runElab derive "PiInfo" [Show] -%runElab derive "Syntax.Arg" [Show] +sCount : Show Count +sCount = %runElab derive + +Show Count where + show = show @{sCount} + +sPiInfo : Show a => Show (PiInfo a) +sPiInfo = %runElab derive + +Show a => Show (PiInfo a) where + show = show @{sPiInfo} + +sArg : Show Arg +sArg = %runElab derive + +Show Arg where + show = show @{sArg} + export Show UnificationTask where @@ -74,7 +88,17 @@ record FVData where %name FVData fv, fvData -%runElab derive "FVData" [Show, Eq] +sFVData : Show FVData +sFVData = %runElab derive + +export +Show FVData where + show = show @{sFVData} + +export +Eq FVData where + (MkFVData name holeName rig piInfo type value) == (MkFVData name' holeName' rig' piInfo' type' value') = + name == name' && holeName == holeName' && rig == rig' && piInfo == piInfo' && type == type' && value == value' export Interpolation FVData where @@ -137,7 +161,18 @@ record DependencyGraph where %name DependencyGraph dg, depGraph -%runElab derive "DependencyGraph" [Show] +export +Show DependencyGraph where + showPrec p t = + showCon p "MkDG" $ + joinBy "" $ + [ showArg t.freeVars + , showArg t.fvData + , showArg t.fvDeps + , showArg t.empties + , showArg t.nameToId + , showArg t.holeToId + ] export Eq DependencyGraph where @@ -164,7 +199,18 @@ record UnificationResult where ||| (specialised constructor arguments) order : List $ Fin uniDg.freeVars -%runElab derive "UnificationResult" [Show] +export +Show UnificationResult where + showPrec p t = + showCon p "MkUR" $ + joinBy "" $ + [ showArg t.task + , showArg t.uniDg + , showArg t.lhsResult + , showArg t.rhsResult + , showArg t.fullResult + , showArg t.order + ] public export data UnificationError : Type where @@ -174,7 +220,21 @@ data UnificationError : Type where ExtractionError : TTImp -> UnificationError NoUnificationError : UnificationError -%runElab derive "UnificationError" [Show, Eq] +sUE : Show UnificationError +sUE = %runElab derive + +export +Show UnificationError where + show = show @{sUE} + +export +Eq UnificationError where + CatastrophicError == CatastrophicError = True + InternalError s == InternalError s' = s == s' + TargetTypeError t == TargetTypeError t' = t == t' + ExtractionError t == ExtractionError t' = t == t' + NoUnificationError == NoUnificationError = True + _ == _ = False public export data UnificationVerdict : Type where @@ -182,7 +242,12 @@ data UnificationVerdict : Type where Undecided : UnificationVerdict Fail : UnificationError -> UnificationVerdict -%runElab derive "UnificationVerdict" [Show] +sUV : Show UnificationVerdict +sUV = %runElab derive + +export +Show UnificationVerdict where + show = show @{sUV} export %inline isSuccess : UnificationVerdict -> Bool diff --git a/elab-util-extra/src/Language/Reflection/Unify/WithCompiler.idr b/elab-util-extra/src/Language/Reflection/Unify/WithCompiler.idr index 59489ceba..8c2e92c9a 100644 --- a/elab-util-extra/src/Language/Reflection/Unify/WithCompiler.idr +++ b/elab-util-extra/src/Language/Reflection/Unify/WithCompiler.idr @@ -1,20 +1,20 @@ module Language.Reflection.Unify.WithCompiler -import Control.Monad.Either -import Control.Monad.Writer -import Control.Monad.Identity +import public Control.Monad.Either -- workaround for compiler bug +import public Control.Monad.Writer -- workaround for compiler bug +import public Control.Monad.Identity -- workaround for compiler bug import Data.DPair import Data.Fin.Set import Data.Vect -import Data.Vect.Quantifiers -import Data.SnocVect +import public Data.Vect.Quantifiers -- workaround for compiler bug +import public Data.SnocVect -- workaround for compiler bug import Data.SortedMap -import Decidable.Equality +import public Decidable.Equality -- workaround for compiler bug import Language.Reflection -import Language.Reflection.Expr -import Language.Reflection.Logging +import public Language.Reflection.Expr -- workaround for compiler bug +import public Language.Reflection.Logging -- workaround for compiler bug import Language.Reflection.Syntax -import Language.Reflection.Unify.Interface +import public Language.Reflection.Unify.Interface import Language.Reflection.VarSubst %default total diff --git a/elab-util-extra/src/Language/Reflection/VarSubst.idr b/elab-util-extra/src/Language/Reflection/VarSubst.idr index 8c85450cc..fb0a829a2 100644 --- a/elab-util-extra/src/Language/Reflection/VarSubst.idr +++ b/elab-util-extra/src/Language/Reflection/VarSubst.idr @@ -8,8 +8,8 @@ import Language.Reflection.TTImp import Language.Reflection.TT import Language.Reflection.Util import Control.Monad.Identity -import Control.Monad.Reader -import Control.Monad.Reader.Tuple +import public Control.Monad.Reader -- workaround for compiler bug +import public Control.Monad.Reader.Tuple -- workaround for compiler bug import Control.Monad.State %default total diff --git a/elab-util-extra/tests/specialise-data/_shared/Shared.idr b/elab-util-extra/tests/specialise-data/_shared/Shared.idr index 031847c57..ec045b3fc 100644 --- a/elab-util-extra/tests/specialise-data/_shared/Shared.idr +++ b/elab-util-extra/tests/specialise-data/_shared/Shared.idr @@ -1,45 +1,7 @@ module Shared -import public Control.Monad.Either -import public Control.Monad.Error.Either -import public Control.Monad.Error.Interface -import public Control.Monad.Writer -import public Control.Monad.Identity -import public Control.Monad.Trans -import public Control.Monad.Reader.Reader -import public Control.Monad.Reader.Interface -import public Control.Monad.Reader.Tuple -import public Control.Monad.State -import public Data.DPair -import public Data.Either -import public Data.List -import public Data.List.Map -import public Data.List.Quantifiers -import public Data.Maybe -import public Data.SnocVect -import public Data.SortedSet -import public Data.SortedMap.Dependent -import public Data.Vect -import public Data.Vect.Quantifiers -import public Decidable.Decidable -import public Decidable.Equality -import public Derive.Prelude import public Deriving.SpecialiseData -import public Language.Mk -import public Language.Reflection -import public Language.Reflection.Compat -import public Language.Reflection.Compat.Constr -import public Language.Reflection.Compat.TypeInfo -import public Language.Reflection.Derive -import public Language.Reflection.Expr -import public Language.Reflection.Logging -import public Language.Reflection.Syntax -import public Language.Reflection.Syntax.Ops -import public Language.Reflection.TTImp -import public Language.Reflection.TT -import public Language.Reflection.Types import public Language.Reflection.Unify -import public Language.Reflection.VarSubst ||| Verify that all values in list check to a given type constructExprs : Type -> List TTImp -> Elab () diff --git a/elab-util-extra/tests/unify-with-compiler/_shared/Shared.idr b/elab-util-extra/tests/unify-with-compiler/_shared/Shared.idr index a6d6fa71f..f3f2eee2a 100644 --- a/elab-util-extra/tests/unify-with-compiler/_shared/Shared.idr +++ b/elab-util-extra/tests/unify-with-compiler/_shared/Shared.idr @@ -1,19 +1,5 @@ module Shared -import public Control.Monad.Either -import public Control.Monad.Writer -import public Control.Monad.Identity -import public Decidable.Equality -import public Data.DPair -import public Data.Vect -import public Data.SnocVect -import public Data.Vect.Quantifiers -import public Derive.Prelude -import public Language.Reflection -import public Language.Reflection.Derive -import public Language.Reflection.Expr -import public Language.Reflection.Logging -import public Language.Reflection.Syntax import public Language.Reflection.Unify public export diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index c41061dcd..9f5df1d4e 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -16,71 +16,74 @@ import public Language.Reflection.Unify %default total -isSimpleN : Name -> Bool -isSimpleN (UN (Basic str)) = (fst $ span isLower str) /= "" -isSimpleN _ = False - ||| Given an argument, a possible given value for it, and a set of free variable names in scope, ||| return argument value in the specialisation lambda body, ||| as well as a list of newly introduced free variables and their given values -processArg : Arg -> Maybe TTImp -> SortedSet Name -> (TTImp, List (Arg, Maybe TTImp)) -processArg arg Nothing fvNames = (IVar EmptyFC $ fromMaybe "_" arg.name, [(arg, Nothing)]) -processArg arg (Just given) fvNames = +processArg : NamesInfoInTypes => Subset Arg IsNamedArg -> Maybe TTImp -> SortedSet Name -> (TTImp, List (Subset Arg IsNamedArg, Maybe TTImp)) +processArg (Element arg argN) Nothing fvNames = do + let arg' : Arg + arg' = MkArg arg.count arg.piInfo (Just $ fromString $ "pt^\{show $ argName arg}") arg.type + (IVar EmptyFC $ argName arg', [(Element arg' ItIsNamed, Nothing)]) +processArg (Element arg argN) (Just given) fvNames = case snd $ unPi arg.type of - `(Type) => do - let simpleNames = filter isSimpleN $ allVarNames given - let newNames = filter (not . contains' fvNames) simpleNames - let newArgs : List (Arg, Maybe TTImp) = newNames <&> \x => (MkArg MW ExplicitArg (Just x) `(_), Just $ IVar EmptyFC x) + IType _ => do + let simpleNames = filter (isNothing . lookupType) $ allVarNames given + let newNames = filter (not . contains' fvNames) simpleNames + let newArgs : List (Subset Arg IsNamedArg, Maybe TTImp) = do + newNames <&> \x =>(Element (MkArg MW ExplicitArg (Just x) `(_)) ItIsNamed, Just $ IVar EmptyFC x) + -- let x = fromString "at<\{show $ argName arg}>^\{show x}" + -- in (Element (MkArg MW ExplicitArg (Just x) `(_)) ItIsNamed, Just $ IVar EmptyFC x) (given, newArgs) - _ => (IVar EmptyFC $ fromMaybe "_" arg.name, [(arg, Just given)]) + _ => do + let arg' : Arg + arg' = MkArg arg.count arg.piInfo (Just $ fromString $ "pt^\{show $ argName arg}") arg.type + (IVar EmptyFC $ argName arg', [(Element arg' ItIsNamed, Just given)]) processArgs' : - List (Fin x, Arg) -> + NamesInfoInTypes => + List (Fin x, Subset Arg IsNamedArg) -> List (Fin x, TTImp) -> SnocList (Arg, Maybe TTImp) -> SortedSet Name -> (List AnyApp, SnocList (Arg, Maybe TTImp), SortedSet Name) processArgs' [] _ fvArgs fvNames = ([], fvArgs, fvNames) processArgs' ((argIdx, arg) :: xs) givens fvArgs fvNames = do - let (givens, argVal, newFVs) : (List _, TTImp, List _) = case givens of + let (givens, argVal, newFVs) : (List _, TTImp, List (Subset Arg IsNamedArg, Maybe TTImp)) = + case givens of [] => ([], processArg arg Nothing fvNames) (givenIdx, givenVal) :: ys => if givenIdx == argIdx - then (ys, processArg arg (Just givenVal) fvNames) - else (givens, processArg arg Nothing fvNames) - let newFVNames = SortedSet.fromList $ fromMaybe "_" . name . fst <$> newFVs - let fvArgs = fvArgs <>< newFVs + then (ys , processArg arg (Just givenVal) fvNames) + else (givens, processArg arg Nothing fvNames) + let newFVNames = SortedSet.fromList $ (\(Element a _) : Subset Arg IsNamedArg => argName a) . Builtin.fst <$> newFVs + let fvArgs = fvArgs <>< map (mapFst fst) newFVs let fvNames = union fvNames newFVNames - mapFst (appArg arg argVal ::) $ processArgs' xs givens fvArgs fvNames + mapFst (appArg (fst arg) argVal ::) $ processArgs' xs givens fvArgs fvNames processArgs : + NamesInfoInTypes => (sig : GenSignature) -> - List (Fin sig.targetType.args.length, Arg) -> + List (Fin sig.targetType.args.length, Subset Arg IsNamedArg) -> List (Fin sig.targetType.args.length, TTImp) -> (TTImp, List Arg, List $ Maybe TTImp) processArgs sig args givens = do let (argVals, fvArgs, _) = processArgs' args givens [<] empty (reAppAny (IVar EmptyFC sig.targetType.name) argVals, unzip $ toList fvArgs) -remap : List (Maybe TTImp, Fin x, Arg) -> List (TTImp, Fin x, Arg) -remap [] = [] -remap ((Nothing, _, _) :: xs) = remap xs -remap ((Just x, y, z) :: xs) = (x,y,z) :: remap xs - +export formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp -formGivenVals [] _ = [] -formGivenVals (_ :: xs) [] = (`(_) :: formGivenVals xs []) -formGivenVals (x :: xs) (y :: ys) = y :: formGivenVals xs ys +formGivenVals [] _ = [] +formGivenVals (_ :: xs) [] = `(_) :: formGivenVals xs [] +formGivenVals (x :: xs) (y :: ys) = y :: formGivenVals xs ys genSS : List (TTImp, Fin x, Arg) -> (s : SortedSet (Fin x) ** Vect s.size TTImp) genSS l = do - let (l1, l2) = unzip l - let (l2, l3) = unzip l2 + let (l1, l2, l3) = unzip3 l let s = SortedSet.fromList l2 let gv = formGivenVals (Vect.fromList $ Prelude.toList s) l1 (s ** gv) -%tcinline +export %tcinline specialiseIfNeeded : Monad m => Elaboration m => @@ -95,19 +98,25 @@ specialiseIfNeeded sig specTaskToName fuel givenParamValues = do -- Check if there are any given type args, if not return Nothing let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams | False => pure Nothing - let givenIdxVals = (Prelude.toList sig.givenParams) `zipV` givenParamValues - let (lambdaRet, fvArgs, givenSubst) = processArgs sig (withIndex sig.targetType.args) givenIdxVals + let argsWithPrf = pushIn sig.targetType.args sig.targetTypeCorrect.tyArgsNamed + let givenIdxVals = Prelude.toList sig.givenParams `zipV` givenParamValues + let (lambdaRet, fvArgs, givenSubst) = processArgs sig (zip (List.allFins sig.targetType.args.length) argsWithPrf) givenIdxVals (lambdaTy, lambdaBody) <- normaliseTask fvArgs lambdaRet + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "NormaliseTask returned: lambdaTy = \{show lambdaTy};" + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] " lambdaBody = \{show lambdaBody};" let specName = specTaskToName lambdaBody + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type name: \{show specName}" (specTy, specDecls) : (TypeInfo, List Decl) <- case lookupType specName of Nothing => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type not found, deriving..." Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." pure (specTy, specDecls) Just specTy => pure (specTy, []) + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found or derived \{show specTy.name}" let Yes stNamed = areAllTyArgsNamed specTy | No _ => fail "INTERNAL ERROR: Specialised type \{show specTy.name} does not have fully named arguments and constructors." - let (newGP ** newGVals) = genSS $ remap $ zip givenSubst $ withIndex specTy.args + let (newGP ** newGVals) = genSS $ mapMaybe (\(a,b) => map (,b) a) $ zip givenSubst $ withIndex specTy.args (inv, cg_rhs) <- callGen (MkGenSignature specTy newGP) fuel newGVals let inv = case cg_rhs of Nothing => inv diff --git a/tests/Tests.idr b/tests/Tests.idr index 32e3a8c9d..4304f4764 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: order tuning" `atDir` "derivation/utils/order-tuning" + , "Derivation utils: specialise if needed" `atDir` "derivation/utils/specialise-if-needed" , "Derivation: input validation" `atDir` "derivation/inputvalidation" , "Derivation: running harness" `atDir` "derivation/infra" , [ "Derivation: least effort (\{p}, \{w})" `atDir` "derivation/least-effort/\{p}/\{w}" diff --git a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr new file mode 100644 index 000000000..2653189d2 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr @@ -0,0 +1,121 @@ +module Shared + +import public Control.Monad.Writer +import public Control.Monad.Either +import public Deriving.DepTyCheck.Util.Specialisation +import public Language.Reflection.Unify + +%language ElabReflection + +public export +record CallGen where + constructor MkCallGen + sig : GenSignature + fuel : TTImp + givens : Vect sig.givenParams.size TTImp + +export +[PrintDC] +Monad m => Elaboration m => NamesInfoInTypes => DerivationClosure m where + needWeightFun ti = do + logMsg "" 0 "needWeightFun \{show ti}" + pure () + callGen sig fuel params = do + logPoint Warning "deptycheck.test.utils.specialise" [sig] "CallGen params: \{show params}" + pure (`(_), Nothing) + +export +[WriterDC] +Monad m => Elaboration m => MonadWriter (Maybe CallGen) m => NamesInfoInTypes => DerivationClosure m where + needWeightFun ti = pure () + callGen sig fuel params = do + tell $ Just $ MkCallGen sig fuel params + pure (`(?dc_return), Nothing) + +export +queryVar : Elaboration m => TTImp -> m TTImp +queryVar t@(IVar fc n) = do + getType n >>= pure . \case + (n, _) :: [] => IVar fc n + _ => t +queryVar t = pure t + +export +expandNames : Elaboration m => TTImp -> m TTImp +expandNames = mapMTTImp queryVar + +export +runSIN : Elaboration m => Maybe NamesInfoInTypes -> Bool -> (TTImp -> Name) -> TTImp -> m () +runSIN namesInfo declareSpec mkName e = do + e <- expandNames e + logPoint Warning "deptycheck.test.utils.specialise" [] "Expanded e: \{show e}" + MkNS nsNames <- provideNS + + let modName : Name -> Name + modName n = NS (MkNS $ show n :: nsNames) n + + namesInfo : NamesInfoInTypes <- + case namesInfo of + Nothing => getNamesInfoInTypes' e + Just nInfo => getNamesInfoInTypes' e <&> (<+> nInfo) + + let (IVar _ tn, rs) = unApp e + | _ => fail "Failed to extract type name from invocation" + let Just ti = lookupType tn + | _ => fail "Failed to get type info" + let Yes atin = areAllTyArgsNamed ti + | No _ => fail "Type info has unnamed arguments" + let filtered = filter ((`(_) /=) . snd) $ zip (withIndex ti.args) rs + let givenSet = SortedSet.fromList $ (fst . fst) <$> filtered + let givenVals = formGivenVals (Vect.fromList (Prelude.toList givenSet)) $ snd <$> filtered + let dc = PrintDC @{%search} + + r <- specialiseIfNeeded (MkGenSignature ti givenSet) (modName . mkName) `(?fuel) givenVals + case r of + Nothing => logMsg "" 0 "sIN returned nothing." + Just (sdecls, stype, retExpr) => do + if declareSpec then declare sdecls else pure () + +export +runSIN' : + Elaboration m => + MonadWriter (Maybe CallGen) m => + Maybe NamesInfoInTypes -> Bool -> (TTImp -> Name) -> TTImp -> m $ Maybe TTImp +runSIN' namesInfo declareSpec mkName e = do + e <- expandNames e + logPoint Warning "deptycheck.test.utils.specialise" [] "Expanded e: \{show e}" + MkNS nsNames <- provideNS + + let modName : Name -> Name + modName n = NS (MkNS $ show n :: nsNames) n + + namesInfo : NamesInfoInTypes <- + case namesInfo of + Nothing => getNamesInfoInTypes' e + Just nInfo => getNamesInfoInTypes' e <&> (<+> nInfo) + + let (IVar _ tn, rs) = unApp e + | _ => fail "Failed to extract type name from invocation" + let Just ti = lookupType tn + | _ => fail "Failed to get type info" + let Yes atin = areAllTyArgsNamed ti + | No _ => fail "Type info has unnamed arguments" + let filtered = filter ((`(_) /=) . snd) $ zip (withIndex ti.args) rs + let givenSet = SortedSet.fromList $ (fst . fst) <$> filtered + let givenVals = formGivenVals (Vect.fromList (Prelude.toList givenSet)) $ snd <$> filtered + let dc = WriterDC @{%search} + + r <- specialiseIfNeeded (MkGenSignature ti givenSet) (modName . mkName) `(?fuel) givenVals + case r of + Nothing => pure Nothing + Just (sdecls, stype, retExpr) => do + when declareSpec $ declare sdecls + pure $ Just retExpr + + +export +runSIN'' : + Elaboration m => + Maybe NamesInfoInTypes -> Bool -> (TTImp -> Name) -> TTImp -> m (Maybe TTImp, Maybe CallGen) +runSIN'' namesInfo declareSpec mkName e = + runWriterT {w=Maybe CallGen} {m} $ runSIN' namesInfo declareSpec mkName e diff --git a/tests/derivation/utils/specialise-if-needed/_common/Test.idr b/tests/derivation/utils/specialise-if-needed/_common/Test.idr new file mode 100644 index 000000000..ac248bbd7 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/_common/Test.idr @@ -0,0 +1 @@ +module Test diff --git a/tests/derivation/utils/specialise-if-needed/_common/run b/tests/derivation/utils/specialise-if-needed/_common/run new file mode 100644 index 000000000..ca10a6d8e --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/_common/run @@ -0,0 +1,8 @@ +rm -rf build + +NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names + +flock "$1" pack -q install-deps test.ipkg && \ +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg Test.idr + +rm -rf build diff --git a/tests/derivation/utils/specialise-if-needed/_common/test.ipkg b/tests/derivation/utils/specialise-if-needed/_common/test.ipkg new file mode 100644 index 000000000..5feb1f608 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/_common/test.ipkg @@ -0,0 +1,3 @@ +package test + +depends = deptycheck diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Shared.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Shared.idr new file mode 120000 index 000000000..6401061db --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Shared.idr @@ -0,0 +1 @@ +../_common/Shared.idr \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr new file mode 100644 index 000000000..ee1dcbf45 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr @@ -0,0 +1,7 @@ +module Test + +import Shared + +%language ElabReflection + +%runElab runSIN Nothing False (const "VectNat") `(Vect _ Nat) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected new file mode 100644 index 000000000..4b550f27d --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -0,0 +1,4 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) +LOG deptycheck.test.utils.specialise:0: Expanded e: Data.Vect.Vect _ Prelude.Types.Nat +LOG deptycheck.test.utils.specialise:0: Test.VectNat.VectNat[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/run b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/test.ipkg b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/test.ipkg new file mode 120000 index 000000000..7297aae9f --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/test.ipkg @@ -0,0 +1 @@ +../_common/test.ipkg \ No newline at end of file From 752d41717b95b7d1d192111c7f140cab17c42aa2 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 27 Nov 2025 13:38:17 +0300 Subject: [PATCH 07/81] [ fix ] Remove some type ambiguity from decEq implementation derivator --- elab-util-extra/src/Deriving/SpecialiseData.idr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 849292e84..5d3fb7b59 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -762,7 +762,7 @@ parameters (t : SpecTask) mkDecEqImplClause = let mToPImpl = var $ inGenNS t "mToPImpl" in `(decEqImpl x1 x2) - .= `(decEqInj {f = ~mToPImpl} $ decEq (~mToPImpl x1) (~mToPImpl x2)) + .= `(decEqInj {f = ~mToPImpl} $ let x1' : ~(t.fullInvocation); x1' = (~mToPImpl x1); x2' : ~(t.fullInvocation); x2' = (~mToPImpl x2); in decEq x1' x2') ||| Derive decidable equality From fb04dfe67df87bda403d5240cea1edd1bc540ea8 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 27 Nov 2025 13:38:57 +0300 Subject: [PATCH 08/81] [ new ] Overhaul `processArgs` for more correct specialisation task generation --- .../DepTyCheck/Util/Specialisation.idr | 109 ++++++++++-------- .../specialise-if-needed/_common/Shared.idr | 7 +- .../specialise-if-needed/_common/Test.idr | 1 - .../utils/specialise-if-needed/_common/run | 2 +- .../spec-if-needed-001/Test.idr | 4 +- .../spec-if-needed-001/expected | 6 + .../spec-if-needed-002/Shared.idr | 1 + .../spec-if-needed-002/Test.idr | 13 +++ .../spec-if-needed-002/expected | 10 ++ .../spec-if-needed-002/run | 1 + .../spec-if-needed-002/test.ipkg | 1 + .../spec-if-needed-003/Shared.idr | 1 + .../spec-if-needed-003/Test.idr | 15 +++ .../spec-if-needed-003/expected | 10 ++ .../spec-if-needed-003/run | 1 + .../spec-if-needed-003/test.ipkg | 1 + .../spec-if-needed-004/Shared.idr | 1 + .../spec-if-needed-004/Test.idr | 28 +++++ .../spec-if-needed-004/expected | 18 +++ .../spec-if-needed-004/run | 1 + .../spec-if-needed-004/test.ipkg | 1 + 21 files changed, 178 insertions(+), 54 deletions(-) delete mode 100644 tests/derivation/utils/specialise-if-needed/_common/Test.idr create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Shared.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Test.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-002/run create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-002/test.ipkg create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Shared.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Test.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-003/run create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-003/test.ipkg create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Shared.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Test.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-004/run create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-004/test.ipkg diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 9f5df1d4e..7dc66f90a 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -16,59 +16,69 @@ import public Language.Reflection.Unify %default total -||| Given an argument, a possible given value for it, and a set of free variable names in scope, -||| return argument value in the specialisation lambda body, -||| as well as a list of newly introduced free variables and their given values -processArg : NamesInfoInTypes => Subset Arg IsNamedArg -> Maybe TTImp -> SortedSet Name -> (TTImp, List (Subset Arg IsNamedArg, Maybe TTImp)) -processArg (Element arg argN) Nothing fvNames = do - let arg' : Arg - arg' = MkArg arg.count arg.piInfo (Just $ fromString $ "pt^\{show $ argName arg}") arg.type - (IVar EmptyFC $ argName arg', [(Element arg' ItIsNamed, Nothing)]) -processArg (Element arg argN) (Just given) fvNames = - case snd $ unPi arg.type of - IType _ => do - let simpleNames = filter (isNothing . lookupType) $ allVarNames given - let newNames = filter (not . contains' fvNames) simpleNames - let newArgs : List (Subset Arg IsNamedArg, Maybe TTImp) = do - newNames <&> \x =>(Element (MkArg MW ExplicitArg (Just x) `(_)) ItIsNamed, Just $ IVar EmptyFC x) - -- let x = fromString "at<\{show $ argName arg}>^\{show x}" - -- in (Element (MkArg MW ExplicitArg (Just x) `(_)) ItIsNamed, Just $ IVar EmptyFC x) - (given, newArgs) +allQImpl : Monad m => TTImp -> m TTImp -> m TTImp +allQImpl pi@(IPi _ _ _ _ _ _) r = r +allQImpl _ _ = pure `(?) + +allQuestions : TTImp -> TTImp +allQuestions t = runIdentity $ mapATTImp' allQImpl t + +singleArg : Arg -> Nat -> Maybe TTImp -> (TTImp, List (Arg, Maybe TTImp)) +singleArg a n v = do + let n : Name = fromString "lam^\{show n}" + (IVar EmptyFC n, [(MkArg a.count a.piInfo (Just n) $ allQuestions a.type, v)]) + +processArg : MonadLog m => NamesInfoInTypes => Arg -> Maybe TTImp -> Nat -> m (TTImp, List (Arg, Maybe TTImp)) + +processArgs' : MonadLog m => NamesInfoInTypes => List Arg -> List (Maybe TTImp) -> Nat -> m (List AnyApp, List (Arg, Maybe TTImp)) +processArgs' [] mss k = pure ([], []) +processArgs' (x :: xs) [] k = pure ([], []) +processArgs' (x :: xs) (y :: ys) k = do + (aT, l) <- assert_total $ processArg x y k + (recAA, l') <- processArgs' xs ys (k + length l) + pure (appArg x aT :: recAA, l ++ l') + +processArg arg Nothing argIdx = do + -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Processing non-given \{show arg.name}" + pure $ singleArg arg argIdx Nothing +processArg arg (Just x) argIdx = do + -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Processing \{show arg.name} = \{show x}" + let (appLhs, appTerms) = unAppAny x + case (snd $ unPi arg.type, appLhs) of + (IType _, IVar _ tyName) => case lookupType tyName of + Just tyInfo => do + map (mapFst (reAppAny appLhs)) $ processArgs' tyInfo.args (map (Just . getExpr) appTerms) argIdx + _ => do + -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Can't find type \{show tyName}" + pure $ singleArg arg argIdx (Just x) _ => do - let arg' : Arg - arg' = MkArg arg.count arg.piInfo (Just $ fromString $ "pt^\{show $ argName arg}") arg.type - (IVar EmptyFC $ argName arg', [(Element arg' ItIsNamed, Just given)]) + -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Either non-type arg or wrong appLhs: \{show arg.type}; \{show appLhs}" + pure $ singleArg arg argIdx (Just x) -processArgs' : +mkArgs : NamesInfoInTypes => - List (Fin x, Subset Arg IsNamedArg) -> - List (Fin x, TTImp) -> - SnocList (Arg, Maybe TTImp) -> - SortedSet Name -> - (List AnyApp, SnocList (Arg, Maybe TTImp), SortedSet Name) -processArgs' [] _ fvArgs fvNames = ([], fvArgs, fvNames) -processArgs' ((argIdx, arg) :: xs) givens fvArgs fvNames = do - let (givens, argVal, newFVs) : (List _, TTImp, List (Subset Arg IsNamedArg, Maybe TTImp)) = - case givens of - [] => ([], processArg arg Nothing fvNames) - (givenIdx, givenVal) :: ys => - if givenIdx == argIdx - then (ys , processArg arg (Just givenVal) fvNames) - else (givens, processArg arg Nothing fvNames) - let newFVNames = SortedSet.fromList $ (\(Element a _) : Subset Arg IsNamedArg => argName a) . Builtin.fst <$> newFVs - let fvArgs = fvArgs <>< map (mapFst fst) newFVs - let fvNames = union fvNames newFVNames - mapFst (appArg (fst arg) argVal ::) $ processArgs' xs givens fvArgs fvNames + (sig : GenSignature) -> + List (Fin sig.targetType.args.length, Arg) -> + List (Fin sig.targetType.args.length, TTImp) -> + List (Arg, Maybe TTImp) +mkArgs sig [] _ = [] +mkArgs sig ((_, x) :: xs) [] = (x, Nothing) :: mkArgs sig xs [] +mkArgs sig ((i1, x) :: xs) g@((i2, y) :: ys) = + if i1 == i2 + then (x, Just y) :: mkArgs sig xs ys + else (x, Nothing) :: mkArgs sig xs g processArgs : + MonadLog m => NamesInfoInTypes => (sig : GenSignature) -> - List (Fin sig.targetType.args.length, Subset Arg IsNamedArg) -> + List (Fin sig.targetType.args.length, Arg) -> List (Fin sig.targetType.args.length, TTImp) -> - (TTImp, List Arg, List $ Maybe TTImp) + m (TTImp, List Arg, List $ Maybe TTImp) processArgs sig args givens = do - let (argVals, fvArgs, _) = processArgs' args givens [<] empty - (reAppAny (IVar EmptyFC sig.targetType.name) argVals, unzip $ toList fvArgs) + let (args', givens') = unzip $ mkArgs sig args givens + (argVals, fvArgs) <- processArgs' args' givens' 0 + pure (reAppAny (IVar EmptyFC sig.targetType.name) argVals, unzip fvArgs) export formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp @@ -76,8 +86,8 @@ formGivenVals [] _ = [] formGivenVals (_ :: xs) [] = `(_) :: formGivenVals xs [] formGivenVals (x :: xs) (y :: ys) = y :: formGivenVals xs ys -genSS : List (TTImp, Fin x, Arg) -> (s : SortedSet (Fin x) ** Vect s.size TTImp) -genSS l = do +genGivens : List (TTImp, Fin x, Arg) -> (s : SortedSet (Fin x) ** Vect s.size TTImp) +genGivens l = do let (l1, l2, l3) = unzip3 l let s = SortedSet.fromList l2 let gv = formGivenVals (Vect.fromList $ Prelude.toList s) l1 @@ -98,9 +108,10 @@ specialiseIfNeeded sig specTaskToName fuel givenParamValues = do -- Check if there are any given type args, if not return Nothing let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams | False => pure Nothing - let argsWithPrf = pushIn sig.targetType.args sig.targetTypeCorrect.tyArgsNamed let givenIdxVals = Prelude.toList sig.givenParams `zipV` givenParamValues - let (lambdaRet, fvArgs, givenSubst) = processArgs sig (zip (List.allFins sig.targetType.args.length) argsWithPrf) givenIdxVals + (lambdaRet, fvArgs, givenSubst) <- processArgs sig (withIndex sig.targetType.args) givenIdxVals + let preNorm = foldr lam lambdaRet fvArgs + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Task before normalisation: \{show preNorm}" (lambdaTy, lambdaBody) <- normaliseTask fvArgs lambdaRet logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "NormaliseTask returned: lambdaTy = \{show lambdaTy};" logPoint DetailedDebug "deptycheck.util.specialisation" [sig] " lambdaBody = \{show lambdaBody};" @@ -116,7 +127,7 @@ specialiseIfNeeded sig specTaskToName fuel givenParamValues = do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found or derived \{show specTy.name}" let Yes stNamed = areAllTyArgsNamed specTy | No _ => fail "INTERNAL ERROR: Specialised type \{show specTy.name} does not have fully named arguments and constructors." - let (newGP ** newGVals) = genSS $ mapMaybe (\(a,b) => map (,b) a) $ zip givenSubst $ withIndex specTy.args + let (newGP ** newGVals) = genGivens $ mapMaybe (\(a,b) => map (,b) a) $ zip givenSubst $ withIndex specTy.args (inv, cg_rhs) <- callGen (MkGenSignature specTy newGP) fuel newGVals let inv = case cg_rhs of Nothing => inv diff --git a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr index 2653189d2..b26e7196f 100644 --- a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr +++ b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr @@ -58,14 +58,17 @@ runSIN namesInfo declareSpec mkName e = do case namesInfo of Nothing => getNamesInfoInTypes' e Just nInfo => getNamesInfoInTypes' e <&> (<+> nInfo) + -- logPoint Warning "deptycheck.test.utils.specialise" [] "Types in namesInfo: \{show $ keys knownTypes}" - let (IVar _ tn, rs) = unApp e + let (IVar _ tn, rs) = unAppAny e | _ => fail "Failed to extract type name from invocation" let Just ti = lookupType tn | _ => fail "Failed to get type info" let Yes atin = areAllTyArgsNamed ti | No _ => fail "Type info has unnamed arguments" - let filtered = filter ((`(_) /=) . snd) $ zip (withIndex ti.args) rs + let True = length ti.args == length rs + | _ => fail "Not all arguments have been given parameters" + let filtered = filter ((`(_) /=) . snd) $ zip (withIndex ti.args) $ map getExpr rs let givenSet = SortedSet.fromList $ (fst . fst) <$> filtered let givenVals = formGivenVals (Vect.fromList (Prelude.toList givenSet)) $ snd <$> filtered let dc = PrintDC @{%search} diff --git a/tests/derivation/utils/specialise-if-needed/_common/Test.idr b/tests/derivation/utils/specialise-if-needed/_common/Test.idr deleted file mode 100644 index ac248bbd7..000000000 --- a/tests/derivation/utils/specialise-if-needed/_common/Test.idr +++ /dev/null @@ -1 +0,0 @@ -module Test diff --git a/tests/derivation/utils/specialise-if-needed/_common/run b/tests/derivation/utils/specialise-if-needed/_common/run index ca10a6d8e..21e00ebd1 100644 --- a/tests/derivation/utils/specialise-if-needed/_common/run +++ b/tests/derivation/utils/specialise-if-needed/_common/run @@ -3,6 +3,6 @@ rm -rf build NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names flock "$1" pack -q install-deps test.ipkg && \ -idris2 --check --no-color --console-width 0 --no-banner --find-ipkg Test.idr +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg Test.idr | awk -E $NAMES_CLEANER rm -rf build diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr index ee1dcbf45..25b15854c 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr @@ -4,4 +4,6 @@ import Shared %language ElabReflection -%runElab runSIN Nothing False (const "VectNat") `(Vect _ Nat) +%logging "deptycheck.util.specialisation" 20 + +%runElab runSIN Nothing True (const "VectNat") `(Vect _ Nat) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected index 4b550f27d..263f79b3c 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -1,4 +1,10 @@ 1/2: Building Shared (Shared.idr) 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Data.Vect.Vect _ Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Task before normalisation: \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] NormaliseTask returned: lambdaTy = (lam^0 : Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] lambdaBody = \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat; +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type name: Test.VectNat.VectNat +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type not found, deriving... +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Found or derived Test.VectNat.VectNat LOG deptycheck.test.utils.specialise:0: Test.VectNat.VectNat[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Shared.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Shared.idr new file mode 120000 index 000000000..6401061db --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Shared.idr @@ -0,0 +1 @@ +../_common/Shared.idr \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Test.idr new file mode 100644 index 000000000..77a69ae2b --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Test.idr @@ -0,0 +1,13 @@ +module Test + +import Shared + +%language ElabReflection + +%logging "deptycheck.util.specialisation" 20 + +data X : (t : Type) -> (t -> Nat) -> Type where + +data Y = MkY (X Nat S) + +%runElab runSIN Nothing True (const "SpecX") `(X Nat S) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected new file mode 100644 index 000000000..ec7f7930e --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -0,0 +1,10 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) +LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Prelude.Types.S +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: \ lam^0 => Test.X Prelude.Types.Nat lam^0 +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: Test.SpecX.SpecX +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived Test.SpecX.SpecX +LOG deptycheck.test.utils.specialise:0: Test.SpecX.SpecX[0(fv^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/run b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/test.ipkg b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/test.ipkg new file mode 120000 index 000000000..7297aae9f --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/test.ipkg @@ -0,0 +1 @@ +../_common/test.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Shared.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Shared.idr new file mode 120000 index 000000000..6401061db --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Shared.idr @@ -0,0 +1 @@ +../_common/Shared.idr \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Test.idr new file mode 100644 index 000000000..9c6876609 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Test.idr @@ -0,0 +1,15 @@ +module Test + +import Data.Fin +import Shared + +%language ElabReflection + +%logging "deptycheck.util.specialisation" 20 + + +data X : (t : Type) -> (t -> Type) -> Type where + +data Y = MkY (X Nat Fin) + +%runElab runSIN Nothing True (const "SpecX") `(X Nat Fin) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected new file mode 100644 index 000000000..9c01a65fc --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected @@ -0,0 +1,10 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) +LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Data.Fin.Fin +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: Test.X Prelude.Types.Nat Data.Fin.Fin +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = Type; +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = Test.X Prelude.Types.Nat Data.Fin.Fin; +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: Test.SpecX.SpecX +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived Test.SpecX.SpecX +LOG deptycheck.test.utils.specialise:0: Test.SpecX.SpecX[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/run b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/test.ipkg b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/test.ipkg new file mode 120000 index 000000000..7297aae9f --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/test.ipkg @@ -0,0 +1 @@ +../_common/test.ipkg \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Shared.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Shared.idr new file mode 120000 index 000000000..6401061db --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Shared.idr @@ -0,0 +1 @@ +../_common/Shared.idr \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Test.idr new file mode 100644 index 000000000..13f980e9b --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Test.idr @@ -0,0 +1,28 @@ +module Test + +import Data.Fin +import Shared + +%language ElabReflection + +%logging "deptycheck.util.specialisation" 20 + +data X : (f : Nat -> Type) -> (n : Nat) -> (f n -> Nat) -> Type where + +Nt : Nat -> Type +Nt 0 = Nat +Nt _ = List Nat + +data Y : (a -> Nat) -> Type -> Type where + +Nn : List Nat -> Nat + +data Z = MkZ (Y Nn (X Nt 5 Nn)) + +%runElab runSIN Nothing True (const "X1") `(Y {a=Nat} Nn (X Nt 5 Nn)) + +Nn' : Fin 5 -> Nat + +data Z' = MkZ' (Y Nn' (X Fin 5 Nn')) + +%runElab runSIN Nothing True (const "X2") `(Y {a=Nat} Nn' (X Fin 5 Nn')) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected new file mode 100644 index 000000000..8be50a7c8 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -0,0 +1,18 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) +LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn (Test.X Test.Nt (fromInteger 5) Test.Nn) +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : ({arg:2} : Prelude.Types.Nat) -> Type) -> (lam^2 : Prelude.Types.Nat) -> (lam^3 : ({arg:3} : lam^1 lam^2) -> Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3); +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Test.X1.X1 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Test.X1.X1 +LOG deptycheck.test.utils.specialise:0: Test.X1.X1[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] +LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:3} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Test.X2.X2 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Test.X2.X2 +LOG deptycheck.test.utils.specialise:0: Test.X2.X2[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/run b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/test.ipkg b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/test.ipkg new file mode 120000 index 000000000..7297aae9f --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/test.ipkg @@ -0,0 +1 @@ +../_common/test.ipkg \ No newline at end of file From 576ef608ab480c69457357fc9adaefa8f8ce2a80 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 27 Nov 2025 15:35:49 +0300 Subject: [PATCH 09/81] [ new ] Make `processArgs` more aware of application semantics --- .../DepTyCheck/Util/Specialisation.idr | 89 ++++++++++++++----- 1 file changed, 66 insertions(+), 23 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 7dc66f90a..7470812ff 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -28,32 +28,76 @@ singleArg a n v = do let n : Name = fromString "lam^\{show n}" (IVar EmptyFC n, [(MkArg a.count a.piInfo (Just n) $ allQuestions a.type, v)]) -processArg : MonadLog m => NamesInfoInTypes => Arg -> Maybe TTImp -> Nat -> m (TTImp, List (Arg, Maybe TTImp)) - -processArgs' : MonadLog m => NamesInfoInTypes => List Arg -> List (Maybe TTImp) -> Nat -> m (List AnyApp, List (Arg, Maybe TTImp)) -processArgs' [] mss k = pure ([], []) -processArgs' (x :: xs) [] k = pure ([], []) -processArgs' (x :: xs) (y :: ys) k = do - (aT, l) <- assert_total $ processArg x y k - (recAA, l') <- processArgs' xs ys (k + length l) +record AllApps where + constructor MkAllApps + explicitArgs : List TTImp + autoArgs : List TTImp + namedArgs : SortedMap Name TTImp + +addApp' : AnyApp -> AllApps -> AllApps +addApp' (PosApp s) = {explicitArgs $= (s ::)} +addApp' (NamedApp nm s) = {namedArgs $= insert nm s} +addApp' (AutoApp s) = {autoArgs $= (s ::)} +addApp' (WithApp s) = {explicitArgs $= (s ::)} + +mkAllApps : List AnyApp -> AllApps +mkAllApps laa = foldl (flip addApp') (MkAllApps [] [] empty) $ reverse laa + +getNamed : Maybe Name -> AllApps -> (Maybe TTImp, AllApps) +getNamed Nothing ap = (Nothing, ap) +getNamed (Just x) ap = + case lookup x ap.namedArgs of + Nothing => (Nothing, ap) + Just t => (Just t, {namedArgs $= delete x} ap) + +getGiven : Arg -> AllApps -> (Maybe TTImp, AllApps) +getGiven (MkArg _ ImplicitArg name type) ap = getNamed name ap +getGiven (MkArg _ ExplicitArg name type) (MkAllApps (x :: xs) autoArgs namedArgs) = (Just x, MkAllApps xs autoArgs namedArgs) +getGiven (MkArg _ ExplicitArg name type) ap = getNamed name ap +getGiven (MkArg _ AutoImplicit name type) (MkAllApps explicitArgs (x :: xs) namedArgs) = (Just x, MkAllApps explicitArgs xs namedArgs) +getGiven (MkArg _ AutoImplicit name type) ap = getNamed name ap +getGiven (MkArg _ (DefImplicit x) Nothing type) ap = (Just x, ap) +getGiven (MkArg _ (DefImplicit x) (Just n) type) ap = + case lookup n ap.namedArgs of + Nothing => (Just x, ap) + Just t => (Just t , {namedArgs $= delete n} ap) + +getGivens : List Arg -> AllApps -> List (Maybe TTImp) +getGivens [] aa = [] +getGivens (x :: xs) aa = do + let (mr, aa) = getGiven x aa + mr :: getGivens xs aa + +export +getGivens' : NamesInfoInTypes => TTImp -> Maybe (List (Arg, Maybe TTImp)) +getGivens' t = do + let (IVar _ tyName, aTerms) = unAppAny t + | _ => Nothing + let Just tyInfo = lookupType tyName + | _ => Nothing + Just $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps aTerms) + + +f : (a : Nat) -> String -> Nat + +processArg : MonadLog m => NamesInfoInTypes => Nat -> Arg -> Maybe TTImp -> m (TTImp, List (Arg, Maybe TTImp)) + +processArgs' : MonadLog m => NamesInfoInTypes => Nat -> List (Arg, Maybe TTImp) -> m (List AnyApp, List (Arg, Maybe TTImp)) +processArgs' k [] = pure ([], []) +processArgs' k ((x, y) :: xs) = do + (aT, l) <- assert_total $ processArg k x y + (recAA, l') <- processArgs' (k + length l) xs pure (appArg x aT :: recAA, l ++ l') -processArg arg Nothing argIdx = do +processArg argIdx arg Nothing = do -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Processing non-given \{show arg.name}" pure $ singleArg arg argIdx Nothing -processArg arg (Just x) argIdx = do +processArg argIdx arg (Just x) = do -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Processing \{show arg.name} = \{show x}" let (appLhs, appTerms) = unAppAny x - case (snd $ unPi arg.type, appLhs) of - (IType _, IVar _ tyName) => case lookupType tyName of - Just tyInfo => do - map (mapFst (reAppAny appLhs)) $ processArgs' tyInfo.args (map (Just . getExpr) appTerms) argIdx - _ => do - -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Can't find type \{show tyName}" - pure $ singleArg arg argIdx (Just x) - _ => do - -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Either non-type arg or wrong appLhs: \{show arg.type}; \{show appLhs}" - pure $ singleArg arg argIdx (Just x) + case getGivens' x of + Just givens => map (mapFst $ reAppAny appLhs) $ processArgs' argIdx $ takeWhile (isJust . snd) givens + _ => pure $ singleArg arg argIdx (Just x) mkArgs : NamesInfoInTypes => @@ -76,9 +120,8 @@ processArgs : List (Fin sig.targetType.args.length, TTImp) -> m (TTImp, List Arg, List $ Maybe TTImp) processArgs sig args givens = do - let (args', givens') = unzip $ mkArgs sig args givens - (argVals, fvArgs) <- processArgs' args' givens' 0 - pure (reAppAny (IVar EmptyFC sig.targetType.name) argVals, unzip fvArgs) + map (bimap (reAppAny $ IVar EmptyFC sig.targetType.name) unzip) $ + processArgs' 0 $ mkArgs sig args givens export formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp From 78105cfa7def68d33c1b2840c3ab5685ad96d707 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 27 Nov 2025 16:02:38 +0300 Subject: [PATCH 10/81] [ cleanup ] Break up overlong line --- elab-util-extra/src/Deriving/SpecialiseData.idr | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 5d3fb7b59..16a83ef48 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -762,7 +762,13 @@ parameters (t : SpecTask) mkDecEqImplClause = let mToPImpl = var $ inGenNS t "mToPImpl" in `(decEqImpl x1 x2) - .= `(decEqInj {f = ~mToPImpl} $ let x1' : ~(t.fullInvocation); x1' = (~mToPImpl x1); x2' : ~(t.fullInvocation); x2' = (~mToPImpl x2); in decEq x1' x2') + .= + `(decEqInj {f = ~mToPImpl} $ + let x1' : ~(t.fullInvocation); + x1' = (~mToPImpl x1); + x2' : ~(t.fullInvocation); + x2' = (~mToPImpl x2); + in decEq x1' x2') ||| Derive decidable equality From 00ef425cf055b6f30e9d4da33342452c12b52983 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 27 Nov 2025 16:06:12 +0300 Subject: [PATCH 11/81] [ cleanup ] Minor cleanup --- .../DepTyCheck/Util/Specialisation.idr | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 7470812ff..b78de10c9 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -16,18 +16,6 @@ import public Language.Reflection.Unify %default total -allQImpl : Monad m => TTImp -> m TTImp -> m TTImp -allQImpl pi@(IPi _ _ _ _ _ _) r = r -allQImpl _ _ = pure `(?) - -allQuestions : TTImp -> TTImp -allQuestions t = runIdentity $ mapATTImp' allQImpl t - -singleArg : Arg -> Nat -> Maybe TTImp -> (TTImp, List (Arg, Maybe TTImp)) -singleArg a n v = do - let n : Name = fromString "lam^\{show n}" - (IVar EmptyFC n, [(MkArg a.count a.piInfo (Just n) $ allQuestions a.type, v)]) - record AllApps where constructor MkAllApps explicitArgs : List TTImp @@ -51,13 +39,13 @@ getNamed (Just x) ap = Just t => (Just t, {namedArgs $= delete x} ap) getGiven : Arg -> AllApps -> (Maybe TTImp, AllApps) -getGiven (MkArg _ ImplicitArg name type) ap = getNamed name ap -getGiven (MkArg _ ExplicitArg name type) (MkAllApps (x :: xs) autoArgs namedArgs) = (Just x, MkAllApps xs autoArgs namedArgs) -getGiven (MkArg _ ExplicitArg name type) ap = getNamed name ap -getGiven (MkArg _ AutoImplicit name type) (MkAllApps explicitArgs (x :: xs) namedArgs) = (Just x, MkAllApps explicitArgs xs namedArgs) -getGiven (MkArg _ AutoImplicit name type) ap = getNamed name ap -getGiven (MkArg _ (DefImplicit x) Nothing type) ap = (Just x, ap) -getGiven (MkArg _ (DefImplicit x) (Just n) type) ap = +getGiven (MkArg _ ImplicitArg name _) ap = getNamed name ap +getGiven (MkArg _ ExplicitArg name _) (MkAllApps (x :: xs) autoArgs namedArgs) = (Just x, MkAllApps xs autoArgs namedArgs) +getGiven (MkArg _ ExplicitArg name _) ap = getNamed name ap +getGiven (MkArg _ AutoImplicit name _) (MkAllApps explicitArgs (x :: xs) namedArgs) = (Just x, MkAllApps explicitArgs xs namedArgs) +getGiven (MkArg _ AutoImplicit name _) ap = getNamed name ap +getGiven (MkArg _ (DefImplicit x) Nothing _) ap = (Just x, ap) +getGiven (MkArg _ (DefImplicit x) (Just n) _) ap = case lookup n ap.namedArgs of Nothing => (Just x, ap) Just t => (Just t , {namedArgs $= delete n} ap) @@ -78,7 +66,17 @@ getGivens' t = do Just $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps aTerms) -f : (a : Nat) -> String -> Nat +allQImpl : Monad m => TTImp -> m TTImp -> m TTImp +allQImpl pi@(IPi _ _ _ _ _ _) r = r +allQImpl _ _ = pure `(?) + +allQuestions : TTImp -> TTImp +allQuestions t = runIdentity $ mapATTImp' allQImpl t + +singleArg : Arg -> Nat -> Maybe TTImp -> (TTImp, List (Arg, Maybe TTImp)) +singleArg a n v = do + let n : Name = fromString "lam^\{show n}" + (IVar EmptyFC n, [(MkArg a.count a.piInfo (Just n) $ allQuestions a.type, v)]) processArg : MonadLog m => NamesInfoInTypes => Nat -> Arg -> Maybe TTImp -> m (TTImp, List (Arg, Maybe TTImp)) From 0609c2511bd6c654c061c76e12247fdf2982c965 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 27 Nov 2025 16:41:11 +0300 Subject: [PATCH 12/81] [ fix ] Use different awk invocation --- tests/derivation/utils/specialise-if-needed/_common/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/derivation/utils/specialise-if-needed/_common/run b/tests/derivation/utils/specialise-if-needed/_common/run index 21e00ebd1..dcee849a3 100644 --- a/tests/derivation/utils/specialise-if-needed/_common/run +++ b/tests/derivation/utils/specialise-if-needed/_common/run @@ -3,6 +3,6 @@ rm -rf build NAMES_CLEANER="$(dirname "$(dirname "$(realpath "$1")")")"/.clean-names flock "$1" pack -q install-deps test.ipkg && \ -idris2 --check --no-color --console-width 0 --no-banner --find-ipkg Test.idr | awk -E $NAMES_CLEANER +idris2 --check --no-color --console-width 0 --no-banner --find-ipkg Test.idr | awk -f $NAMES_CLEANER rm -rf build From 4b5e85f24ae040fd615e60b6f77527414f656471 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 9 Dec 2025 19:15:47 +0300 Subject: [PATCH 13/81] [ new ] Autogenerate specialised type names using hashes of specialisation tasks --- deptycheck.ipkg | 2 ++ pack.toml | 6 ++++ .../DepTyCheck/Util/Specialisation.idr | 30 +++++++++++++++++-- .../specialise-if-needed/_common/Shared.idr | 18 +++++------ .../spec-if-needed-001/Test.idr | 2 +- .../spec-if-needed-001/expected | 6 ++-- .../spec-if-needed-002/Test.idr | 2 +- .../spec-if-needed-002/expected | 6 ++-- .../spec-if-needed-003/Test.idr | 2 +- .../spec-if-needed-003/expected | 6 ++-- .../spec-if-needed-004/Test.idr | 4 +-- .../spec-if-needed-004/expected | 12 ++++---- 12 files changed, 64 insertions(+), 32 deletions(-) diff --git a/deptycheck.ipkg b/deptycheck.ipkg index 4b02a8841..e0828c75e 100644 --- a/deptycheck.ipkg +++ b/deptycheck.ipkg @@ -36,6 +36,8 @@ depends = ansi , best-alternative , dependent-vect , elab-util-extra + , hashable + , hashable-derive , i-hate-parens , if-unsolved-implicit , mtl-tuple-impls diff --git a/pack.toml b/pack.toml index 9aab81d2a..f39a8fe1b 100644 --- a/pack.toml +++ b/pack.toml @@ -5,6 +5,12 @@ [install] whitelist = [ "deptycheck-docs", "pil-fun", "pil-dyn" ] +[custom.all.hashable-derive] +type = "github" +url = "https://github.com//uartman/hashable-derive" +commit = "9c1788178848f5718cc1ddd3135bed463cb121d8" +ipkg = "hashable-derive.ipkg" + ####################### ### Elab-util-extra ### ####################### diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index b78de10c9..2ae1b071c 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -14,6 +14,9 @@ import public Deriving.DepTyCheck.Gen.ForOneType.Interface import public Deriving.SpecialiseData import public Language.Reflection.Unify +import public Data.Hashable +import public Data.Hashable.Base + %default total record AllApps where @@ -134,6 +137,28 @@ genGivens l = do let gv = formGivenVals (Vect.fromList $ Prelude.toList s) l1 (s ** gv) +specTaskToName : TTImp -> Name +specTaskToName t = do + let (_, lamBody) = unLambda t + let (callee, _) = unAppAny lamBody + let vname = + case callee of + (IVar _ n) => show $ snd $ unNS n + x => show x + fromString "\{vname}^\{show $ hash t}" + +-- Using the monadic trick makes the performance *much* better. +specTaskToName' : Monad m => TTImp -> m Name +specTaskToName' t = do + let (_, lamBody) = unLambda t + let (callee, _) = unAppAny lamBody + let vname = + case callee of + (IVar _ n) => show $ snd $ unNS n + x => show x + hash <- pure $ show $ hash t + pure $ fromString "\{vname}^\{hash}" + export %tcinline specialiseIfNeeded : Monad m => @@ -141,11 +166,10 @@ specialiseIfNeeded : NamesInfoInTypes => DerivationClosure m => (sig : GenSignature) -> - (specTaskToName : TTImp -> Name) -> (fuel : TTImp) -> Vect sig.givenParams.size TTImp -> m $ Maybe (List Decl, TypeInfo, TTImp) -specialiseIfNeeded sig specTaskToName fuel givenParamValues = do +specialiseIfNeeded sig fuel givenParamValues = do -- Check if there are any given type args, if not return Nothing let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams | False => pure Nothing @@ -156,7 +180,7 @@ specialiseIfNeeded sig specTaskToName fuel givenParamValues = do (lambdaTy, lambdaBody) <- normaliseTask fvArgs lambdaRet logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "NormaliseTask returned: lambdaTy = \{show lambdaTy};" logPoint DetailedDebug "deptycheck.util.specialisation" [sig] " lambdaBody = \{show lambdaBody};" - let specName = specTaskToName lambdaBody + specName <- specTaskToName' lambdaBody logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type name: \{show specName}" (specTy, specDecls) : (TypeInfo, List Decl) <- case lookupType specName of Nothing => do diff --git a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr index b26e7196f..198b10f6e 100644 --- a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr +++ b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr @@ -45,8 +45,8 @@ expandNames : Elaboration m => TTImp -> m TTImp expandNames = mapMTTImp queryVar export -runSIN : Elaboration m => Maybe NamesInfoInTypes -> Bool -> (TTImp -> Name) -> TTImp -> m () -runSIN namesInfo declareSpec mkName e = do +runSIN : Elaboration m => Maybe NamesInfoInTypes -> Bool -> TTImp -> m () +runSIN namesInfo declareSpec e = do e <- expandNames e logPoint Warning "deptycheck.test.utils.specialise" [] "Expanded e: \{show e}" MkNS nsNames <- provideNS @@ -73,7 +73,7 @@ runSIN namesInfo declareSpec mkName e = do let givenVals = formGivenVals (Vect.fromList (Prelude.toList givenSet)) $ snd <$> filtered let dc = PrintDC @{%search} - r <- specialiseIfNeeded (MkGenSignature ti givenSet) (modName . mkName) `(?fuel) givenVals + r <- specialiseIfNeeded (MkGenSignature ti givenSet) `(?fuel) givenVals case r of Nothing => logMsg "" 0 "sIN returned nothing." Just (sdecls, stype, retExpr) => do @@ -83,8 +83,8 @@ export runSIN' : Elaboration m => MonadWriter (Maybe CallGen) m => - Maybe NamesInfoInTypes -> Bool -> (TTImp -> Name) -> TTImp -> m $ Maybe TTImp -runSIN' namesInfo declareSpec mkName e = do + Maybe NamesInfoInTypes -> Bool -> TTImp -> m $ Maybe TTImp +runSIN' namesInfo declareSpec e = do e <- expandNames e logPoint Warning "deptycheck.test.utils.specialise" [] "Expanded e: \{show e}" MkNS nsNames <- provideNS @@ -108,7 +108,7 @@ runSIN' namesInfo declareSpec mkName e = do let givenVals = formGivenVals (Vect.fromList (Prelude.toList givenSet)) $ snd <$> filtered let dc = WriterDC @{%search} - r <- specialiseIfNeeded (MkGenSignature ti givenSet) (modName . mkName) `(?fuel) givenVals + r <- specialiseIfNeeded (MkGenSignature ti givenSet) `(?fuel) givenVals case r of Nothing => pure Nothing Just (sdecls, stype, retExpr) => do @@ -119,6 +119,6 @@ runSIN' namesInfo declareSpec mkName e = do export runSIN'' : Elaboration m => - Maybe NamesInfoInTypes -> Bool -> (TTImp -> Name) -> TTImp -> m (Maybe TTImp, Maybe CallGen) -runSIN'' namesInfo declareSpec mkName e = - runWriterT {w=Maybe CallGen} {m} $ runSIN' namesInfo declareSpec mkName e + Maybe NamesInfoInTypes -> Bool -> TTImp -> m (Maybe TTImp, Maybe CallGen) +runSIN'' namesInfo declareSpec e = + runWriterT {w=Maybe CallGen} {m} $ runSIN' namesInfo declareSpec e diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr index 25b15854c..419fef3f3 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/Test.idr @@ -6,4 +6,4 @@ import Shared %logging "deptycheck.util.specialisation" 20 -%runElab runSIN Nothing True (const "VectNat") `(Vect _ Nat) +%runElab runSIN Nothing True `(Vect _ Nat) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected index 263f79b3c..ac83918ee 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -4,7 +4,7 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Data.Vect.Vect _ Prelude.Ty LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Task before normalisation: \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] NormaliseTask returned: lambdaTy = (lam^0 : Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] lambdaBody = \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat; -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type name: Test.VectNat.VectNat +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type name: Vect^17613086623960416996 LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Found or derived Test.VectNat.VectNat -LOG deptycheck.test.utils.specialise:0: Test.VectNat.VectNat[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Found or derived Test.Vect^17613086623960416996.Vect^17613086623960416996 +LOG deptycheck.test.utils.specialise:0: Test.Vect^17613086623960416996.Vect^17613086623960416996[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Test.idr index 77a69ae2b..0ac5590dc 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Test.idr +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/Test.idr @@ -10,4 +10,4 @@ data X : (t : Type) -> (t -> Nat) -> Type where data Y = MkY (X Nat S) -%runElab runSIN Nothing True (const "SpecX") `(X Nat S) +%runElab runSIN Nothing True `(X Nat S) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index ec7f7930e..0e72ee45d 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -4,7 +4,7 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Pr LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: \ lam^0 => Test.X Prelude.Types.Nat lam^0 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: Test.SpecX.SpecX +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^15319567236415762791 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived Test.SpecX.SpecX -LOG deptycheck.test.utils.specialise:0: Test.SpecX.SpecX[0(fv^lam^0)] CallGen params: [Prelude.Types.S] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived Test.X^15319567236415762791.X^15319567236415762791 +LOG deptycheck.test.utils.specialise:0: Test.X^15319567236415762791.X^15319567236415762791[0(fv^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Test.idr index 9c6876609..079786871 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Test.idr +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/Test.idr @@ -12,4 +12,4 @@ data X : (t : Type) -> (t -> Type) -> Type where data Y = MkY (X Nat Fin) -%runElab runSIN Nothing True (const "SpecX") `(X Nat Fin) +%runElab runSIN Nothing True `(X Nat Fin) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected index 9c01a65fc..da598b5b3 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected @@ -4,7 +4,7 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Da LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: Test.X Prelude.Types.Nat Data.Fin.Fin LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = Test.X Prelude.Types.Nat Data.Fin.Fin; -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: Test.SpecX.SpecX +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^16134534282501286198 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived Test.SpecX.SpecX -LOG deptycheck.test.utils.specialise:0: Test.SpecX.SpecX[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived Test.X^16134534282501286198.X^16134534282501286198 +LOG deptycheck.test.utils.specialise:0: Test.X^16134534282501286198.X^16134534282501286198[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Test.idr index 13f980e9b..0906ed2e6 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Test.idr +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/Test.idr @@ -19,10 +19,10 @@ Nn : List Nat -> Nat data Z = MkZ (Y Nn (X Nt 5 Nn)) -%runElab runSIN Nothing True (const "X1") `(Y {a=Nat} Nn (X Nt 5 Nn)) +%runElab runSIN Nothing True `(Y {a=Nat} Nn (X Nt 5 Nn)) Nn' : Fin 5 -> Nat data Z' = MkZ' (Y Nn' (X Fin 5 Nn')) -%runElab runSIN Nothing True (const "X2") `(Y {a=Nat} Nn' (X Fin 5 Nn')) +%runElab runSIN Nothing True `(Y {a=Nat} Nn' (X Fin 5 Nn')) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index 8be50a7c8..f662f45d7 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -4,15 +4,15 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.N LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : ({arg:2} : Prelude.Types.Nat) -> Type) -> (lam^2 : Prelude.Types.Nat) -> (lam^3 : ({arg:3} : lam^1 lam^2) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Test.X1.X1 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^16724760417298030003 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Test.X1.X1 -LOG deptycheck.test.utils.specialise:0: Test.X1.X1[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Test.Y^16724760417298030003.Y^16724760417298030003 +LOG deptycheck.test.utils.specialise:0: Test.Y^16724760417298030003.Y^16724760417298030003[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:3} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Test.X2.X2 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^10917347264591893612 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Test.X2.X2 -LOG deptycheck.test.utils.specialise:0: Test.X2.X2[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Test.Y^10917347264591893612.Y^10917347264591893612 +LOG deptycheck.test.utils.specialise:0: Test.Y^10917347264591893612.Y^10917347264591893612[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] From da5cfcdeb07d3163ed0d9bab99cf09e581fcdf3b Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 10 Dec 2025 15:12:27 +0300 Subject: [PATCH 14/81] [ fix ] Use local names in derived specialised types --- elab-util-extra/src/Deriving/SpecialiseData.idr | 8 +++++++- .../src/Language/Reflection/Compat/TypeInfo.idr | 3 ++- .../specialise-if-needed/spec-if-needed-001/expected | 4 ++-- .../specialise-if-needed/spec-if-needed-002/expected | 4 ++-- .../specialise-if-needed/spec-if-needed-003/expected | 4 ++-- .../specialise-if-needed/spec-if-needed-004/expected | 8 ++++---- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 16a83ef48..984ee3c58 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -114,7 +114,8 @@ interface NamespaceProvider (0 m : Type -> Type) where constructor MkNSProvider provideNS : m Namespace -export %defaulthint +export +-- %defaulthint CurrentNS : Elaboration m => NamespaceProvider m CurrentNS = MkNSProvider $ do NS nsn _ <- inCurrentNS "" @@ -129,6 +130,11 @@ export inNS : Monad m => Namespace -> NamespaceProvider m inNS ns = MkNSProvider $ pure ns +export +%defaulthint +NoNS : Monad m => NamespaceProvider m +NoNS = inNS (MkNS []) + ||| Prepend namespace into which everything is generated to name inGenNS : SpecTask -> Name -> Name inGenNS task n = do diff --git a/elab-util-extra/src/Language/Reflection/Compat/TypeInfo.idr b/elab-util-extra/src/Language/Reflection/Compat/TypeInfo.idr index 48e00fff0..1f256abac 100644 --- a/elab-util-extra/src/Language/Reflection/Compat/TypeInfo.idr +++ b/elab-util-extra/src/Language/Reflection/Compat/TypeInfo.idr @@ -24,8 +24,9 @@ typeCon ti = MkCon ti.name ti.args type export (.decl) : TypeInfo -> Decl (.decl) ti = - iData Public ti.name tySig [] conITys + iData Public tyName tySig [] conITys where + tyName = snd $ unNS ti.name tySig = piAll type ti.args conITys = (.iTy) <$> ti.cons diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected index ac83918ee..6d1bab67d 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -6,5 +6,5 @@ LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] NormaliseTask ret LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] lambdaBody = \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat; LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type name: Vect^17613086623960416996 LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Found or derived Test.Vect^17613086623960416996.Vect^17613086623960416996 -LOG deptycheck.test.utils.specialise:0: Test.Vect^17613086623960416996.Vect^17613086623960416996[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Found or derived Vect^17613086623960416996.Vect^17613086623960416996 +LOG deptycheck.test.utils.specialise:0: Vect^17613086623960416996.Vect^17613086623960416996[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index 0e72ee45d..dc0f52dbf 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -6,5 +6,5 @@ LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: l LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^15319567236415762791 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived Test.X^15319567236415762791.X^15319567236415762791 -LOG deptycheck.test.utils.specialise:0: Test.X^15319567236415762791.X^15319567236415762791[0(fv^lam^0)] CallGen params: [Prelude.Types.S] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived X^15319567236415762791.X^15319567236415762791 +LOG deptycheck.test.utils.specialise:0: X^15319567236415762791.X^15319567236415762791[0(fv^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected index da598b5b3..f51d99b47 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected @@ -6,5 +6,5 @@ LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: l LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = Test.X Prelude.Types.Nat Data.Fin.Fin; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^16134534282501286198 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived Test.X^16134534282501286198.X^16134534282501286198 -LOG deptycheck.test.utils.specialise:0: Test.X^16134534282501286198.X^16134534282501286198[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived X^16134534282501286198.X^16134534282501286198 +LOG deptycheck.test.utils.specialise:0: X^16134534282501286198.X^16134534282501286198[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index f662f45d7..d89d8588e 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -6,13 +6,13 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3); LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^16724760417298030003 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Test.Y^16724760417298030003.Y^16724760417298030003 -LOG deptycheck.test.utils.specialise:0: Test.Y^16724760417298030003.Y^16724760417298030003[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Y^16724760417298030003.Y^16724760417298030003 +LOG deptycheck.test.utils.specialise:0: Y^16724760417298030003.Y^16724760417298030003[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:3} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^10917347264591893612 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Test.Y^10917347264591893612.Y^10917347264591893612 -LOG deptycheck.test.utils.specialise:0: Test.Y^10917347264591893612.Y^10917347264591893612[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Y^10917347264591893612.Y^10917347264591893612 +LOG deptycheck.test.utils.specialise:0: Y^10917347264591893612.Y^10917347264591893612[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] From f65894c44c64d2025c1211986089b942df6cb2d7 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 10 Dec 2025 16:39:23 +0300 Subject: [PATCH 15/81] [ fix ] Allow detection of existing specialised types in local context --- .../src/Deriving/SpecialiseData.idr | 12 ++++---- pack.toml | 2 +- .../DepTyCheck/Util/Specialisation.idr | 9 ++++-- .../specialise-if-needed/_common/Shared.idr | 6 ++-- .../spec-if-needed-001/expected | 6 ++-- .../spec-if-needed-002/expected | 6 ++-- .../spec-if-needed-003/expected | 6 ++-- .../spec-if-needed-004/expected | 12 ++++---- .../spec-if-needed-005/Shared.idr | 1 + .../spec-if-needed-005/Test.idr | 29 +++++++++++++++++++ .../spec-if-needed-005/expected | 18 ++++++++++++ .../spec-if-needed-005/run | 1 + .../spec-if-needed-005/test.ipkg | 1 + 13 files changed, 81 insertions(+), 28 deletions(-) create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Shared.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Test.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-005/run create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-005/test.ipkg diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 984ee3c58..0af88cd9f 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -114,13 +114,13 @@ interface NamespaceProvider (0 m : Type -> Type) where constructor MkNSProvider provideNS : m Namespace -export +-- export -- %defaulthint -CurrentNS : Elaboration m => NamespaceProvider m -CurrentNS = MkNSProvider $ do - NS nsn _ <- inCurrentNS "" - | _ => fail "Internal error: inCurrentNS did not return NS" - pure nsn +-- CurrentNS : Elaboration m => NamespaceProvider m +-- CurrentNS = MkNSProvider $ do +-- NS nsn _ <- inCurrentNS "" +-- | _ => fail "Internal error: inCurrentNS did not return NS" +-- pure nsn export Monad m => MonadTrans t => NamespaceProvider m => NamespaceProvider (t m) where diff --git a/pack.toml b/pack.toml index f39a8fe1b..ce979a49f 100644 --- a/pack.toml +++ b/pack.toml @@ -8,7 +8,7 @@ whitelist = [ "deptycheck-docs", "pil-fun", "pil-dyn" ] [custom.all.hashable-derive] type = "github" url = "https://github.com//uartman/hashable-derive" -commit = "9c1788178848f5718cc1ddd3135bed463cb121d8" +commit = "37a80fec1c72b7cbdb5a6e182f84899f34bcd1bd" ipkg = "hashable-derive.ipkg" ####################### diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 2ae1b071c..febb05040 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -157,7 +157,7 @@ specTaskToName' t = do (IVar _ n) => show $ snd $ unNS n x => show x hash <- pure $ show $ hash t - pure $ fromString "\{vname}^\{hash}" + pure $ fromString "\{vname}^\{hash}.\{vname}^\{hash}" export %tcinline specialiseIfNeeded : @@ -187,9 +187,12 @@ specialiseIfNeeded sig fuel givenParamValues = do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type not found, deriving..." Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" pure (specTy, specDecls) - Just specTy => pure (specTy, []) - logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found or derived \{show specTy.name}" + Just specTy => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found \{show specTy.name}" + pure (specTy, []) + -- logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found or derived \{show specTy.name}" let Yes stNamed = areAllTyArgsNamed specTy | No _ => fail "INTERNAL ERROR: Specialised type \{show specTy.name} does not have fully named arguments and constructors." let (newGP ** newGVals) = genGivens $ mapMaybe (\(a,b) => map (,b) a) $ zip givenSubst $ withIndex specTy.args diff --git a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr index 198b10f6e..184b87727 100644 --- a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr +++ b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr @@ -83,7 +83,7 @@ export runSIN' : Elaboration m => MonadWriter (Maybe CallGen) m => - Maybe NamesInfoInTypes -> Bool -> TTImp -> m $ Maybe TTImp + Maybe NamesInfoInTypes -> Bool -> TTImp -> m $ Maybe (TTImp, TypeInfo) runSIN' namesInfo declareSpec e = do e <- expandNames e logPoint Warning "deptycheck.test.utils.specialise" [] "Expanded e: \{show e}" @@ -113,12 +113,12 @@ runSIN' namesInfo declareSpec e = do Nothing => pure Nothing Just (sdecls, stype, retExpr) => do when declareSpec $ declare sdecls - pure $ Just retExpr + pure $ Just (retExpr, stype) export runSIN'' : Elaboration m => - Maybe NamesInfoInTypes -> Bool -> TTImp -> m (Maybe TTImp, Maybe CallGen) + Maybe NamesInfoInTypes -> Bool -> TTImp -> m (Maybe (TTImp, TypeInfo), Maybe CallGen) runSIN'' namesInfo declareSpec e = runWriterT {w=Maybe CallGen} {m} $ runSIN' namesInfo declareSpec e diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected index 6d1bab67d..c60b6620b 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -4,7 +4,7 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Data.Vect.Vect _ Prelude.Ty LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Task before normalisation: \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] NormaliseTask returned: lambdaTy = (lam^0 : Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] lambdaBody = \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat; -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type name: Vect^17613086623960416996 +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type name: Vect^9686363643684445030.Vect^9686363643684445030 LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Found or derived Vect^17613086623960416996.Vect^17613086623960416996 -LOG deptycheck.test.utils.specialise:0: Vect^17613086623960416996.Vect^17613086623960416996[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Derived Vect^9686363643684445030.Vect^9686363643684445030 +LOG deptycheck.test.utils.specialise:0: Vect^9686363643684445030.Vect^9686363643684445030[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index dc0f52dbf..1f02ea2f3 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -4,7 +4,7 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Pr LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: \ lam^0 => Test.X Prelude.Types.Nat lam^0 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^15319567236415762791 +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^17949373096448478648.X^17949373096448478648 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived X^15319567236415762791.X^15319567236415762791 -LOG deptycheck.test.utils.specialise:0: X^15319567236415762791.X^15319567236415762791[0(fv^lam^0)] CallGen params: [Prelude.Types.S] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived X^17949373096448478648.X^17949373096448478648 +LOG deptycheck.test.utils.specialise:0: X^17949373096448478648.X^17949373096448478648[0(fv^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected index f51d99b47..953fa3c07 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected @@ -4,7 +4,7 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Da LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: Test.X Prelude.Types.Nat Data.Fin.Fin LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = Test.X Prelude.Types.Nat Data.Fin.Fin; -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^16134534282501286198 +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^8135581006587252120.X^8135581006587252120 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Found or derived X^16134534282501286198.X^16134534282501286198 -LOG deptycheck.test.utils.specialise:0: X^16134534282501286198.X^16134534282501286198[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived X^8135581006587252120.X^8135581006587252120 +LOG deptycheck.test.utils.specialise:0: X^8135581006587252120.X^8135581006587252120[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index d89d8588e..a74e2aa13 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -4,15 +4,15 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.N LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : ({arg:2} : Prelude.Types.Nat) -> Type) -> (lam^2 : Prelude.Types.Nat) -> (lam^3 : ({arg:3} : lam^1 lam^2) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^16724760417298030003 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^14421981371219706324.Y^14421981371219706324 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Y^16724760417298030003.Y^16724760417298030003 -LOG deptycheck.test.utils.specialise:0: Y^16724760417298030003.Y^16724760417298030003[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Y^14421981371219706324.Y^14421981371219706324 +LOG deptycheck.test.utils.specialise:0: Y^14421981371219706324.Y^14421981371219706324[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:3} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^10917347264591893612 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^17936145782101774282.Y^17936145782101774282 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Found or derived Y^10917347264591893612.Y^10917347264591893612 -LOG deptycheck.test.utils.specialise:0: Y^10917347264591893612.Y^10917347264591893612[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Y^17936145782101774282.Y^17936145782101774282 +LOG deptycheck.test.utils.specialise:0: Y^17936145782101774282.Y^17936145782101774282[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Shared.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Shared.idr new file mode 120000 index 000000000..6401061db --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Shared.idr @@ -0,0 +1 @@ +../_common/Shared.idr \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Test.idr new file mode 100644 index 000000000..bfaf96ba1 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Test.idr @@ -0,0 +1,29 @@ +module Test + +import Data.Fin +import Shared + +%language ElabReflection + +%logging "deptycheck.util.specialisation" 20 + + +%runElab do + (Just (_, ti), _) <- runSIN'' Nothing False `(List Nat) + | _ => fail "Didn't generate a specialised type!" + logMsg "" 0 $ show ti.name + specNIIT <- getNamesInfoInTypes ti + logMsg "" 0 $ show $ keys $ knownTypes + runSIN (Just specNIIT) False `(List Nat) + +-- specRes : Maybe (TTImp, TypeInfo) +-- specRes = %runElab runSIN' Nothing True `(List Nat) +-- + +-- specNIIT : NamesInfoInTypes +-- specNIIT = %runElab do +-- let Just (_, ti) = specRes +-- | _ => fail "Didn't find specialised type!" +-- getNamesInfoInTypes ti +-- +-- %runElab runSIN (Just specNIIT) False `(List Nat) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected new file mode 100644 index 000000000..362042334 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected @@ -0,0 +1,18 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) +LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Task before normalisation: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] NormaliseTask returned: lambdaTy = Type; +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] lambdaBody = Prelude.Basics.List Prelude.Types.Nat; +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type name: List^4779069909474151191.List^4779069909474151191 +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type not found, deriving... +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Derived List^4779069909474151191.List^4779069909474151191 +LOG 0: List^4779069909474151191.List^4779069909474151191 +LOG 0: [Prelude.Types.Nat, Prelude.Basics.List, List^4779069909474151191.List^4779069909474151191] +LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Task before normalisation: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] NormaliseTask returned: lambdaTy = Type; +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] lambdaBody = Prelude.Basics.List Prelude.Types.Nat; +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type name: List^4779069909474151191.List^4779069909474151191 +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Found List^4779069909474151191.List^4779069909474151191 +LOG deptycheck.test.utils.specialise:0: List^4779069909474151191.List^4779069909474151191[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/run b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/test.ipkg b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/test.ipkg new file mode 120000 index 000000000..7297aae9f --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/test.ipkg @@ -0,0 +1 @@ +../_common/test.ipkg \ No newline at end of file From b4afb3227202331c5875d233a5c3243933bea042 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 16 Dec 2025 19:20:23 +0300 Subject: [PATCH 16/81] [ cleanup ] Unpin hashable-derive --- pack.toml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pack.toml b/pack.toml index ce979a49f..9aab81d2a 100644 --- a/pack.toml +++ b/pack.toml @@ -5,12 +5,6 @@ [install] whitelist = [ "deptycheck-docs", "pil-fun", "pil-dyn" ] -[custom.all.hashable-derive] -type = "github" -url = "https://github.com//uartman/hashable-derive" -commit = "37a80fec1c72b7cbdb5a6e182f84899f34bcd1bd" -ipkg = "hashable-derive.ipkg" - ####################### ### Elab-util-extra ### ####################### From 40e424000fabbae8d67b7ef39dc984c8b4fea2b8 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Fri, 19 Dec 2025 22:40:31 +0300 Subject: [PATCH 17/81] [ derive ] Call to specialiser during derivation process --- src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr | 2 +- src/Deriving/DepTyCheck/Util/Specialisation.idr | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr index 505b93f83..1cd6fcded 100644 --- a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr +++ b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr @@ -13,7 +13,7 @@ import public Decidable.Equality import public Deriving.DepTyCheck.Gen.ForOneType.Interface -import Deriving.DepTyCheck.Util.Specialisation +import public Deriving.DepTyCheck.Util.Specialisation %default total diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index febb05040..22c4f34c0 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -161,7 +161,6 @@ specTaskToName' t = do export %tcinline specialiseIfNeeded : - Monad m => Elaboration m => NamesInfoInTypes => DerivationClosure m => From 380f3c030eec85e659890876d1f4af26936c9785 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 25 Dec 2025 21:35:20 +0300 Subject: [PATCH 18/81] [ fix ] Don't specialise types with private constructors + immediately declare specialised types --- .../DepTyCheck/Util/Specialisation.idr | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 22c4f34c0..93482bb7e 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -159,6 +159,16 @@ specTaskToName' t = do hash <- pure $ show $ hash t pure $ fromString "\{vname}^\{hash}.\{vname}^\{hash}" +nameUnambigAndVis : Elaboration m => Name -> m Bool +nameUnambigAndVis n = do + [(_, vis)] <- getVis n + | _ => pure False + pure $ vis /= Private + +allConstructorsVisible : Elaboration m => TypeInfo -> m Bool +allConstructorsVisible ti = do + all id <$> traverse nameUnambigAndVis (name <$> ti.cons) + export %tcinline specialiseIfNeeded : Elaboration m => @@ -172,6 +182,8 @@ specialiseIfNeeded sig fuel givenParamValues = do -- Check if there are any given type args, if not return Nothing let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams | False => pure Nothing + True <- allConstructorsVisible sig.targetType + | False => pure Nothing let givenIdxVals = Prelude.toList sig.givenParams `zipV` givenParamValues (lambdaRet, fvArgs, givenSubst) <- processArgs sig (withIndex sig.targetType.args) givenIdxVals let preNorm = foldr lam lambdaRet fvArgs @@ -183,11 +195,18 @@ specialiseIfNeeded sig fuel givenParamValues = do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type name: \{show specName}" (specTy, specDecls) : (TypeInfo, List Decl) <- case lookupType specName of Nothing => do - logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type not found, deriving..." - Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody - | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." - logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" - pure (specTy, specDecls) + info <- try (Just <$> getInfo' specName) (pure Nothing) + case info of + Nothing => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type not found, deriving..." + Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody + | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" + declare specDecls + pure (specTy, []) + Just specTy => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found \{show specTy.name}" + pure (specTy, []) Just specTy => do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found \{show specTy.name}" pure (specTy, []) From 63bc91f5d68100364f8dfb9ab05e155657cb86b0 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 12 Jan 2026 16:57:42 +0300 Subject: [PATCH 19/81] [ fix, refactor ] Fix `specialiseIfNeeded` - Document `AllApps` and its methods - Introduce `GenArg` instead of a tuple - Document steps of `specialiseIfNeeded` - Check if a type argument with given value is passthrough (if so, it doesn't count towards deciding if specialisation is necessary) - Wrap specialised generator call in `map cast` --- .../DepTyCheck/Util/Specialisation.idr | 149 +++++++++++++----- 1 file changed, 106 insertions(+), 43 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 93482bb7e..f2d55945c 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -19,21 +19,31 @@ import public Data.Hashable.Base %default total +||| All argument values applied in an expression +||| +||| Used for convenience when traversing given arguments and their types record AllApps where constructor MkAllApps explicitArgs : List TTImp autoArgs : List TTImp namedArgs : SortedMap Name TTImp +||| Insert an `AnyApp` into `AllApps` addApp' : AnyApp -> AllApps -> AllApps addApp' (PosApp s) = {explicitArgs $= (s ::)} addApp' (NamedApp nm s) = {namedArgs $= insert nm s} addApp' (AutoApp s) = {autoArgs $= (s ::)} addApp' (WithApp s) = {explicitArgs $= (s ::)} +||| Make an `AllApps` out of a list of `AnyApp` +||| +||| Used in conjunction with `unAppAny` mkAllApps : List AnyApp -> AllApps mkAllApps laa = foldl (flip addApp') (MkAllApps [] [] empty) $ reverse laa +||| Pop a value from `AllApps` by argument name +||| +||| The argument/value is returned from `AllApps` getNamed : Maybe Name -> AllApps -> (Maybe TTImp, AllApps) getNamed Nothing ap = (Nothing, ap) getNamed (Just x) ap = @@ -41,6 +51,9 @@ getNamed (Just x) ap = Nothing => (Nothing, ap) Just t => (Just t, {namedArgs $= delete x} ap) +||| Pop an argument value from `AllApps`, returning Nothing if no value is given +||| +||| The argument/value is returned from `AllApps` getGiven : Arg -> AllApps -> (Maybe TTImp, AllApps) getGiven (MkArg _ ImplicitArg name _) ap = getNamed name ap getGiven (MkArg _ ExplicitArg name _) (MkAllApps (x :: xs) autoArgs namedArgs) = (Just x, MkAllApps xs autoArgs namedArgs) @@ -53,76 +66,108 @@ getGiven (MkArg _ (DefImplicit x) (Just n) _) ap = Nothing => (Just x, ap) Just t => (Just t , {namedArgs $= delete n} ap) +||| Extract given values of arguments from `AllApps` getGivens : List Arg -> AllApps -> List (Maybe TTImp) getGivens [] aa = [] getGivens (x :: xs) aa = do let (mr, aa) = getGiven x aa mr :: getGivens xs aa -export -getGivens' : NamesInfoInTypes => TTImp -> Maybe (List (Arg, Maybe TTImp)) -getGivens' t = do - let (IVar _ tyName, aTerms) = unAppAny t - | _ => Nothing - let Just tyInfo = lookupType tyName - | _ => Nothing - Just $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps aTerms) - - allQImpl : Monad m => TTImp -> m TTImp -> m TTImp allQImpl pi@(IPi _ _ _ _ _ _) r = r allQImpl _ _ = pure `(?) +||| Replace every non-function sub-expression with a question mark +||| +||| (x -> (y -> z) -> q) becomes (? -> (? -> ?) -> ?) allQuestions : TTImp -> TTImp allQuestions t = runIdentity $ mapATTImp' allQImpl t -singleArg : Arg -> Nat -> Maybe TTImp -> (TTImp, List (Arg, Maybe TTImp)) -singleArg a n v = do - let n : Name = fromString "lam^\{show n}" - (IVar EmptyFC n, [(MkArg a.count a.piInfo (Just n) $ allQuestions a.type, v)]) +||| An abstract "argument" of a generator +||| +||| Consists of a type constructor's argument and a possible given value +record GenArg where + constructor MkGenArg + arg : Arg + given : Maybe TTImp -processArg : MonadLog m => NamesInfoInTypes => Nat -> Arg -> Maybe TTImp -> m (TTImp, List (Arg, Maybe TTImp)) +unGA : List GenArg -> (List Arg, List (Maybe TTImp)) +unGA [] = ([], []) +unGA (x :: xs) = let (ys, zs) = unGA xs in (x.arg :: ys, x.given :: zs) -processArgs' : MonadLog m => NamesInfoInTypes => Nat -> List (Arg, Maybe TTImp) -> m (List AnyApp, List (Arg, Maybe TTImp)) -processArgs' k [] = pure ([], []) -processArgs' k ((x, y) :: xs) = do - (aT, l) <- assert_total $ processArg k x y - (recAA, l') <- processArgs' (k + length l) xs - pure (appArg x aT :: recAA, l ++ l') - -processArg argIdx arg Nothing = do - -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Processing non-given \{show arg.name}" - pure $ singleArg arg argIdx Nothing -processArg argIdx arg (Just x) = do - -- logPoint DetailedDebug "deptycheck.util.specialisation.processArg" [] "Processing \{show arg.name} = \{show x}" - let (appLhs, appTerms) = unAppAny x - case getGivens' x of - Just givens => map (mapFst $ reAppAny appLhs) $ processArgs' argIdx $ takeWhile (isJust . snd) givens - _ => pure $ singleArg arg argIdx (Just x) +(.isGenerated) : GenArg -> Bool +(.isGenerated) = isNothing . given + +(.isGiven) : GenArg -> Bool +(.isGiven) = isJust . given + +||| Determine if the argument should be specialised or passed through +(.isSpecialising) : Elaboration m => GenArg -> m Bool +(.isSpecialising) (MkGenArg a Nothing) = pure False +(.isSpecialising) (MkGenArg a $ Just g) = do + let True = snd (unPi a.type) == `(Type) + | _ => pure False + case g of + IVar _ n => do + nInfo <- getInfo n + case nInfo of + [] => pure False + _ => pure True + _ => pure True + +||| Extracts given values of arguments from a type invocation expression +export +getGivens' : NamesInfoInTypes => TTImp -> Maybe (List GenArg) +getGivens' t = do + let (IVar _ tyName, aTerms) = unAppAny t + | _ => Nothing + let Just tyInfo = lookupType tyName + | _ => Nothing + Just $ map (uncurry MkGenArg) $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps aTerms) +||| Assemble a list of arguments and their given values from `callGen` inputs mkArgs : NamesInfoInTypes => (sig : GenSignature) -> List (Fin sig.targetType.args.length, Arg) -> List (Fin sig.targetType.args.length, TTImp) -> - List (Arg, Maybe TTImp) + List GenArg mkArgs sig [] _ = [] -mkArgs sig ((_, x) :: xs) [] = (x, Nothing) :: mkArgs sig xs [] +mkArgs sig ((_, x) :: xs) [] = MkGenArg x Nothing :: mkArgs sig xs [] mkArgs sig ((i1, x) :: xs) g@((i2, y) :: ys) = if i1 == i2 - then (x, Just y) :: mkArgs sig xs ys - else (x, Nothing) :: mkArgs sig xs g + then MkGenArg x (Just y) :: mkArgs sig xs ys + else MkGenArg x Nothing :: mkArgs sig xs g + +singleArg : Nat -> GenArg -> (TTImp, List GenArg) +singleArg n (MkGenArg a v) = do + let n : Name = fromString "lam^\{show n}" + (IVar EmptyFC n, [MkGenArg (MkArg a.count a.piInfo (Just n) $ allQuestions a.type) v]) + +processArg : MonadLog m => NamesInfoInTypes => Nat -> GenArg -> m (TTImp, List GenArg) + +processArgs' : MonadLog m => NamesInfoInTypes => Nat -> List GenArg -> m (List AnyApp, List GenArg) +processArgs' k [] = pure ([], []) +processArgs' k (x :: xs) = do + (aT, l) <- assert_total $ processArg k x + (recAA, l') <- processArgs' (k + length l) xs + pure (appArg x.arg aT :: recAA, l ++ l') + +processArg argIdx ga with (ga.given) + processArg argIdx ga | Nothing = pure $ singleArg argIdx ga + processArg argIdx ga | Just x = do + let (appLhs, appTerms) = unAppAny x + case getGivens' x of + Just givens => map (mapFst $ reAppAny appLhs) $ processArgs' argIdx $ takeWhile (.isGiven) givens + _ => pure $ singleArg argIdx ga processArgs : MonadLog m => NamesInfoInTypes => (sig : GenSignature) -> - List (Fin sig.targetType.args.length, Arg) -> - List (Fin sig.targetType.args.length, TTImp) -> + List GenArg -> m (TTImp, List Arg, List $ Maybe TTImp) -processArgs sig args givens = do - map (bimap (reAppAny $ IVar EmptyFC sig.targetType.name) unzip) $ - processArgs' 0 $ mkArgs sig args givens +processArgs sig ga = map (bimap (reAppAny $ IVar EmptyFC sig.targetType.name) unGA) $ processArgs' 0 ga export formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp @@ -182,40 +227,58 @@ specialiseIfNeeded sig fuel givenParamValues = do -- Check if there are any given type args, if not return Nothing let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams | False => pure Nothing + -- Check if all of the generated type's constructors are visible, if not return Nothing True <- allConstructorsVisible sig.targetType | False => pure Nothing + -- Assemble the `GenArg`s from `GenSignature` and given values let givenIdxVals = Prelude.toList sig.givenParams `zipV` givenParamValues - (lambdaRet, fvArgs, givenSubst) <- processArgs sig (withIndex sig.targetType.args) givenIdxVals + let genArgs = mkArgs sig (withIndex sig.targetType.args) givenIdxVals + -- Check if at least one `GenArg` can be specialised upon (i.e. is a type argument and has a non-passthrough given value) + specable <- traverse (.isSpecialising) genArgs + let True = any id specable + | False => pure Nothing + -- Generate specialisation rhs, arguments, and given values + (lambdaRet, fvArgs, givenSubst) <- processArgs sig genArgs let preNorm = foldr lam lambdaRet fvArgs logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Task before normalisation: \{show preNorm}" + -- Normalise the specialisation lambda (lambdaTy, lambdaBody) <- normaliseTask fvArgs lambdaRet logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "NormaliseTask returned: lambdaTy = \{show lambdaTy};" logPoint DetailedDebug "deptycheck.util.specialisation" [sig] " lambdaBody = \{show lambdaBody};" + -- Generate specialised type name specName <- specTaskToName' lambdaBody logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type name: \{show specName}" + -- Check if `NamesInfoInTypes` contains specialised type (specTy, specDecls) : (TypeInfo, List Decl) <- case lookupType specName of + -- If not, try looking it up via elaborator Nothing => do info <- try (Just <$> getInfo' specName) (pure Nothing) case info of Nothing => do + -- If not found at all, derive specialised type logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type not found, deriving..." Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" + -- Declare derived type declare specDecls pure (specTy, []) Just specTy => do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found \{show specTy.name}" - pure (specTy, []) + pure (specTy, []) Just specTy => do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found \{show specTy.name}" pure (specTy, []) - -- logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found or derived \{show specTy.name}" + -- Assert that all of the specialised type's arguments are named for the specialised generator's `GenSignature` (this property should always be true) let Yes stNamed = areAllTyArgsNamed specTy | No _ => fail "INTERNAL ERROR: Specialised type \{show specTy.name} does not have fully named arguments and constructors." + -- Form new givens set and given value list let (newGP ** newGVals) = genGivens $ mapMaybe (\(a,b) => map (,b) a) $ zip givenSubst $ withIndex specTy.args + -- Obtain the specialised generator call (inv, cg_rhs) <- callGen (MkGenSignature specTy newGP) fuel newGVals let inv = case cg_rhs of Nothing => inv Just (n ** perm) => reorderGend False perm inv + -- Use derived cast to convert result back to polymorphic type + let inv = `(map cast $ ~inv) pure $ Just (specDecls, specTy, inv) From 953f2fae9f28463520cb68c5e9b57be59ffec128 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 12 Jan 2026 17:25:43 +0300 Subject: [PATCH 20/81] [ fix ] Make `.cleanup-names` nix-friendly --- tests/.clean-names | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/.clean-names b/tests/.clean-names index 6bb530638..ff801eaf9 100755 --- a/tests/.clean-names +++ b/tests/.clean-names @@ -1,4 +1,4 @@ -#!/bin/awk -f +#!/usr/bin/env -S awk -f # consistently replace numbers to make golden tests more stable. Currently handles: # arg:NNN From 90f0a0db1f8920ea9b4d492c5f4a9dbdb1068938 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 13 Jan 2026 14:48:28 +0300 Subject: [PATCH 21/81] [ new ] Add logging for derived spec types --- src/Deriving/DepTyCheck/Util/Specialisation.idr | 1 + tests/derivation/_common/run | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index f2d55945c..812e676e3 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -262,6 +262,7 @@ specialiseIfNeeded sig fuel givenParamValues = do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" -- Declare derived type declare specDecls + logPoint Trace "deptycheck.util.specialisation" [sig] "Declared specialised type: \{show lambdaRet}" pure (specTy, []) Just specTy => do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found \{show specTy.name}" diff --git a/tests/derivation/_common/run b/tests/derivation/_common/run index dce1363e6..314f04286 100755 --- a/tests/derivation/_common/run +++ b/tests/derivation/_common/run @@ -4,7 +4,7 @@ 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 --log "deptycheck.util.specialisation:10" DerivedGen.idr && \ pack exec DerivedGen.idr } | "$NAMES_CLEANER" From cd7b0f1b42bbc525a8fc78f429a85ff4741595a2 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 13 Jan 2026 15:14:53 +0300 Subject: [PATCH 22/81] [ fix ] Hide SnocVect in le/r/gadt/015 test --- tests/derivation/least-effort/run/gadt/015 mem/DerivedGen.idr | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/derivation/least-effort/run/gadt/015 mem/DerivedGen.idr b/tests/derivation/least-effort/run/gadt/015 mem/DerivedGen.idr index 58c39b479..44da011fd 100644 --- a/tests/derivation/least-effort/run/gadt/015 mem/DerivedGen.idr +++ b/tests/derivation/least-effort/run/gadt/015 mem/DerivedGen.idr @@ -49,6 +49,7 @@ Show (AtIndex idx ty mut) where show _ = "indeed" %hide Prelude.Basics.(:<) +%hide Data.SnocVect.(:<) main : IO () main = runGs From ad0f602e0742c6f1e48806c672af5ffa165d05cc Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 13 Jan 2026 18:50:51 +0300 Subject: [PATCH 23/81] [ fix ] Update expected logs for specIfNeeded --- .../utils/specialise-if-needed/spec-if-needed-001/expected | 1 + .../utils/specialise-if-needed/spec-if-needed-002/expected | 1 + .../utils/specialise-if-needed/spec-if-needed-003/expected | 1 + .../utils/specialise-if-needed/spec-if-needed-004/expected | 2 ++ .../utils/specialise-if-needed/spec-if-needed-005/expected | 1 + 5 files changed, 6 insertions(+) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected index c60b6620b..ad73fc800 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -7,4 +7,5 @@ LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type name: Vect^9686363643684445030.Vect^9686363643684445030 LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Derived Vect^9686363643684445030.Vect^9686363643684445030 +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type: Data.Vect.Vect lam^0 Prelude.Types.Nat LOG deptycheck.test.utils.specialise:0: Vect^9686363643684445030.Vect^9686363643684445030[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index 1f02ea2f3..eb77df962 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -7,4 +7,5 @@ LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] l LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^17949373096448478648.X^17949373096448478648 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived X^17949373096448478648.X^17949373096448478648 +LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type: Test.X Prelude.Types.Nat lam^0 LOG deptycheck.test.utils.specialise:0: X^17949373096448478648.X^17949373096448478648[0(fv^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected index 953fa3c07..6913b85a6 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected @@ -7,4 +7,5 @@ LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] l LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^8135581006587252120.X^8135581006587252120 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived X^8135581006587252120.X^8135581006587252120 +LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type: Test.X Prelude.Types.Nat Data.Fin.Fin LOG deptycheck.test.utils.specialise:0: X^8135581006587252120.X^8135581006587252120[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index a74e2aa13..4939b6f63 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -7,6 +7,7 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^14421981371219706324.Y^14421981371219706324 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Y^14421981371219706324.Y^14421981371219706324 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) LOG deptycheck.test.utils.specialise:0: Y^14421981371219706324.Y^14421981371219706324[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) @@ -15,4 +16,5 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^17936145782101774282.Y^17936145782101774282 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Y^17936145782101774282.Y^17936145782101774282 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) LOG deptycheck.test.utils.specialise:0: Y^17936145782101774282.Y^17936145782101774282[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected index 362042334..b96f2e749 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected @@ -7,6 +7,7 @@ LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type name: List^4779069909474151191.List^4779069909474151191 LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Derived List^4779069909474151191.List^4779069909474151191 +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type: Prelude.Basics.List Prelude.Types.Nat LOG 0: List^4779069909474151191.List^4779069909474151191 LOG 0: [Prelude.Types.Nat, Prelude.Basics.List, List^4779069909474151191.List^4779069909474151191] LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat From 9d6bfd072cce176cc84e56351138d2c7c80cccc5 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 13 Jan 2026 18:59:06 +0300 Subject: [PATCH 24/81] [ fix ] Update expecteds in derivation/core --- .../core/norec part noext 003/expected | 33 +++++-- .../core/norec part noext 004/expected | 33 +++++-- .../core/norec part noext 005/expected | 34 +++++-- .../core/norec t-pi--.. noext 003/expected | 51 ++++++++++- .../core/norec t-pi--.. noext 004/expected | 91 ++++++++++++++++++- 5 files changed, 202 insertions(+), 40 deletions(-) diff --git a/tests/derivation/core/norec part noext 003/expected b/tests/derivation/core/norec part noext 003/expected index d1ae36b68..053ab44b0 100644 --- a/tests/derivation/core/norec part noext 003/expected +++ b/tests/derivation/core/norec part noext 003/expected @@ -1,12 +1,25 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Unsupported applications to a non-concrete type `ty` in Prelude.Types.Just - -DerivedGen:1 - 12 | XShow : Show X - 13 | XShow = %runElab derive - 14 | - 15 | checkedGen : Fuel -> Gen MaybeEmpty X - 16 | checkedGen = deriveGen - ^^^^^^^^^ - +LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type: Prelude.Types.Maybe Prelude.Basics.Bool +Generated values: +----- +----- +MkX (Just False) +----- +MkX Nothing +----- +MkX Nothing +----- +MkX Nothing +----- +MkX (Just True) +----- +MkX (Just True) +----- +MkX (Just False) +----- +MkX (Just True) +----- +MkX Nothing +----- +MkX Nothing diff --git a/tests/derivation/core/norec part noext 004/expected b/tests/derivation/core/norec part noext 004/expected index f1988b3a7..2bc4b9948 100644 --- a/tests/derivation/core/norec part noext 004/expected +++ b/tests/derivation/core/norec part noext 004/expected @@ -1,12 +1,25 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Unsupported applications to a non-concrete type `a` in Builtin.MkPair - -DerivedGen:1 - 13 | XShow = %runElab derive - 14 | - 15 | export - 16 | checkedGen : Fuel -> Gen MaybeEmpty X - 17 | checkedGen = deriveGen - ^^^^^^^^^ - +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair Prelude.Basics.Bool Prelude.Basics.Bool +Generated values: +----- +----- +MkX (True, False) +----- +MkX (False, False) +----- +MkX (False, True) +----- +MkX (True, True) +----- +MkX (True, True) +----- +MkX (False, True) +----- +MkX (True, False) +----- +MkX (False, True) +----- +MkX (False, False) +----- +MkX (True, True) diff --git a/tests/derivation/core/norec part noext 005/expected b/tests/derivation/core/norec part noext 005/expected index f1988b3a7..4bb54f30d 100644 --- a/tests/derivation/core/norec part noext 005/expected +++ b/tests/derivation/core/norec part noext 005/expected @@ -1,12 +1,26 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Unsupported applications to a non-concrete type `a` in Builtin.MkPair - -DerivedGen:1 - 13 | XShow = %runElab derive - 14 | - 15 | export - 16 | checkedGen : Fuel -> Gen MaybeEmpty X - 17 | checkedGen = deriveGen - ^^^^^^^^^ - +LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type: Prelude.Types.Maybe Prelude.Basics.Bool +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair Prelude.Basics.Bool Prelude.Basics.Bool +Generated values: +----- +----- +X1 Nothing +----- +X0 +----- +X0 +----- +X0 +----- +X1 (Just True) +----- +X0 +----- +X1 (Just False) +----- +X0 +----- +X0 +----- +X2 True (True, True) diff --git a/tests/derivation/core/norec t-pi--.. noext 003/expected b/tests/derivation/core/norec t-pi--.. noext 003/expected index fb9423664..08989cf5d 100644 --- a/tests/derivation/core/norec t-pi--.. noext 003/expected +++ b/tests/derivation/core/norec t-pi--.. noext 003/expected @@ -1,7 +1,48 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: While processing right hand side of $resolved1,[0, 1, 2, 3]. While processing right hand side of $resolved1,[0, 1, 2, 3],<>. Can't find an implementation for DecEq Type. - -Deriving.DepTyCheck.Gen.ForOneTypeCon.Impl:1 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - +LOG deptycheck.util.specialisation:10: Builtin.Equal[0(a), 1(b), 2, 3] Declared specialised type: Builtin.Equal {a = Prelude.Basics.Bool} {b = Prelude.Basics.Bool} lam^0 lam^1 +Generated values: +----- +----- +----- +MkX True True Refl +----- +MkX True True Refl +----- +MkX True True Refl +----- +MkX True True Refl +----- +MkX True True Refl +----- +MkX True True Refl +----- +MkX True True Refl +----- +MkX True True Refl +----- +MkX True True Refl +----- +MkX True True Refl +----- +----- +----- +MkX False False Refl +----- +MkX False False Refl +----- +MkX False False Refl +----- +MkX False False Refl +----- +MkX False False Refl +----- +MkX False False Refl +----- +MkX False False Refl +----- +MkX False False Refl +----- +MkX False False Refl +----- +MkX False False Refl diff --git a/tests/derivation/core/norec t-pi--.. noext 004/expected b/tests/derivation/core/norec t-pi--.. noext 004/expected index fb9423664..fdf59b482 100644 --- a/tests/derivation/core/norec t-pi--.. noext 004/expected +++ b/tests/derivation/core/norec t-pi--.. noext 004/expected @@ -1,7 +1,88 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: While processing right hand side of $resolved1,[0, 1, 2, 3]. While processing right hand side of $resolved1,[0, 1, 2, 3],<>. Can't find an implementation for DecEq Type. - -Deriving.DepTyCheck.Gen.ForOneTypeCon.Impl:1 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - +LOG deptycheck.util.specialisation:10: Builtin.Equal[0(a), 1(b), 2, 3] Declared specialised type: Builtin.Equal {a = Prelude.Basics.Bool} {b = Prelude.Basics.Bool} lam^0 lam^1 +Generated values: +----- +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +----- +X1 +----- +X0 True True Refl +----- +X0 True True Refl +----- +X0 True True Refl +----- +X0 True True Refl +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +----- +X1 +----- +X0 False False Refl +----- +X0 False False Refl +----- +X0 False False Refl +----- +X0 False False Refl +----- +X1 +----- +X1 +----- +X1 +----- +X1 +----- +X1 From 25944d5b856c39529878fd9a391fcc532127a31a Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 14 Jan 2026 15:19:04 +0300 Subject: [PATCH 25/81] [ fix ] Add missing check to processArg --- .../DepTyCheck/Util/Specialisation.idr | 6 +++- .../core/norec part w_ext 001/expected | 33 ++++++++++++------ .../core/norec part w_ext 002/expected | 33 ++++++++++++------ .../core/norec part w_ext 003/expected | 34 +++++++++++++------ 4 files changed, 75 insertions(+), 31 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 812e676e3..e09db5a75 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -159,7 +159,10 @@ processArg argIdx ga with (ga.given) let (appLhs, appTerms) = unAppAny x case getGivens' x of Just givens => map (mapFst $ reAppAny appLhs) $ processArgs' argIdx $ takeWhile (.isGiven) givens - _ => pure $ singleArg argIdx ga + _ => pure $ + if (snd (unPi ga.arg.type) == `(Type)) + then (x, []) + else singleArg argIdx ga processArgs : MonadLog m => @@ -224,6 +227,7 @@ specialiseIfNeeded : Vect sig.givenParams.size TTImp -> m $ Maybe (List Decl, TypeInfo, TTImp) specialiseIfNeeded sig fuel givenParamValues = do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Checking specialisation need for \{show givenParamValues}..." -- Check if there are any given type args, if not return Nothing let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams | False => pure Nothing diff --git a/tests/derivation/core/norec part w_ext 001/expected b/tests/derivation/core/norec part w_ext 001/expected index db192f8fc..ae843080a 100644 --- a/tests/derivation/core/norec part w_ext 001/expected +++ b/tests/derivation/core/norec part w_ext 001/expected @@ -1,12 +1,25 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Unsupported applications to a non-concrete type `ty` in Prelude.Types.Just - -DerivedGen:1 - 13 | XShow = %runElab derive - 14 | - 15 | export - 16 | checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X - 17 | checkedGen = deriveGen - ^^^^^^^^^ - +LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type: Prelude.Types.Maybe String +Generated values: +----- +----- +MkX (Just "") +----- +MkX Nothing +----- +MkX Nothing +----- +MkX Nothing +----- +MkX (Just "a") +----- +MkX (Just "") +----- +MkX (Just "a") +----- +MkX Nothing +----- +MkX Nothing +----- +MkX (Just "") diff --git a/tests/derivation/core/norec part w_ext 002/expected b/tests/derivation/core/norec part w_ext 002/expected index df08e4fc2..af24e40c0 100644 --- a/tests/derivation/core/norec part w_ext 002/expected +++ b/tests/derivation/core/norec part w_ext 002/expected @@ -1,12 +1,25 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Unsupported applications to a non-concrete type `a` in Builtin.MkPair - -DerivedGen:1 - 13 | XShow = %runElab derive - 14 | - 15 | export - 16 | checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty X - 17 | checkedGen = deriveGen - ^^^^^^^^^ - +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair String Prelude.Types.Nat +Generated values: +----- +----- +MkX ("a", 0) +----- +MkX ("", 0) +----- +MkX ("", 10) +----- +MkX ("a", 10) +----- +MkX ("", 10) +----- +MkX ("a", 0) +----- +MkX ("", 10) +----- +MkX ("", 0) +----- +MkX ("a", 10) +----- +MkX ("a", 10) diff --git a/tests/derivation/core/norec part w_ext 003/expected b/tests/derivation/core/norec part w_ext 003/expected index df08e4fc2..0c8855edf 100644 --- a/tests/derivation/core/norec part w_ext 003/expected +++ b/tests/derivation/core/norec part w_ext 003/expected @@ -1,12 +1,26 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -Error: While processing right hand side of checkedGen. Error during reflection: Unsupported applications to a non-concrete type `a` in Builtin.MkPair - -DerivedGen:1 - 13 | XShow = %runElab derive - 14 | - 15 | export - 16 | checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty X - 17 | checkedGen = deriveGen - ^^^^^^^^^ - +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair String (Builtin.Pair Prelude.Types.Nat String) +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair Prelude.Types.Nat String +Generated values: +----- +----- +MkX ("", (10, "")) +----- +MkX ("a", (0, "")) +----- +MkX ("", (10, "a")) +----- +MkX ("bc", (10, "a")) +----- +MkX ("bc", (0, "")) +----- +MkX ("a", (10, "a")) +----- +MkX ("", (10, "")) +----- +MkX ("a", (0, "a")) +----- +MkX ("bc", (0, "")) +----- +MkX ("a", (10, "bc")) From e35c2eb890163e9b830eb6abecf2b3a659fa2843 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 14 Jan 2026 15:54:20 +0300 Subject: [PATCH 26/81] [ fix, new ] Add argument analysis logging and fix specIfNeeded tests --- .../DepTyCheck/Util/Specialisation.idr | 44 ++++++++++++------- .../spec-if-needed-001/expected | 3 ++ .../spec-if-needed-002/expected | 5 ++- .../spec-if-needed-003/expected | 3 ++ .../spec-if-needed-004/expected | 30 +++++++++---- .../spec-if-needed-005/expected | 4 ++ 6 files changed, 64 insertions(+), 25 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index e09db5a75..19957ff59 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -91,6 +91,10 @@ record GenArg where arg : Arg given : Maybe TTImp +LogPosition GenArg where + logPosition (MkGenArg a Nothing) = "\{fromMaybe "" a.name}" + logPosition (MkGenArg a $ Just t) = "(\{fromMaybe "" a.name} := \{show t})" + unGA : List GenArg -> (List Arg, List (Maybe TTImp)) unGA [] = ([], []) unGA (x :: xs) = let (ys, zs) = unGA xs in (x.arg :: ys, x.given :: zs) @@ -117,13 +121,13 @@ unGA (x :: xs) = let (ys, zs) = unGA xs in (x.arg :: ys, x.given :: zs) ||| Extracts given values of arguments from a type invocation expression export -getGivens' : NamesInfoInTypes => TTImp -> Maybe (List GenArg) +getGivens' : NamesInfoInTypes => TTImp -> Maybe (TypeInfo, List GenArg) getGivens' t = do let (IVar _ tyName, aTerms) = unAppAny t | _ => Nothing let Just tyInfo = lookupType tyName | _ => Nothing - Just $ map (uncurry MkGenArg) $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps aTerms) + Just $ (tyInfo, map (uncurry MkGenArg) $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps aTerms)) ||| Assemble a list of arguments and their given values from `callGen` inputs mkArgs : @@ -144,25 +148,33 @@ singleArg n (MkGenArg a v) = do let n : Name = fromString "lam^\{show n}" (IVar EmptyFC n, [MkGenArg (MkArg a.count a.piInfo (Just n) $ allQuestions a.type) v]) -processArg : MonadLog m => NamesInfoInTypes => Nat -> GenArg -> m (TTImp, List GenArg) +processArg : MonadLog m => NamesInfoInTypes => GenSignature -> TypeInfo -> Nat -> GenArg -> m (TTImp, List GenArg) -processArgs' : MonadLog m => NamesInfoInTypes => Nat -> List GenArg -> m (List AnyApp, List GenArg) -processArgs' k [] = pure ([], []) -processArgs' k (x :: xs) = do - (aT, l) <- assert_total $ processArg k x - (recAA, l') <- processArgs' (k + length l) xs +processArgs' : MonadLog m => NamesInfoInTypes => GenSignature -> TypeInfo -> Nat -> List GenArg -> m (List AnyApp, List GenArg) +processArgs' sig ty k [] = pure ([], []) +processArgs' sig ty k (x :: xs) = do + (aT, l) <- assert_total $ processArg sig ty k x + (recAA, l') <- processArgs' sig ty (k + length l) xs pure (appArg x.arg aT :: recAA, l ++ l') -processArg argIdx ga with (ga.given) - processArg argIdx ga | Nothing = pure $ singleArg argIdx ga - processArg argIdx ga | Just x = do +processArg sig ty argIdx ga with (ga.given) + processArg sig ty argIdx ga | Nothing = do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] "No given value, passing through" + pure $ singleArg argIdx ga + processArg sig ty argIdx ga | Just x = do let (appLhs, appTerms) = unAppAny x case getGivens' x of - Just givens => map (mapFst $ reAppAny appLhs) $ processArgs' argIdx $ takeWhile (.isGiven) givens - _ => pure $ + Just (travTy, givens) => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] "Given a type invocation, traversing arguments: \{show $ map (fromMaybe "" . name . arg) givens}" + map (mapFst $ reAppAny appLhs) $ processArgs' sig travTy argIdx $ takeWhile (.isGiven) givens + _ => if (snd (unPi ga.arg.type) == `(Type)) - then (x, []) - else singleArg argIdx ga + then do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] "Given a type invocation w/o arguments, specialising" + pure (x, []) + else do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] "Given a non-type expr, passing through" + pure $ singleArg argIdx ga processArgs : MonadLog m => @@ -170,7 +182,7 @@ processArgs : (sig : GenSignature) -> List GenArg -> m (TTImp, List Arg, List $ Maybe TTImp) -processArgs sig ga = map (bimap (reAppAny $ IVar EmptyFC sig.targetType.name) unGA) $ processArgs' 0 ga +processArgs sig ga = map (bimap (reAppAny $ IVar EmptyFC sig.targetType.name) unGA) $ processArgs' sig sig.targetType 0 ga export formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected index ad73fc800..6d2649d12 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -1,6 +1,9 @@ 1/2: Building Shared (Shared.idr) 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Data.Vect.Vect _ Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Checking specialisation need for [Prelude.Types.Nat]... +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Data.Vect.Vect len No given value, passing through +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Data.Vect.Vect (elem := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Task before normalisation: \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] NormaliseTask returned: lambdaTy = (lam^0 : Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] lambdaBody = \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat; diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index eb77df962..6644b84d9 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -1,8 +1,11 @@ 1/2: Building Shared (Shared.idr) 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Prelude.Types.S +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Checking specialisation need for [Prelude.Types.Nat, Prelude.Types.S]... +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Test.X (t := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Test.X ({arg:1} := Prelude.Types.S) Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: \ lam^0 => Test.X Prelude.Types.Nat lam^0 -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:2} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^17949373096448478648.X^17949373096448478648 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected index 6913b85a6..75d661f95 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected @@ -1,6 +1,9 @@ 1/2: Building Shared (Shared.idr) 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Data.Fin.Fin +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Checking specialisation need for [Prelude.Types.Nat, Data.Fin.Fin]... +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Test.X (t := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Test.X ({arg:1} := Data.Fin.Fin) Given a type invocation, traversing arguments: [n] LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: Test.X Prelude.Types.Nat Data.Fin.Fin LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = Test.X Prelude.Types.Nat Data.Fin.Fin; diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index 4939b6f63..aad1a03dd 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -1,17 +1,31 @@ 1/2: Building Shared (Shared.idr) 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn (Test.X Test.Nt (fromInteger 5) Test.Nn) -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : ({arg:2} : Prelude.Types.Nat) -> Type) -> (lam^2 : Prelude.Types.Nat) -> (lam^3 : ({arg:3} : lam^1 lam^2) -> Prelude.Types.Nat) -> Type; -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^14421981371219706324.Y^14421981371219706324 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn, Test.X Test.Nt (fromInteger 5) Test.Nn]... +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y (a := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y ({arg:1} := Test.Nn) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y ({arg:2} := Test.X Test.Nt (fromInteger 5) Test.Nn) Given a type invocation, traversing arguments: [f, n, {arg:3}] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X (f := Test.Nt) Given a type invocation w/o arguments, specialising +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X (n := fromInteger 5) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X ({arg:3} := Test.Nn) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Test.Nt lam^1 lam^2) +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:5} : Test.Nt lam^1) -> Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Test.Nt lam^1 lam^2); +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^9242445846110651992.Y^9242445846110651992 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Y^14421981371219706324.Y^14421981371219706324 -LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) -LOG deptycheck.test.utils.specialise:0: Y^14421981371219706324.Y^14421981371219706324[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Y^9242445846110651992.Y^9242445846110651992 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Test.Nt lam^1 lam^2) +LOG deptycheck.test.utils.specialise:0: Y^9242445846110651992.Y^9242445846110651992[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn', Test.X Data.Fin.Fin (fromInteger 5) Test.Nn']... +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y (a := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y ({arg:1} := Test.Nn') Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y ({arg:2} := Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') Given a type invocation, traversing arguments: [f, n, {arg:3}] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X (f := Data.Fin.Fin) Given a type invocation, traversing arguments: [n] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X (n := fromInteger 5) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X ({arg:3} := Test.Nn') Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:1} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:3} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:5} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^17936145782101774282.Y^17936145782101774282 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected index b96f2e749..72a44e3da 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected @@ -1,6 +1,8 @@ 1/2: Building Shared (Shared.idr) 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [Prelude.Types.Nat]... +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Prelude.Basics.List ({arg:1} := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Task before normalisation: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] lambdaBody = Prelude.Basics.List Prelude.Types.Nat; @@ -11,6 +13,8 @@ LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialis LOG 0: List^4779069909474151191.List^4779069909474151191 LOG 0: [Prelude.Types.Nat, Prelude.Basics.List, List^4779069909474151191.List^4779069909474151191] LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [Prelude.Types.Nat]... +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Prelude.Basics.List ({arg:1} := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Task before normalisation: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] lambdaBody = Prelude.Basics.List Prelude.Types.Nat; From 3657556f689a3ffce542d5742a235ba5733d8b78 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 14 Jan 2026 16:05:10 +0300 Subject: [PATCH 27/81] [ cleanup ] Fix editorconfig lint --- src/Deriving/DepTyCheck/Util/Specialisation.idr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 19957ff59..d07431ad1 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -165,7 +165,8 @@ processArg sig ty argIdx ga with (ga.given) let (appLhs, appTerms) = unAppAny x case getGivens' x of Just (travTy, givens) => do - logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] "Given a type invocation, traversing arguments: \{show $ map (fromMaybe "" . name . arg) givens}" + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] + "Given a type invocation, traversing arguments: \{show $ map (fromMaybe "" . name . arg) givens}" map (mapFst $ reAppAny appLhs) $ processArgs' sig travTy argIdx $ takeWhile (.isGiven) givens _ => if (snd (unPi ga.arg.type) == `(Type)) From d0baca732449465fb1e9589ae57ee3ca5069167f Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 14 Jan 2026 16:57:55 +0300 Subject: [PATCH 28/81] [ fix ] Remove some of the memory-explosion effects of logging --- .../DepTyCheck/Util/Specialisation.idr | 36 +++++++++---------- .../spec-if-needed-001/expected | 4 +-- .../spec-if-needed-002/expected | 4 +-- .../spec-if-needed-003/expected | 4 +-- .../spec-if-needed-004/expected | 24 ++++++------- .../spec-if-needed-005/expected | 4 +-- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index d07431ad1..5cb6b9a0b 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -121,13 +121,13 @@ unGA (x :: xs) = let (ys, zs) = unGA xs in (x.arg :: ys, x.given :: zs) ||| Extracts given values of arguments from a type invocation expression export -getGivens' : NamesInfoInTypes => TTImp -> Maybe (TypeInfo, List GenArg) +getGivens' : NamesInfoInTypes => TTImp -> Maybe (List GenArg) getGivens' t = do let (IVar _ tyName, aTerms) = unAppAny t | _ => Nothing let Just tyInfo = lookupType tyName | _ => Nothing - Just $ (tyInfo, map (uncurry MkGenArg) $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps aTerms)) + Just $ map (uncurry MkGenArg) $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps aTerms) ||| Assemble a list of arguments and their given values from `callGen` inputs mkArgs : @@ -148,33 +148,33 @@ singleArg n (MkGenArg a v) = do let n : Name = fromString "lam^\{show n}" (IVar EmptyFC n, [MkGenArg (MkArg a.count a.piInfo (Just n) $ allQuestions a.type) v]) -processArg : MonadLog m => NamesInfoInTypes => GenSignature -> TypeInfo -> Nat -> GenArg -> m (TTImp, List GenArg) +processArg : MonadLog m => NamesInfoInTypes => GenSignature -> Nat -> GenArg -> m (TTImp, List GenArg) -processArgs' : MonadLog m => NamesInfoInTypes => GenSignature -> TypeInfo -> Nat -> List GenArg -> m (List AnyApp, List GenArg) -processArgs' sig ty k [] = pure ([], []) -processArgs' sig ty k (x :: xs) = do - (aT, l) <- assert_total $ processArg sig ty k x - (recAA, l') <- processArgs' sig ty (k + length l) xs +processArgs' : MonadLog m => NamesInfoInTypes => GenSignature -> Nat -> List GenArg -> m (List AnyApp, List GenArg) +processArgs' sig k [] = pure ([], []) +processArgs' sig k (x :: xs) = do + (aT, l) <- assert_total $ processArg sig k x + (recAA, l') <- processArgs' sig (k + length l) xs pure (appArg x.arg aT :: recAA, l ++ l') -processArg sig ty argIdx ga with (ga.given) - processArg sig ty argIdx ga | Nothing = do - logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] "No given value, passing through" +processArg sig argIdx ga with (ga.given) + processArg sig argIdx ga | Nothing = do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "No given value, passing through" pure $ singleArg argIdx ga - processArg sig ty argIdx ga | Just x = do + processArg sig argIdx ga | Just x = do let (appLhs, appTerms) = unAppAny x case getGivens' x of - Just (travTy, givens) => do - logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] + Just givens => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a type invocation, traversing arguments: \{show $ map (fromMaybe "" . name . arg) givens}" - map (mapFst $ reAppAny appLhs) $ processArgs' sig travTy argIdx $ takeWhile (.isGiven) givens + map (mapFst $ reAppAny appLhs) $ processArgs' sig argIdx $ takeWhile (.isGiven) givens _ => if (snd (unPi ga.arg.type) == `(Type)) then do - logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] "Given a type invocation w/o arguments, specialising" + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a type invocation w/o arguments, specialising" pure (x, []) else do - logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ty, ga] "Given a non-type expr, passing through" + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a non-type expr, passing through" pure $ singleArg argIdx ga processArgs : @@ -183,7 +183,7 @@ processArgs : (sig : GenSignature) -> List GenArg -> m (TTImp, List Arg, List $ Maybe TTImp) -processArgs sig ga = map (bimap (reAppAny $ IVar EmptyFC sig.targetType.name) unGA) $ processArgs' sig sig.targetType 0 ga +processArgs sig ga = map (bimap (reAppAny $ IVar EmptyFC sig.targetType.name) unGA) $ processArgs' sig 0 ga export formGivenVals : Vect l _ -> List TTImp -> Vect l TTImp diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected index 6d2649d12..1127776ac 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -2,8 +2,8 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Data.Vect.Vect _ Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Checking specialisation need for [Prelude.Types.Nat]... -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Data.Vect.Vect len No given value, passing through -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Data.Vect.Vect (elem := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] len No given value, passing through +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] (elem := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Task before normalisation: \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] NormaliseTask returned: lambdaTy = (lam^0 : Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] lambdaBody = \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat; diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index 6644b84d9..65603031f 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -2,8 +2,8 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Prelude.Types.S LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Checking specialisation need for [Prelude.Types.Nat, Prelude.Types.S]... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Test.X (t := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Test.X ({arg:1} := Prelude.Types.S) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] (t := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] ({arg:1} := Prelude.Types.S) Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: \ lam^0 => Test.X Prelude.Types.Nat lam^0 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:2} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected index 75d661f95..444f3e516 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected @@ -2,8 +2,8 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Data.Fin.Fin LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Checking specialisation need for [Prelude.Types.Nat, Data.Fin.Fin]... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Test.X (t := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Test.X ({arg:1} := Data.Fin.Fin) Given a type invocation, traversing arguments: [n] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] (t := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] ({arg:1} := Data.Fin.Fin) Given a type invocation, traversing arguments: [n] LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: Test.X Prelude.Types.Nat Data.Fin.Fin LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = Test.X Prelude.Types.Nat Data.Fin.Fin; diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index aad1a03dd..58a88589d 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -2,12 +2,12 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn (Test.X Test.Nt (fromInteger 5) Test.Nn) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn, Test.X Test.Nt (fromInteger 5) Test.Nn]... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y (a := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y ({arg:1} := Test.Nn) Given a non-type expr, passing through -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y ({arg:2} := Test.X Test.Nt (fromInteger 5) Test.Nn) Given a type invocation, traversing arguments: [f, n, {arg:3}] -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X (f := Test.Nt) Given a type invocation w/o arguments, specialising -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X (n := fromInteger 5) Given a non-type expr, passing through -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X ({arg:3} := Test.Nn) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:1} := Test.Nn) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:2} := Test.X Test.Nt (fromInteger 5) Test.Nn) Given a type invocation, traversing arguments: [f, n, {arg:3}] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (f := Test.Nt) Given a type invocation w/o arguments, specialising +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (n := fromInteger 5) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:3} := Test.Nn) Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Test.Nt lam^1 lam^2) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:5} : Test.Nt lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Test.Nt lam^1 lam^2); @@ -18,12 +18,12 @@ LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised t LOG deptycheck.test.utils.specialise:0: Y^9242445846110651992.Y^9242445846110651992[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn', Test.X Data.Fin.Fin (fromInteger 5) Test.Nn']... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y (a := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y ({arg:1} := Test.Nn') Given a non-type expr, passing through -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.Y ({arg:2} := Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') Given a type invocation, traversing arguments: [f, n, {arg:3}] -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X (f := Data.Fin.Fin) Given a type invocation, traversing arguments: [n] -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X (n := fromInteger 5) Given a non-type expr, passing through -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Test.X ({arg:3} := Test.Nn') Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:1} := Test.Nn') Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:2} := Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') Given a type invocation, traversing arguments: [f, n, {arg:3}] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (f := Data.Fin.Fin) Given a type invocation, traversing arguments: [n] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (n := fromInteger 5) Given a non-type expr, passing through +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:3} := Test.Nn') Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:5} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected index 72a44e3da..b721fa702 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected @@ -2,7 +2,7 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [Prelude.Types.Nat]... -LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Prelude.Basics.List ({arg:1} := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] ({arg:1} := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Task before normalisation: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] lambdaBody = Prelude.Basics.List Prelude.Types.Nat; @@ -14,7 +14,7 @@ LOG 0: List^4779069909474151191.List^4779069909474151191 LOG 0: [Prelude.Types.Nat, Prelude.Basics.List, List^4779069909474151191.List^4779069909474151191] LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [Prelude.Types.Nat]... -LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Prelude.Basics.List ({arg:1} := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] ({arg:1} := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Task before normalisation: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] lambdaBody = Prelude.Basics.List Prelude.Types.Nat; From cbe95921567864c94c33699d50161fd20fe45f69 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 15 Jan 2026 14:10:57 +0300 Subject: [PATCH 29/81] [ new ] Add trivial test on detecting type arg passthroughs --- .../spec-if-needed-006/Shared.idr | 1 + .../spec-if-needed-006/Test.idr | 14 ++++++++++++++ .../spec-if-needed-006/expected | 4 ++++ .../specialise-if-needed/spec-if-needed-006/run | 1 + .../spec-if-needed-006/test.ipkg | 1 + 5 files changed, 21 insertions(+) create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-006/Shared.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-006/Test.idr create mode 100644 tests/derivation/utils/specialise-if-needed/spec-if-needed-006/expected create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-006/run create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-006/test.ipkg diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/Shared.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/Shared.idr new file mode 120000 index 000000000..6401061db --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/Shared.idr @@ -0,0 +1 @@ +../_common/Shared.idr \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/Test.idr new file mode 100644 index 000000000..daccb1be4 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/Test.idr @@ -0,0 +1,14 @@ +module Test + +import Data.Fin +import Shared + +%language ElabReflection + +%logging "deptycheck.util.specialisation" 20 + + +%runElab do + (Nothing, _) <- runSIN'' Nothing False `(List a) + | _ => fail "List[0(a)] should not lead to specialisation!" + pure () diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/expected new file mode 100644 index 000000000..7b5f132df --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/expected @@ -0,0 +1,4 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) +LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List a +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [a]... diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/run b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/test.ipkg b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/test.ipkg new file mode 120000 index 000000000..7297aae9f --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/test.ipkg @@ -0,0 +1 @@ +../_common/test.ipkg \ No newline at end of file From 728caef5482c0a8c7c12faba38a541ae6c65f618 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 15 Jan 2026 15:16:29 +0300 Subject: [PATCH 30/81] [ new ] Implement specialised constructor name erasure --- .../src/Deriving/SpecialiseData.idr | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 0af88cd9f..f1ad7cb55 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -109,6 +109,18 @@ UniResults = List UnificationVerdict --- HELPER FUNCTIONS --- ------------------------ +public export +record SpecialisationParams where + constructor MkSpecParams + eraseConNames : Bool + +public export +%defaulthint +SpecialisationDefaults : SpecialisationParams +SpecialisationDefaults = MkSpecParams + { eraseConNames = False + } + public export interface NamespaceProvider (0 m : Type -> Type) where constructor MkNSProvider @@ -420,16 +432,17 @@ parameters (t : SpecTask) (f : UnificationResult -> (pCon : Con) -> (0 _ : ConArgsNamed pCon) => + Nat -> r) -> UniResults -> List r mapUCons f rs = do let adp = pushIn t.polyTy.cons t.polyTyNamed.tyConArgsNamed - let f' : List (Subset Con ConArgsNamed) -> UniResults -> List r - f' (Element con _ :: xs) (Success res :: ys) = f res con :: f' xs ys - f' (_ :: xs) (_ :: ys) = f' xs ys - f' _ _ = [] - f' adp rs + let f' : List (Subset Con ConArgsNamed) -> UniResults -> Nat -> List r + f' (Element con _ :: xs) (Success res :: ys) n = f res con n :: f' xs ys (S n) + f' (_ :: xs) (_ :: ys) n = f' xs ys n + f' _ _ _ = [] + f' adp rs 0 ||| Run monadic operation on all pairs of specified and polymorphic constructors map2UConsN : @@ -503,28 +516,31 @@ parameters (t : SpecTask) ||| Generate a specialised constructor mkSpecCon : + (params : SpecialisationParams) => (newArgs : _) -> (0 _ : All IsNamedArg newArgs) => UnificationResult -> (con : Con) -> (0 _ : ConArgsNamed con) => + Nat -> Subset Con ConArgsNamed - mkSpecCon newArgs ur pCon = do + mkSpecCon newArgs ur pCon cIdx = do let Element args allArgs = pullOut $ mkSpecArg ur <$> ur.order let typeArgs = newArgs.appsWith var ur.fullResult let tyRet = reAppAny (var t.resultName) typeArgs + let n = if params.eraseConNames then fromString "Con^\{show cIdx}" else dropNS pCon.name MkCon - { name = inGenNS t $ dropNS pCon.name + { name = inGenNS t $ n , args , type = tyRet } `Element` TheyAreNamed allArgs ||| Generate a specialised type - mkSpecTy : UniResults -> Subset TypeInfo AllTyArgsNamed + mkSpecTy : SpecialisationParams => UniResults -> Subset TypeInfo AllTyArgsNamed mkSpecTy ur = do let Element cons consAreNamed = - pullOut $ mapUCons (mkSpecCon t.ttArgs @{t.ttArgsNamed}) ur + pullOut $ mapUCons (mkSpecCon @{%search} t.ttArgs @{t.ttArgsNamed}) ur MkTypeInfo { name = inGenNS t t.resultName , args = t.ttArgs @@ -1081,6 +1097,7 @@ specialiseDataRaw : MonadLog m => MonadError SpecialisationError m => (namesInfo : NamesInfoInTypes) => + SpecialisationParams => (resultName : Name) -> (resultKind : TTImp) -> (resultContent : TTImp) -> @@ -1111,6 +1128,7 @@ specialiseDataArgs : MonadLog m => MonadError SpecialisationError m => (namesInfo : NamesInfoInTypes) => + SpecialisationParams => (resultName : Name) -> (lambdaArgs : List Arg) -> (lambdaRHS : TTImp) -> @@ -1138,6 +1156,7 @@ specialiseDataLam : (unifier : CanUnify m) => MonadError SpecialisationError m => (namesInfo : NamesInfoInTypes) => + SpecialisationParams => (resultName : Name) -> (0 task : taskT) -> m (TypeInfo, List Decl) @@ -1166,6 +1185,7 @@ specialiseDataLam'' : Elaboration m => (nsProvider : NamespaceProvider m) => (unifier : CanUnify m) => + SpecialisationParams => TaskLambda taskT => Name -> (0 task: taskT) -> @@ -1196,6 +1216,7 @@ specialiseDataLam' : Elaboration m => (nsProvider : NamespaceProvider m) => (unifier : CanUnify m) => + SpecialisationParams => TaskLambda taskT => Name -> (0 task: taskT) -> From b1908ab405b44d1243fdc4215271ab395b66a728 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 15 Jan 2026 16:10:53 +0300 Subject: [PATCH 31/81] [ fix ] Prefix name-erased constructors with typename --- elab-util-extra/src/Deriving/SpecialiseData.idr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index f1ad7cb55..7cf07cc74 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -529,7 +529,7 @@ parameters (t : SpecTask) pullOut $ mkSpecArg ur <$> ur.order let typeArgs = newArgs.appsWith var ur.fullResult let tyRet = reAppAny (var t.resultName) typeArgs - let n = if params.eraseConNames then fromString "Con^\{show cIdx}" else dropNS pCon.name + let n = if params.eraseConNames then fromString "\{t.resultName}^Con^\{show cIdx}" else dropNS pCon.name MkCon { name = inGenNS t $ n , args From 60292bfe76f82b930af2eae1e94675eebd559435 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Sun, 18 Jan 2026 16:42:31 +0300 Subject: [PATCH 32/81] [ new ] Add test for deriving spec list generators --- tests/derivation/core/spec 001/DerivedGen.idr | 20 +++++++++++++++++++ .../core/spec 001/RunDerivedGen.idr | 1 + tests/derivation/core/spec 001/derive.ipkg | 1 + tests/derivation/core/spec 001/expected | 0 tests/derivation/core/spec 001/run | 1 + 5 files changed, 23 insertions(+) create mode 100644 tests/derivation/core/spec 001/DerivedGen.idr create mode 120000 tests/derivation/core/spec 001/RunDerivedGen.idr create mode 120000 tests/derivation/core/spec 001/derive.ipkg create mode 100644 tests/derivation/core/spec 001/expected create mode 120000 tests/derivation/core/spec 001/run diff --git a/tests/derivation/core/spec 001/DerivedGen.idr b/tests/derivation/core/spec 001/DerivedGen.idr new file mode 100644 index 000000000..fa60588cb --- /dev/null +++ b/tests/derivation/core/spec 001/DerivedGen.idr @@ -0,0 +1,20 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +%language ElabReflection + +data X = MkX (List Nat) + +%hint +XShow : Show X +XShow = %runElab derive + +export +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty X +checkedGen = deriveGen + +main : IO () +main = runGs [ G $ \fl => checkedGen fl @{smallNats} ] diff --git a/tests/derivation/core/spec 001/RunDerivedGen.idr b/tests/derivation/core/spec 001/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/spec 001/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/spec 001/derive.ipkg b/tests/derivation/core/spec 001/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/spec 001/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/spec 001/expected b/tests/derivation/core/spec 001/expected new file mode 100644 index 000000000..e69de29bb diff --git a/tests/derivation/core/spec 001/run b/tests/derivation/core/spec 001/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/spec 001/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 0cf3a7320ad5d880befc29d3210ddc4b39760e95 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Sun, 18 Jan 2026 16:47:06 +0300 Subject: [PATCH 33/81] [ new ] Add test for spec vects --- tests/derivation/core/spec 002/DerivedGen.idr | 20 +++++++++++++++ .../core/spec 002/RunDerivedGen.idr | 1 + tests/derivation/core/spec 002/derive.ipkg | 1 + tests/derivation/core/spec 002/expected | 25 +++++++++++++++++++ tests/derivation/core/spec 002/run | 1 + 5 files changed, 48 insertions(+) create mode 100644 tests/derivation/core/spec 002/DerivedGen.idr create mode 120000 tests/derivation/core/spec 002/RunDerivedGen.idr create mode 120000 tests/derivation/core/spec 002/derive.ipkg create mode 100644 tests/derivation/core/spec 002/expected create mode 120000 tests/derivation/core/spec 002/run diff --git a/tests/derivation/core/spec 002/DerivedGen.idr b/tests/derivation/core/spec 002/DerivedGen.idr new file mode 100644 index 000000000..0867e5cc6 --- /dev/null +++ b/tests/derivation/core/spec 002/DerivedGen.idr @@ -0,0 +1,20 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +%language ElabReflection + +data X = MkX (Vect 3 Nat) + +%hint +XShow : Show X +XShow = %runElab derive + +export +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty X +checkedGen = deriveGen + +main : IO () +main = runGs [ G $ \fl => checkedGen fl @{smallNats} ] diff --git a/tests/derivation/core/spec 002/RunDerivedGen.idr b/tests/derivation/core/spec 002/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/spec 002/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/spec 002/derive.ipkg b/tests/derivation/core/spec 002/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/spec 002/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/spec 002/expected b/tests/derivation/core/spec 002/expected new file mode 100644 index 000000000..b24ecf6f4 --- /dev/null +++ b/tests/derivation/core/spec 002/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 Prelude.Types.Nat +Generated values: +----- +----- +MkX [10, 10, 0] +----- +MkX [0, 10, 10] +----- +MkX [10, 10, 10] +----- +MkX [10, 10, 0] +----- +MkX [10, 0, 10] +----- +MkX [10, 0, 10] +----- +MkX [0, 10, 0] +----- +MkX [10, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] diff --git a/tests/derivation/core/spec 002/run b/tests/derivation/core/spec 002/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/spec 002/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 9d313b2f0b1f3c3268dc213b7cdb8622bc77759c Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Sun, 18 Jan 2026 16:54:43 +0300 Subject: [PATCH 34/81] [ new ] Add test for Vect n (Fin n) derivation --- tests/derivation/core/spec 003/DerivedGen.idr | 27 +++++++++++++++++++ .../core/spec 003/RunDerivedGen.idr | 1 + tests/derivation/core/spec 003/derive.ipkg | 1 + tests/derivation/core/spec 003/expected | 25 +++++++++++++++++ tests/derivation/core/spec 003/run | 1 + 5 files changed, 55 insertions(+) create mode 100644 tests/derivation/core/spec 003/DerivedGen.idr create mode 120000 tests/derivation/core/spec 003/RunDerivedGen.idr create mode 120000 tests/derivation/core/spec 003/derive.ipkg create mode 100644 tests/derivation/core/spec 003/expected create mode 120000 tests/derivation/core/spec 003/run diff --git a/tests/derivation/core/spec 003/DerivedGen.idr b/tests/derivation/core/spec 003/DerivedGen.idr new file mode 100644 index 000000000..9d84f963e --- /dev/null +++ b/tests/derivation/core/spec 003/DerivedGen.idr @@ -0,0 +1,27 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +%language ElabReflection + +data Y : Nat -> Type where + MkY : Vect n (Fin n) -> Y n + +data X = MkX (Y 3) + +%hint +YShow : Show (Y n) +YShow = %runElab derive + +%hint +XShow : Show X +XShow = %runElab derive + +export +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty X +checkedGen = deriveGen + +main : IO () +main = runGs [ G $ \fl => checkedGen fl @{smallNats} ] diff --git a/tests/derivation/core/spec 003/RunDerivedGen.idr b/tests/derivation/core/spec 003/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/core/spec 003/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/spec 003/derive.ipkg b/tests/derivation/core/spec 003/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/core/spec 003/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/spec 003/expected b/tests/derivation/core/spec 003/expected new file mode 100644 index 000000000..26420592c --- /dev/null +++ b/tests/derivation/core/spec 003/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +MkX (MkY [0, 2, 0]) +----- +MkX (MkY [2, 2, 0]) +----- +MkX (MkY [2, 2, 1]) +----- +MkX (MkY [1, 2, 2]) +----- +MkX (MkY [2, 1, 2]) +----- +MkX (MkY [2, 2, 1]) +----- +MkX (MkY [2, 0, 1]) +----- +MkX (MkY [2, 2, 2]) +----- +MkX (MkY [2, 2, 1]) +----- +MkX (MkY [2, 2, 2]) diff --git a/tests/derivation/core/spec 003/run b/tests/derivation/core/spec 003/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/core/spec 003/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 7ea059b9e5bdb9147657a6dbbb61716f3f645ef1 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 27 Oct 2025 16:57:13 +0300 Subject: [PATCH 35/81] [ test ] Add tests with a need for specialisation --- .run-to-print-tests | 76 +++++++++++++++++++ tests/Tests.idr | 2 +- .../specialise/00-1 simple/DerivedGen.idr | 11 +++ .../print/specialise/00-1 simple/derive.ipkg | 1 + .../print/specialise/00-1 simple/run | 1 + .../specialise/00-2 simple/DerivedGen.idr | 11 +++ .../print/specialise/00-2 simple/derive.ipkg | 1 + .../print/specialise/00-2 simple/run | 1 + .../00-3 two-same shallow/DerivedGen.idr | 11 +++ .../00-3 two-same shallow/derive.ipkg | 1 + .../specialise/00-3 two-same shallow/run | 1 + .../00-3 two-similar/DerivedGen.idr | 11 +++ .../specialise/00-3 two-similar/derive.ipkg | 1 + .../print/specialise/00-3 two-similar/run | 1 + .../00-4 two-same deep/DerivedGen.idr | 13 ++++ .../specialise/00-4 two-same deep/derive.ipkg | 1 + .../print/specialise/00-4 two-same deep/run | 1 + .../01-1 non-ty imm givn/DerivedGen.idr | 13 ++++ .../01-1 non-ty imm givn/derive.ipkg | 1 + .../print/specialise/01-1 non-ty imm givn/run | 1 + .../01-2 non-ty imm gend/DerivedGen.idr | 13 ++++ .../01-2 non-ty imm gend/derive.ipkg | 1 + .../print/specialise/01-2 non-ty imm gend/run | 1 + .../01-3 non-ty imm exist/DerivedGen.idr | 12 +++ .../01-3 non-ty imm exist/derive.ipkg | 1 + .../specialise/01-3 non-ty imm exist/run | 1 + .../02-0 non-ty deep exist/DerivedGen.idr | 11 +++ .../02-0 non-ty deep exist/derive.ipkg | 1 + .../specialise/02-0 non-ty deep exist/run | 1 + .../02-1 non-ty deep gend/DerivedGen.idr | 13 ++++ .../02-1 non-ty deep gend/derive.ipkg | 1 + .../specialise/02-1 non-ty deep gend/run | 1 + .../02-2 non-ty deep givn/DerivedGen.idr | 13 ++++ .../02-2 non-ty deep givn/derive.ipkg | 1 + .../specialise/02-2 non-ty deep givn/run | 1 + .../02-3 two-similar/DerivedGen.idr | 11 +++ .../specialise/02-3 two-similar/derive.ipkg | 1 + .../print/specialise/02-3 two-similar/run | 1 + .../DerivedGen.idr | 12 +++ .../derive.ipkg | 1 + .../03-0 non-ty imm-deep-same exist/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../03-1 non-ty imm-deep-same gend/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../03-2 non-ty imm-deep-same givn/run | 1 + .../DerivedGen.idr | 12 +++ .../derive.ipkg | 1 + .../04-0 non-ty imm-deep-diff exist-both/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../04-1 non-ty imm-deep-diff exist-givn/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../04-2 non-ty imm-deep-diff exist-givn/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../04-3 non-ty imm-deep-diff exist-gend/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../04-4 non-ty imm-deep-diff exist-gend/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../04-5 non-ty imm-deep-diff gend-both/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../04-6 non-ty imm-deep-diff givn-both/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../04-7 non-ty imm-deep-diff givn-gend/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../04-8 non-ty imm-deep-diff givn-gend/run | 1 + .../DerivedGen.idr | 13 ++++ .../derive.ipkg | 1 + .../05-0 non-ty complex exist-both/run | 1 + .../least-effort/print/specialise/_common | 1 + .../run/specialise/00-1 simple/DerivedGen.idr | 16 ++++ .../specialise/00-1 simple/RunDerivedGen.idr | 1 + .../run/specialise/00-1 simple/derive.ipkg | 1 + .../run/specialise/00-1 simple/run | 1 + .../run/specialise/00-2 simple/DerivedGen.idr | 16 ++++ .../specialise/00-2 simple/RunDerivedGen.idr | 1 + .../run/specialise/00-2 simple/derive.ipkg | 1 + .../run/specialise/00-2 simple/run | 1 + .../00-3 two-same shallow/DerivedGen.idr | 16 ++++ .../00-3 two-same shallow/RunDerivedGen.idr | 1 + .../00-3 two-same shallow/derive.ipkg | 1 + .../run/specialise/00-3 two-same shallow/run | 1 + .../00-4 two-same deep/DerivedGen.idr | 21 +++++ .../00-4 two-same deep/RunDerivedGen.idr | 1 + .../specialise/00-4 two-same deep/derive.ipkg | 1 + .../run/specialise/00-4 two-same deep/run | 1 + .../00-5 two-similar/DerivedGen.idr | 16 ++++ .../00-5 two-similar/RunDerivedGen.idr | 1 + .../specialise/00-5 two-similar/derive.ipkg | 1 + .../run/specialise/00-5 two-similar/run | 1 + .../01-1 non-ty imm givn/DerivedGen.idr | 22 ++++++ .../01-1 non-ty imm givn/RunDerivedGen.idr | 1 + .../01-1 non-ty imm givn/derive.ipkg | 1 + .../run/specialise/01-1 non-ty imm givn/run | 1 + .../01-2 non-ty imm gend/DerivedGen.idr | 18 +++++ .../01-2 non-ty imm gend/RunDerivedGen.idr | 1 + .../01-2 non-ty imm gend/derive.ipkg | 1 + .../run/specialise/01-2 non-ty imm gend/run | 1 + .../01-3 non-ty imm exist/DerivedGen.idr | 17 +++++ .../01-3 non-ty imm exist/RunDerivedGen.idr | 1 + .../01-3 non-ty imm exist/derive.ipkg | 1 + .../run/specialise/01-3 non-ty imm exist/run | 1 + .../02-0 non-ty deep exist/DerivedGen.idr | 16 ++++ .../02-0 non-ty deep exist/RunDerivedGen.idr | 1 + .../02-0 non-ty deep exist/derive.ipkg | 1 + .../run/specialise/02-0 non-ty deep exist/run | 1 + .../02-1 non-ty deep gend/DerivedGen.idr | 18 +++++ .../02-1 non-ty deep gend/RunDerivedGen.idr | 1 + .../02-1 non-ty deep gend/derive.ipkg | 1 + .../run/specialise/02-1 non-ty deep gend/run | 1 + .../02-2 non-ty deep givn/DerivedGen.idr | 22 ++++++ .../02-2 non-ty deep givn/RunDerivedGen.idr | 1 + .../02-2 non-ty deep givn/derive.ipkg | 1 + .../run/specialise/02-2 non-ty deep givn/run | 1 + .../02-3 two-similar/DerivedGen.idr | 16 ++++ .../02-3 two-similar/RunDerivedGen.idr | 1 + .../specialise/02-3 two-similar/derive.ipkg | 1 + .../run/specialise/02-3 two-similar/run | 1 + .../DerivedGen.idr | 17 +++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../03-0 non-ty imm-deep-same exist/run | 1 + .../DerivedGen.idr | 18 +++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../03-1 non-ty imm-deep-same gend/run | 1 + .../DerivedGen.idr | 22 ++++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../03-2 non-ty imm-deep-same givn/run | 1 + .../DerivedGen.idr | 17 +++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-0 non-ty imm-deep-diff exist-both/run | 1 + .../DerivedGen.idr | 22 ++++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-1 non-ty imm-deep-diff exist-givn/run | 1 + .../DerivedGen.idr | 22 ++++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-2 non-ty imm-deep-diff exist-givn/run | 1 + .../DerivedGen.idr | 18 +++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-3 non-ty imm-deep-diff exist-gend/run | 1 + .../DerivedGen.idr | 18 +++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-4 non-ty imm-deep-diff exist-gend/run | 1 + .../DerivedGen.idr | 18 +++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-5 non-ty imm-deep-diff gend-both/run | 1 + .../DerivedGen.idr | 26 +++++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-6 non-ty imm-deep-diff givn-both/run | 1 + .../DerivedGen.idr | 22 ++++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-7 non-ty imm-deep-diff givn-gend/run | 1 + .../DerivedGen.idr | 22 ++++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../04-8 non-ty imm-deep-diff givn-gend/run | 1 + .../DerivedGen.idr | 18 +++++ .../RunDerivedGen.idr | 1 + .../derive.ipkg | 1 + .../05-0 non-ty complex exist-both/run | 1 + .../least-effort/run/specialise/_common | 1 + 179 files changed, 988 insertions(+), 1 deletion(-) create mode 100755 .run-to-print-tests create mode 100644 tests/derivation/least-effort/print/specialise/00-1 simple/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/00-1 simple/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/00-1 simple/run create mode 100644 tests/derivation/least-effort/print/specialise/00-2 simple/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/00-2 simple/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/00-2 simple/run create mode 100644 tests/derivation/least-effort/print/specialise/00-3 two-same shallow/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/00-3 two-same shallow/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/00-3 two-same shallow/run create mode 100644 tests/derivation/least-effort/print/specialise/00-3 two-similar/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/00-3 two-similar/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/00-3 two-similar/run create mode 100644 tests/derivation/least-effort/print/specialise/00-4 two-same deep/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/00-4 two-same deep/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/00-4 two-same deep/run create mode 100644 tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/run create mode 100644 tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/run create mode 100644 tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/run create mode 100644 tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/run create mode 100644 tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/run create mode 100644 tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/run create mode 100644 tests/derivation/least-effort/print/specialise/02-3 two-similar/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/02-3 two-similar/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/02-3 two-similar/run create mode 100644 tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/run create mode 100644 tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/run create mode 100644 tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/run create mode 100644 tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/run create mode 100644 tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/run create mode 100644 tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/run create mode 100644 tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/run create mode 100644 tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/run create mode 100644 tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/run create mode 100644 tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/run create mode 100644 tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/run create mode 100644 tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/run create mode 100644 tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/run create mode 120000 tests/derivation/least-effort/print/specialise/_common create mode 100644 tests/derivation/least-effort/run/specialise/00-1 simple/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-1 simple/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-1 simple/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/00-1 simple/run create mode 100644 tests/derivation/least-effort/run/specialise/00-2 simple/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-2 simple/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-2 simple/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/00-2 simple/run create mode 100644 tests/derivation/least-effort/run/specialise/00-3 two-same shallow/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-3 two-same shallow/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-3 two-same shallow/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/00-3 two-same shallow/run create mode 100644 tests/derivation/least-effort/run/specialise/00-4 two-same deep/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-4 two-same deep/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-4 two-same deep/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/00-4 two-same deep/run create mode 100644 tests/derivation/least-effort/run/specialise/00-5 two-similar/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-5 two-similar/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/00-5 two-similar/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/00-5 two-similar/run create mode 100644 tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/run create mode 100644 tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/run create mode 100644 tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/run create mode 100644 tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/run create mode 100644 tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/run create mode 100644 tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/run create mode 100644 tests/derivation/least-effort/run/specialise/02-3 two-similar/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/02-3 two-similar/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/02-3 two-similar/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/02-3 two-similar/run create mode 100644 tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/run create mode 100644 tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/run create mode 100644 tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/run create mode 100644 tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/run create mode 100644 tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/run create mode 100644 tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/run create mode 100644 tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/run create mode 100644 tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/run create mode 100644 tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/run create mode 100644 tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/run create mode 100644 tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/run create mode 100644 tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/run create mode 100644 tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/run create mode 120000 tests/derivation/least-effort/run/specialise/_common diff --git a/.run-to-print-tests b/.run-to-print-tests new file mode 100755 index 000000000..499961912 --- /dev/null +++ b/.run-to-print-tests @@ -0,0 +1,76 @@ +#!/bin/sh + +if [ "$1" = "--force" ]; then + FORCE_REWRITE=1 +else + FORCE_REWRITE=0 +fi +shift + +if [ -z "$1" ] || [ -z "$2" ] ; then + echo "Usage: $0 [--force] [ ...]" >&2 + exit 1 +fi + +PRINT_DIR="$1" +shift + +if [ -e "$PRINT_DIR" ]; then + if [ ! -d "$PRINT_DIR" ]; then + echo "Given target '$PRINT_DIR' is not a directory" >&2 + exit 2 + fi +else + echo "Creating a target dir '$PRINT_DIR'..." + mkdir -p "$PRINT_DIR" +fi + +for i in "$@"; do + CURR=$(basename "$i") + + if [ ! -e "$i"/run ]; then + echo "Ignoring '$CURR' since no 'run' file..." + continue + elif [ "$CURR" = "_common" ]; then + if [ ! -e "$PRINT_DIR/$CURR" ]; then + echo "Speial treatment for the '$CURR' dir..." + cp --no-dereference "$i" "$PRINT_DIR" + else + echo "Ignoring '$CURR' dir since it already exists in '$PRINT_DIR'" + fi + continue + fi + + printf "Processing '%s'... " "$CURR" + TARGET="$PRINT_DIR/$CURR" + + if [ -e "$TARGET" ]; then + printf "ALREADY EXISTS, " + if [ "$FORCE_REWRITE" = 1 ]; then + printf "REWRITING... " + else + echo "IGNORING" + continue + fi + fi + + printf "creating target dir... " + mkdir -p "$TARGET" + + printf "copying aux files... " + for j in "run" "derive.ipkg"; do + cp --no-dereference "$i/$j" "$TARGET" + done + + printf "generating main file... " + { + sed -E \ + -e 's/import RunDerivedGen/import Deriving.DepTyCheck.Gen/' \ + -e 's/(%default total)/\1\n\n%language ElabReflection/' \ + -e '/Show|checkedGen/,$d' \ + "$i/DerivedGen.idr" + sed -nE 's/checkedGen :/%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $/p' "$i/DerivedGen.idr" + } > "$TARGET/DerivedGen.idr" + + echo "done" +done diff --git a/tests/Tests.idr b/tests/Tests.idr index 4304f4764..782573465 100644 --- a/tests/Tests.idr +++ b/tests/Tests.idr @@ -16,7 +16,7 @@ main = goldenRunner $ , "Derivation: input validation" `atDir` "derivation/inputvalidation" , "Derivation: running harness" `atDir` "derivation/infra" , [ "Derivation: least effort (\{p}, \{w})" `atDir` "derivation/least-effort/\{p}/\{w}" - | p <- ["print", "run"], w <- ["adt", "gadt", "john-hughes", "order", "regression"] + | p <- ["print", "run"], w <- ["adt", "gadt", "john-hughes", "order", "regression", "specialise"] ] , "Derivation: core" `atDir` "derivation/core" , "Derivation: distribution" `atDir` "derivation/distribution" diff --git a/tests/derivation/least-effort/print/specialise/00-1 simple/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/00-1 simple/DerivedGen.idr new file mode 100644 index 000000000..4ae11f7e7 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-1 simple/DerivedGen.idr @@ -0,0 +1,11 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (List Nat) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/00-1 simple/derive.ipkg b/tests/derivation/least-effort/print/specialise/00-1 simple/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-1 simple/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-1 simple/run b/tests/derivation/least-effort/print/specialise/00-1 simple/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-1 simple/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-2 simple/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/00-2 simple/DerivedGen.idr new file mode 100644 index 000000000..5b8e9bfe5 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-2 simple/DerivedGen.idr @@ -0,0 +1,11 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (List String) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/00-2 simple/derive.ipkg b/tests/derivation/least-effort/print/specialise/00-2 simple/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-2 simple/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-2 simple/run b/tests/derivation/least-effort/print/specialise/00-2 simple/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-2 simple/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/DerivedGen.idr new file mode 100644 index 000000000..66d1053ed --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/DerivedGen.idr @@ -0,0 +1,11 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (List Nat) (List Nat) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/derive.ipkg b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/run b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-3 two-similar/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/00-3 two-similar/DerivedGen.idr new file mode 100644 index 000000000..fd4c03830 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-3 two-similar/DerivedGen.idr @@ -0,0 +1,11 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (List String) (List Nat) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/00-3 two-similar/derive.ipkg b/tests/derivation/least-effort/print/specialise/00-3 two-similar/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-3 two-similar/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-3 two-similar/run b/tests/derivation/least-effort/print/specialise/00-3 two-similar/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-3 two-similar/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-4 two-same deep/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/DerivedGen.idr new file mode 100644 index 000000000..48eb33847 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data Y = MkY (List Nat) + +data X = MkX (List Nat) Y + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/00-4 two-same deep/derive.ipkg b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/00-4 two-same deep/run b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/DerivedGen.idr new file mode 100644 index 000000000..c8dab8034 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : Vect n String -> X n + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : _) -> Gen MaybeEmpty $ X n diff --git a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/derive.ipkg b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/run b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/DerivedGen.idr new file mode 100644 index 000000000..0975955f0 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : Vect n String -> X n + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** X n) diff --git a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/derive.ipkg b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/run b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/DerivedGen.idr new file mode 100644 index 000000000..f8278bfd8 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/DerivedGen.idr @@ -0,0 +1,12 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (Vect n String) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/derive.ipkg b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/run b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/DerivedGen.idr new file mode 100644 index 000000000..acd2fff78 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/DerivedGen.idr @@ -0,0 +1,11 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (List $ Fin n) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/derive.ipkg b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/run b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/DerivedGen.idr new file mode 100644 index 000000000..d0d59ef6b --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Fin +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : List (Fin n) -> X n + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** X n) diff --git a/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/derive.ipkg b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/run b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/DerivedGen.idr new file mode 100644 index 000000000..b5bedb1a5 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Fin +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : List (Fin n) -> X n + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : _) -> Gen MaybeEmpty $ X n diff --git a/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/derive.ipkg b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/run b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/02-3 two-similar/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/02-3 two-similar/DerivedGen.idr new file mode 100644 index 000000000..c058ab8e7 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-3 two-similar/DerivedGen.idr @@ -0,0 +1,11 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (List String) (List $ Fin n) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/02-3 two-similar/derive.ipkg b/tests/derivation/least-effort/print/specialise/02-3 two-similar/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-3 two-similar/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/02-3 two-similar/run b/tests/derivation/least-effort/print/specialise/02-3 two-similar/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-3 two-similar/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/DerivedGen.idr new file mode 100644 index 000000000..019a56ff2 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/DerivedGen.idr @@ -0,0 +1,12 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (Vect n $ Fin n) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/derive.ipkg b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/run b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/DerivedGen.idr new file mode 100644 index 000000000..a13dffd4b --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : Vect n (Fin n) -> X n + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** X n) diff --git a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/derive.ipkg b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/run b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/DerivedGen.idr new file mode 100644 index 000000000..8f0a194a6 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : Vect n (Fin n) -> X n + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : _) -> Gen MaybeEmpty $ X n diff --git a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/derive.ipkg b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/run b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/DerivedGen.idr new file mode 100644 index 000000000..b3149077d --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/DerivedGen.idr @@ -0,0 +1,12 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X = MkX (Vect n $ Fin m) + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/run b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/DerivedGen.idr new file mode 100644 index 000000000..67a3ea1bf --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : Vect n (Fin m) -> X m + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (m : _) -> Gen MaybeEmpty $ X m diff --git a/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/run b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/DerivedGen.idr new file mode 100644 index 000000000..930ed914c --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : Vect n (Fin m) -> X n + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : _) -> Gen MaybeEmpty $ X n diff --git a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/run b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/DerivedGen.idr new file mode 100644 index 000000000..9ff70b1d9 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : Vect n (Fin m) -> X m + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (m ** X m) diff --git a/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/run b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/DerivedGen.idr new file mode 100644 index 000000000..4026f1af3 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Type where + MkX : Vect n (Fin m) -> X n + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** X n) diff --git a/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/run b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/DerivedGen.idr new file mode 100644 index 000000000..c0cea170f --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Nat -> Type where + MkX : Vect n (Fin m) -> X n m + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** m ** X n m) diff --git a/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/run b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/DerivedGen.idr new file mode 100644 index 000000000..03058760b --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Nat -> Type where + MkX : Vect n (Fin m) -> X n m + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n, m : _) -> Gen MaybeEmpty $ X n m diff --git a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/run b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/DerivedGen.idr new file mode 100644 index 000000000..c522c71f0 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Nat -> Type where + MkX : Vect n (Fin m) -> X n m + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : _) -> Gen MaybeEmpty (m ** X n m) diff --git a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/run b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/DerivedGen.idr new file mode 100644 index 000000000..5ebc3b123 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Nat -> Nat -> Type where + MkX : Vect n (Fin m) -> X n m + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (m : _) -> Gen MaybeEmpty (n ** X n m) diff --git a/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/derive.ipkg b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/run b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/DerivedGen.idr new file mode 100644 index 000000000..2b0caacab --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/DerivedGen.idr @@ -0,0 +1,13 @@ +module DerivedGen + +import Data.Vect +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data X : Type where + MkX : Vect n (Fin n) -> Either (n `LT` m) (m `LT` n) => X + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/derive.ipkg b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/run b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/_common b/tests/derivation/least-effort/print/specialise/_common new file mode 120000 index 000000000..3342f309f --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/_common @@ -0,0 +1 @@ +../../../_common \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-1 simple/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-1 simple/DerivedGen.idr new file mode 100644 index 000000000..b3738c072 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-1 simple/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data X = MkX (List Nat) + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/00-1 simple/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-1 simple/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-1 simple/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-1 simple/derive.ipkg b/tests/derivation/least-effort/run/specialise/00-1 simple/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-1 simple/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-1 simple/run b/tests/derivation/least-effort/run/specialise/00-1 simple/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-1 simple/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-2 simple/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-2 simple/DerivedGen.idr new file mode 100644 index 000000000..eff62e143 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-2 simple/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data X = MkX (List String) + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G $ \fl => checkedGen fl @{const $ elements ["a", "b", "c", "cc"]} ] diff --git a/tests/derivation/least-effort/run/specialise/00-2 simple/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-2 simple/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-2 simple/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-2 simple/derive.ipkg b/tests/derivation/least-effort/run/specialise/00-2 simple/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-2 simple/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-2 simple/run b/tests/derivation/least-effort/run/specialise/00-2 simple/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-2 simple/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/DerivedGen.idr new file mode 100644 index 000000000..c251bf3d9 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data X = MkX (List Nat) (List Nat) + +Show X where + showPrec d $ MkX xs ys = showCon d "MkX" $ showArg xs ++ showArg ys + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/derive.ipkg b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/run b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-4 two-same deep/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/DerivedGen.idr new file mode 100644 index 000000000..9e3266e3d --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/DerivedGen.idr @@ -0,0 +1,21 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data Y = MkY (List Nat) + +data X = MkX (List Nat) Y + +Show Y where + showPrec d $ MkY xs = showCon d "MkY" $ showArg xs + +Show X where + showPrec d $ MkX xs y = showCon d "MkX" $ showArg xs ++ showArg y + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/00-4 two-same deep/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-4 two-same deep/derive.ipkg b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-4 two-same deep/run b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-5 two-similar/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-5 two-similar/DerivedGen.idr new file mode 100644 index 000000000..615167537 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-5 two-similar/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data X = MkX (List String) (List Nat) + +Show X where + showPrec d $ MkX xs ys = showCon d "MkX" $ showArg xs ++ showArg ys + +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G $ \fl => checkedGen fl @{const $ elements ["a", "b", "c", "cc"]} ] diff --git a/tests/derivation/least-effort/run/specialise/00-5 two-similar/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/00-5 two-similar/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-5 two-similar/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-5 two-similar/derive.ipkg b/tests/derivation/least-effort/run/specialise/00-5 two-similar/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-5 two-similar/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/00-5 two-similar/run b/tests/derivation/least-effort/run/specialise/00-5 two-similar/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-5 two-similar/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/DerivedGen.idr new file mode 100644 index 000000000..7eec7a1d6 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/DerivedGen.idr @@ -0,0 +1,22 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : Vect n String -> X n + +Show (X n) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (n : _) -> Gen MaybeEmpty $ X n +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl 0 + , G $ \fl => checkedGen fl 1 + , G $ \fl => checkedGen fl 3 + ] diff --git a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/derive.ipkg b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/run b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/DerivedGen.idr new file mode 100644 index 000000000..3bf459c1a --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : Vect n String -> X n + +Show (X n) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty (n ** X n) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/derive.ipkg b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/run b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/DerivedGen.idr new file mode 100644 index 000000000..d0d3db9a2 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X = MkX (Vect n String) + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/derive.ipkg b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/run b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/DerivedGen.idr new file mode 100644 index 000000000..49b3f73f5 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data X = MkX (List $ Fin n) + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/derive.ipkg b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/run b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/DerivedGen.idr new file mode 100644 index 000000000..d19384dee --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Data.Fin +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : List (Fin n) -> X n + +Show (X n) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty (n ** X n) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/derive.ipkg b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/run b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/DerivedGen.idr new file mode 100644 index 000000000..684da47af --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/DerivedGen.idr @@ -0,0 +1,22 @@ +module DerivedGen + +import Data.Fin +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : List (Fin n) -> X n + +Show (X n) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (n : _) -> Gen MaybeEmpty $ X n +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl 0 + , G $ \fl => checkedGen fl 1 + , G $ \fl => checkedGen fl 3 + ] diff --git a/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/derive.ipkg b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/run b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-3 two-similar/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-3 two-similar/DerivedGen.idr new file mode 100644 index 000000000..3ba61636c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-3 two-similar/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data X = MkX (List String) (List $ Fin n) + +Show X where + showPrec d $ MkX xs ys = showCon d "MkX" $ showArg xs ++ showArg ys + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/02-3 two-similar/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-3 two-similar/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-3 two-similar/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-3 two-similar/derive.ipkg b/tests/derivation/least-effort/run/specialise/02-3 two-similar/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-3 two-similar/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/02-3 two-similar/run b/tests/derivation/least-effort/run/specialise/02-3 two-similar/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-3 two-similar/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/DerivedGen.idr new file mode 100644 index 000000000..782f15edb --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X = MkX (Vect n $ Fin n) + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/derive.ipkg b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/run b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/DerivedGen.idr new file mode 100644 index 000000000..ee7dec47d --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : Vect n (Fin n) -> X n + +Show (X n) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty (n ** X n) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/derive.ipkg b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/run b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/DerivedGen.idr new file mode 100644 index 000000000..9a9f83fe2 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/DerivedGen.idr @@ -0,0 +1,22 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : Vect n (Fin n) -> X n + +Show (X n) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (n : _) -> Gen MaybeEmpty $ X n +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl 0 + , G $ \fl => checkedGen fl 1 + , G $ \fl => checkedGen fl 3 + ] diff --git a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/derive.ipkg b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/run b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/DerivedGen.idr new file mode 100644 index 000000000..a62adafaa --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/DerivedGen.idr @@ -0,0 +1,17 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X = MkX (Vect n $ Fin m) + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/run b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/DerivedGen.idr new file mode 100644 index 000000000..3cf94ab15 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/DerivedGen.idr @@ -0,0 +1,22 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : Vect n (Fin m) -> X m + +Show (X m) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (m : _) -> Gen MaybeEmpty $ X m +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl 0 + , G $ \fl => checkedGen fl 1 + , G $ \fl => checkedGen fl 3 + ] diff --git a/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/run b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/DerivedGen.idr new file mode 100644 index 000000000..933c98627 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/DerivedGen.idr @@ -0,0 +1,22 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : Vect n (Fin m) -> X n + +Show (X n) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (n : _) -> Gen MaybeEmpty $ X n +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl 0 + , G $ \fl => checkedGen fl 1 + , G $ \fl => checkedGen fl 3 + ] diff --git a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/run b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/DerivedGen.idr new file mode 100644 index 000000000..4dc3ba664 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : Vect n (Fin m) -> X m + +Show (X m) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty (m ** X m) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/run b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/DerivedGen.idr new file mode 100644 index 000000000..3e5c39e4b --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Type where + MkX : Vect n (Fin m) -> X n + +Show (X n) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty (n ** X n) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/run b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/DerivedGen.idr new file mode 100644 index 000000000..942158aaa --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Nat -> Type where + MkX : Vect n (Fin m) -> X n m + +Show (X n m) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty (n ** m ** X n m) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/run b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/DerivedGen.idr new file mode 100644 index 000000000..4ee821e55 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/DerivedGen.idr @@ -0,0 +1,26 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Nat -> Type where + MkX : Vect n (Fin m) -> X n m + +Show (X n m) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (n, m : _) -> Gen MaybeEmpty $ X n m +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl 0 0 + , G $ \fl => checkedGen fl 0 3 + , G $ \fl => checkedGen fl 1 0 + , G $ \fl => checkedGen fl 1 1 + , G $ \fl => checkedGen fl 1 3 + , G $ \fl => checkedGen fl 3 1 + , G $ \fl => checkedGen fl 3 3 + ] diff --git a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/run b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/DerivedGen.idr new file mode 100644 index 000000000..b60b928a8 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/DerivedGen.idr @@ -0,0 +1,22 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Nat -> Type where + MkX : Vect n (Fin m) -> X n m + +Show (X n m) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (n : _) -> Gen MaybeEmpty (m ** X n m) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl 0 + , G $ \fl => checkedGen fl 1 + , G $ \fl => checkedGen fl 3 + ] diff --git a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/run b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/DerivedGen.idr new file mode 100644 index 000000000..b9ca75356 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/DerivedGen.idr @@ -0,0 +1,22 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Nat -> Nat -> Type where + MkX : Vect n (Fin m) -> X n m + +Show (X n m) where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> (m : _) -> Gen MaybeEmpty (n ** X n m) +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs + [ G $ \fl => checkedGen fl 0 + , G $ \fl => checkedGen fl 1 + , G $ \fl => checkedGen fl 3 + ] diff --git a/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/derive.ipkg b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/run b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/DerivedGen.idr new file mode 100644 index 000000000..9c8324851 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Data.Vect +import RunDerivedGen + +%default total + +data X : Type where + MkX : Vect n (Fin n) -> Either (n `LT` m) (m `LT` n) => X + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/derive.ipkg b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/run b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/_common b/tests/derivation/least-effort/run/specialise/_common new file mode 120000 index 000000000..3342f309f --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/_common @@ -0,0 +1 @@ +../../../_common \ No newline at end of file From 8b8233bfc646b0fa93d8e859ed25220ff1f633d3 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 19 Jan 2026 14:34:36 +0300 Subject: [PATCH 36/81] [ delete ] Remove redundant spec tests from core --- tests/derivation/core/spec 001/DerivedGen.idr | 20 -------------- .../core/spec 001/RunDerivedGen.idr | 1 - tests/derivation/core/spec 001/derive.ipkg | 1 - tests/derivation/core/spec 001/expected | 0 tests/derivation/core/spec 001/run | 1 - tests/derivation/core/spec 002/DerivedGen.idr | 20 -------------- .../core/spec 002/RunDerivedGen.idr | 1 - tests/derivation/core/spec 002/derive.ipkg | 1 - tests/derivation/core/spec 002/expected | 25 ----------------- tests/derivation/core/spec 002/run | 1 - tests/derivation/core/spec 003/DerivedGen.idr | 27 ------------------- .../core/spec 003/RunDerivedGen.idr | 1 - tests/derivation/core/spec 003/derive.ipkg | 1 - tests/derivation/core/spec 003/expected | 25 ----------------- tests/derivation/core/spec 003/run | 1 - 15 files changed, 126 deletions(-) delete mode 100644 tests/derivation/core/spec 001/DerivedGen.idr delete mode 120000 tests/derivation/core/spec 001/RunDerivedGen.idr delete mode 120000 tests/derivation/core/spec 001/derive.ipkg delete mode 100644 tests/derivation/core/spec 001/expected delete mode 120000 tests/derivation/core/spec 001/run delete mode 100644 tests/derivation/core/spec 002/DerivedGen.idr delete mode 120000 tests/derivation/core/spec 002/RunDerivedGen.idr delete mode 120000 tests/derivation/core/spec 002/derive.ipkg delete mode 100644 tests/derivation/core/spec 002/expected delete mode 120000 tests/derivation/core/spec 002/run delete mode 100644 tests/derivation/core/spec 003/DerivedGen.idr delete mode 120000 tests/derivation/core/spec 003/RunDerivedGen.idr delete mode 120000 tests/derivation/core/spec 003/derive.ipkg delete mode 100644 tests/derivation/core/spec 003/expected delete mode 120000 tests/derivation/core/spec 003/run diff --git a/tests/derivation/core/spec 001/DerivedGen.idr b/tests/derivation/core/spec 001/DerivedGen.idr deleted file mode 100644 index fa60588cb..000000000 --- a/tests/derivation/core/spec 001/DerivedGen.idr +++ /dev/null @@ -1,20 +0,0 @@ -module DerivedGen - -import RunDerivedGen - -%default total - -%language ElabReflection - -data X = MkX (List Nat) - -%hint -XShow : Show X -XShow = %runElab derive - -export -checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty X -checkedGen = deriveGen - -main : IO () -main = runGs [ G $ \fl => checkedGen fl @{smallNats} ] diff --git a/tests/derivation/core/spec 001/RunDerivedGen.idr b/tests/derivation/core/spec 001/RunDerivedGen.idr deleted file mode 120000 index 2b18cc56c..000000000 --- a/tests/derivation/core/spec 001/RunDerivedGen.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/spec 001/derive.ipkg b/tests/derivation/core/spec 001/derive.ipkg deleted file mode 120000 index ff0da46fe..000000000 --- a/tests/derivation/core/spec 001/derive.ipkg +++ /dev/null @@ -1 +0,0 @@ -../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/spec 001/expected b/tests/derivation/core/spec 001/expected deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/derivation/core/spec 001/run b/tests/derivation/core/spec 001/run deleted file mode 120000 index 805165988..000000000 --- a/tests/derivation/core/spec 001/run +++ /dev/null @@ -1 +0,0 @@ -../_common/run \ No newline at end of file diff --git a/tests/derivation/core/spec 002/DerivedGen.idr b/tests/derivation/core/spec 002/DerivedGen.idr deleted file mode 100644 index 0867e5cc6..000000000 --- a/tests/derivation/core/spec 002/DerivedGen.idr +++ /dev/null @@ -1,20 +0,0 @@ -module DerivedGen - -import RunDerivedGen - -%default total - -%language ElabReflection - -data X = MkX (Vect 3 Nat) - -%hint -XShow : Show X -XShow = %runElab derive - -export -checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty X -checkedGen = deriveGen - -main : IO () -main = runGs [ G $ \fl => checkedGen fl @{smallNats} ] diff --git a/tests/derivation/core/spec 002/RunDerivedGen.idr b/tests/derivation/core/spec 002/RunDerivedGen.idr deleted file mode 120000 index 2b18cc56c..000000000 --- a/tests/derivation/core/spec 002/RunDerivedGen.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/spec 002/derive.ipkg b/tests/derivation/core/spec 002/derive.ipkg deleted file mode 120000 index ff0da46fe..000000000 --- a/tests/derivation/core/spec 002/derive.ipkg +++ /dev/null @@ -1 +0,0 @@ -../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/spec 002/expected b/tests/derivation/core/spec 002/expected deleted file mode 100644 index b24ecf6f4..000000000 --- a/tests/derivation/core/spec 002/expected +++ /dev/null @@ -1,25 +0,0 @@ -1/2: Building RunDerivedGen (RunDerivedGen.idr) -2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 Prelude.Types.Nat -Generated values: ------ ------ -MkX [10, 10, 0] ------ -MkX [0, 10, 10] ------ -MkX [10, 10, 10] ------ -MkX [10, 10, 0] ------ -MkX [10, 0, 10] ------ -MkX [10, 0, 10] ------ -MkX [0, 10, 0] ------ -MkX [10, 0, 0] ------ -MkX [0, 0, 0] ------ -MkX [0, 0, 0] diff --git a/tests/derivation/core/spec 002/run b/tests/derivation/core/spec 002/run deleted file mode 120000 index 805165988..000000000 --- a/tests/derivation/core/spec 002/run +++ /dev/null @@ -1 +0,0 @@ -../_common/run \ No newline at end of file diff --git a/tests/derivation/core/spec 003/DerivedGen.idr b/tests/derivation/core/spec 003/DerivedGen.idr deleted file mode 100644 index 9d84f963e..000000000 --- a/tests/derivation/core/spec 003/DerivedGen.idr +++ /dev/null @@ -1,27 +0,0 @@ -module DerivedGen - -import RunDerivedGen - -%default total - -%language ElabReflection - -data Y : Nat -> Type where - MkY : Vect n (Fin n) -> Y n - -data X = MkX (Y 3) - -%hint -YShow : Show (Y n) -YShow = %runElab derive - -%hint -XShow : Show X -XShow = %runElab derive - -export -checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty Nat) => Gen MaybeEmpty X -checkedGen = deriveGen - -main : IO () -main = runGs [ G $ \fl => checkedGen fl @{smallNats} ] diff --git a/tests/derivation/core/spec 003/RunDerivedGen.idr b/tests/derivation/core/spec 003/RunDerivedGen.idr deleted file mode 120000 index 2b18cc56c..000000000 --- a/tests/derivation/core/spec 003/RunDerivedGen.idr +++ /dev/null @@ -1 +0,0 @@ -../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/core/spec 003/derive.ipkg b/tests/derivation/core/spec 003/derive.ipkg deleted file mode 120000 index ff0da46fe..000000000 --- a/tests/derivation/core/spec 003/derive.ipkg +++ /dev/null @@ -1 +0,0 @@ -../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/core/spec 003/expected b/tests/derivation/core/spec 003/expected deleted file mode 100644 index 26420592c..000000000 --- a/tests/derivation/core/spec 003/expected +++ /dev/null @@ -1,25 +0,0 @@ -1/2: Building RunDerivedGen (RunDerivedGen.idr) -2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -Generated values: ------ ------ -MkX (MkY [0, 2, 0]) ------ -MkX (MkY [2, 2, 0]) ------ -MkX (MkY [2, 2, 1]) ------ -MkX (MkY [1, 2, 2]) ------ -MkX (MkY [2, 1, 2]) ------ -MkX (MkY [2, 2, 1]) ------ -MkX (MkY [2, 0, 1]) ------ -MkX (MkY [2, 2, 2]) ------ -MkX (MkY [2, 2, 1]) ------ -MkX (MkY [2, 2, 2]) diff --git a/tests/derivation/core/spec 003/run b/tests/derivation/core/spec 003/run deleted file mode 120000 index 805165988..000000000 --- a/tests/derivation/core/spec 003/run +++ /dev/null @@ -1 +0,0 @@ -../_common/run \ No newline at end of file From 26bd951b80235fb13a7cb64ef97460d0f5d66b47 Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Mon, 19 Jan 2026 17:02:43 +0300 Subject: [PATCH 37/81] [ test ] Add couple more tests for simple specialisation --- .../specialise/06-0 ty shallow/DerivedGen.idr | 15 ++++++++++ .../specialise/06-0 ty shallow/derive.ipkg | 1 + .../print/specialise/06-0 ty shallow/run | 1 + .../specialise/06-1 ty deeper/DerivedGen.idr | 16 ++++++++++ .../specialise/06-1 ty deeper/derive.ipkg | 1 + .../print/specialise/06-1 ty deeper/run | 1 + .../specialise/06-0 ty shallow/DerivedGen.idr | 23 +++++++++++++++ .../06-0 ty shallow/RunDerivedGen.idr | 1 + .../specialise/06-0 ty shallow/derive.ipkg | 1 + .../run/specialise/06-0 ty shallow/run | 1 + .../specialise/06-1 ty deeper/DerivedGen.idr | 23 +++++++++++++++ .../06-1 ty deeper/RunDerivedGen.idr | 1 + .../run/specialise/06-1 ty deeper/derive.ipkg | 1 + .../run/specialise/06-1 ty deeper/run | 1 + .../specialise/06-2 ty deep/DerivedGen.idr | 29 +++++++++++++++++++ .../specialise/06-2 ty deep/RunDerivedGen.idr | 1 + .../run/specialise/06-2 ty deep/derive.ipkg | 1 + .../run/specialise/06-2 ty deep/run | 1 + .../06-3 ty deep hkd/DerivedGen.idr | 29 +++++++++++++++++++ .../06-3 ty deep hkd/RunDerivedGen.idr | 1 + .../specialise/06-3 ty deep hkd/derive.ipkg | 1 + .../run/specialise/06-3 ty deep hkd/run | 1 + .../06-4 ty deep hkd/DerivedGen.idr | 29 +++++++++++++++++++ .../06-4 ty deep hkd/RunDerivedGen.idr | 1 + .../specialise/06-4 ty deep hkd/derive.ipkg | 1 + .../run/specialise/06-4 ty deep hkd/run | 1 + 26 files changed, 183 insertions(+) create mode 100644 tests/derivation/least-effort/print/specialise/06-0 ty shallow/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/06-0 ty shallow/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/06-0 ty shallow/run create mode 100644 tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/06-1 ty deeper/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/06-1 ty deeper/run create mode 100644 tests/derivation/least-effort/run/specialise/06-0 ty shallow/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-0 ty shallow/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-0 ty shallow/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/06-0 ty shallow/run create mode 100644 tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-1 ty deeper/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-1 ty deeper/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/06-1 ty deeper/run create mode 100644 tests/derivation/least-effort/run/specialise/06-2 ty deep/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-2 ty deep/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-2 ty deep/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/06-2 ty deep/run create mode 100644 tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/run create mode 100644 tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/derive.ipkg create mode 120000 tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/run diff --git a/tests/derivation/least-effort/print/specialise/06-0 ty shallow/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/DerivedGen.idr new file mode 100644 index 000000000..27cc64df1 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/DerivedGen.idr @@ -0,0 +1,15 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data Y : Type -> Type where + MkY : Either Nat a -> Y a + +data X : Type where + MkX : Either Nat (Y Nat) -> X + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/06-0 ty shallow/derive.ipkg b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/06-0 ty shallow/run b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr new file mode 100644 index 000000000..e6afcaf85 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr @@ -0,0 +1,16 @@ +module DerivedGen + +import Data.Fin +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data Y : Type -> Type where + MkY : Either Nat a -> Y a + +data X : Type where + MkX : Either Nat (Y $ Either (Fin 5) String) -> X + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/derive.ipkg b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/run b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-0 ty shallow/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/DerivedGen.idr new file mode 100644 index 000000000..1bf026caa --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data Y : Type -> Type where + MkY : Either Nat a -> Y a + +data X : Type where + MkX : Either Nat (Y Nat) -> X + +Show a => Show (Y a) where + showPrec d $ MkY e = showCon d "MkY" $ showArg e + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/06-0 ty shallow/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-0 ty shallow/derive.ipkg b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-0 ty shallow/run b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr new file mode 100644 index 000000000..87a41025f --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr @@ -0,0 +1,23 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data Y : Type -> Type where + MkY : Either Nat a -> Y a + +data X : Type where + MkX : Either Nat (Y $ Either (Fin 5) String) -> X + +Show a => Show (Y a) where + showPrec d $ MkY e = showCon d "MkY" $ showArg e + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Gen MaybeEmpty String => Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/derive.ipkg b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/run b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-2 ty deep/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-2 ty deep/DerivedGen.idr new file mode 100644 index 000000000..18e238caf --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-2 ty deep/DerivedGen.idr @@ -0,0 +1,29 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data Z : Type -> Type where + MkZ : Either Nat a -> Z a + +data Y : Type -> Type where + MkY : Either (Z a) a -> Y a + +data X : Type where + MkX : Y Nat -> X + +Show a => Show (Z a) where + showPrec d $ MkZ e = showCon d "MkZ" $ showArg e + +Show a => Show (Y a) where + showPrec d $ MkY e = showCon d "MkY" $ showArg e + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/06-2 ty deep/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-2 ty deep/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-2 ty deep/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-2 ty deep/derive.ipkg b/tests/derivation/least-effort/run/specialise/06-2 ty deep/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-2 ty deep/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-2 ty deep/run b/tests/derivation/least-effort/run/specialise/06-2 ty deep/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-2 ty deep/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/DerivedGen.idr new file mode 100644 index 000000000..143d65a1d --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/DerivedGen.idr @@ -0,0 +1,29 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data Z : Type -> Type where + MkZ : Either Nat a -> Z a + +data Y : (Type -> Type) -> Type -> Type where + MkY : Either (f a) a -> Y f a + +data X : Type where + MkX : Y Z Nat -> X + +Show a => Show (Z a) where + showPrec d $ MkZ e = showCon d "MkZ" $ showArg e + +Show (f a) => Show a => Show (Y f a) where + showPrec d $ MkY e = showCon d "MkY" $ showArg e + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/derive.ipkg b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/run b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/DerivedGen.idr new file mode 100644 index 000000000..49a06b209 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/DerivedGen.idr @@ -0,0 +1,29 @@ +module DerivedGen + +import RunDerivedGen + +%default total + +data Z : Type -> Type where + MkZ : Either Nat a -> Z a + +data Y : (Type -> Type) -> Type -> Type where + MkY : Either (f a) (f $ f a) -> Y f a + +data X : Type where + MkX : Y Z Nat -> X + +Show a => Show (Z a) where + showPrec d $ MkZ e = showCon d "MkZ" $ showArg e + +Show (f a) => Show (f $ f a) => Show (Y f a) where + showPrec d $ MkY e = showCon d "MkY" $ showArg e + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/derive.ipkg b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/run b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 7b6d25512be2122d43753047d455ce76521582bd Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 14:48:03 +0300 Subject: [PATCH 38/81] [ fix ] Fix cast-wrapping in specialised generators --- .../DepTyCheck/Util/Specialisation.idr | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 5cb6b9a0b..92e5d581a 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -230,6 +230,20 @@ allConstructorsVisible : Elaboration m => TypeInfo -> m Bool allConstructorsVisible ti = do all id <$> traverse nameUnambigAndVis (name <$> ti.cons) +mkDPairHelper : Nat -> (Name -> TTImp) -> TTImp -> TTImp +mkDPairHelper 0 _ t = t +mkDPairHelper (S n) helper t = do + let nn = fromString $ "dph^\{show n}" + `(MkDPair ~(helper nn) ~(mkDPairHelper n helper t)) + +dPairHelper : Nat -> TTImp +dPairHelper 0 = `(?) +dPairHelper (S n) = `(DPair ? ~(dPairHelper n)) + +inSameNS : Name -> Name -> Name +inSameNS (NS ns _) n = NS ns n +inSameNS _ n = n + export %tcinline specialiseIfNeeded : Elaboration m => @@ -294,9 +308,16 @@ specialiseIfNeeded sig fuel givenParamValues = do let (newGP ** newGVals) = genGivens $ mapMaybe (\(a,b) => map (,b) a) $ zip givenSubst $ withIndex specTy.args -- Obtain the specialised generator call (inv, cg_rhs) <- callGen (MkGenSignature specTy newGP) fuel newGVals - let inv = case cg_rhs of + let inv : TTImp = case cg_rhs of Nothing => inv Just (n ** perm) => reorderGend False perm inv -- Use derived cast to convert result back to polymorphic type - let inv = `(map cast $ ~inv) + let generateds = sig.targetType.args.length `minus` sig.givenParams.size + let inv : TTImp = + if generateds == 0 + then `(map (cast @{~(var $ inSameNS specTy.name "mToP")}) $ ~inv) + else + `(the (Gen MaybeEmpty ~(dPairHelper generateds)) $ map (\invv => + case invv of + ~(mkDPairHelper generateds bindVar (bindVar "inv")) => ~(mkDPairHelper generateds var `(cast @{~(var $ inSameNS specTy.name "mToP")} inv))) ~inv) pure $ Just (specDecls, specTy, inv) From 366e5bd9e334e0b3c1c35a7983149461e4cc4abf Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 14:48:04 +0300 Subject: [PATCH 39/81] [ fix ] Make spec tests compile and fail only on totality check --- .../01-1 non-ty imm givn/DerivedGen.idr | 2 +- .../specialise/01-1 non-ty imm givn/expected | 184 ++++++++ .../01-2 non-ty imm gend/DerivedGen.idr | 2 +- .../01-3 non-ty imm exist/DerivedGen.idr | 2 +- .../02-3 two-similar/DerivedGen.idr | 2 +- .../03-0 non-ty imm-deep-same exist/expected | 403 +++++++++++++++++ .../03-1 non-ty imm-deep-same gend/expected | 415 +++++++++++++++++ .../03-2 non-ty imm-deep-same givn/expected | 310 +++++++++++++ .../expected | 410 +++++++++++++++++ .../expected | 313 +++++++++++++ .../expected | 421 ++++++++++++++++++ .../01-1 non-ty imm givn/DerivedGen.idr | 8 +- .../specialise/01-1 non-ty imm givn/expected | 67 +++ .../01-2 non-ty imm gend/DerivedGen.idr | 4 +- .../01-3 non-ty imm exist/DerivedGen.idr | 4 +- .../02-3 two-similar/DerivedGen.idr | 4 +- .../03-0 non-ty imm-deep-same exist/expected | 25 ++ .../03-1 non-ty imm-deep-same gend/expected | 25 ++ .../03-2 non-ty imm-deep-same givn/expected | 67 +++ .../expected | 67 +++ .../expected | 131 ++++++ .../expected | 67 +++ 22 files changed, 2919 insertions(+), 14 deletions(-) create mode 100644 tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected create mode 100644 tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected create mode 100644 tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected create mode 100644 tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected create mode 100644 tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected create mode 100644 tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected create mode 100644 tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected create mode 100644 tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected diff --git a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/DerivedGen.idr index c8dab8034..1195bfdcb 100644 --- a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/DerivedGen.idr +++ b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/DerivedGen.idr @@ -10,4 +10,4 @@ import Deriving.DepTyCheck.Gen data X : Nat -> Type where MkX : Vect n String -> X n -%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (n : _) -> Gen MaybeEmpty $ X n +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => (n : _) -> Gen MaybeEmpty $ X n diff --git a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected new file mode 100644 index 000000000..76aee4ffa --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected @@ -0,0 +1,184 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> (n : Nat) -> Gen MaybeEmpty (X n) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#1] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 String +LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] Vect^120651999565177027^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] Vect^120651999565177027^Con^1 - used final order: [#2 (xs), #1 (x)] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg + MW + AutoImplicit + (Just "external^<^prim^.String>[]") + ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ primVal (PrT StringType)) +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:2}") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + } + }) + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:2}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:2}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ var "cast" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:2}>") + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^120651999565177027.Vect^120651999565177027^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "Vect^120651999565177027.Vect^120651999565177027^Con^0") + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^120651999565177027.Vect^120651999565177027^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ var "cast" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "len")) + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var ">>=" + .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Vect^120651999565177027.Vect^120651999565177027^Con^1" + .! ("len", implicitTrue) + .$ var "x" + .$ var "xs")))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + ] + , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/DerivedGen.idr index 0975955f0..94e817c4e 100644 --- a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/DerivedGen.idr +++ b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/DerivedGen.idr @@ -10,4 +10,4 @@ import Deriving.DepTyCheck.Gen data X : Nat -> Type where MkX : Vect n String -> X n -%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty (n ** X n) +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty (n ** X n) diff --git a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/DerivedGen.idr index f8278bfd8..c03d90bb0 100644 --- a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/DerivedGen.idr +++ b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/DerivedGen.idr @@ -9,4 +9,4 @@ import Deriving.DepTyCheck.Gen data X = MkX (Vect n String) -%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/02-3 two-similar/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/02-3 two-similar/DerivedGen.idr index c058ab8e7..986704fa8 100644 --- a/tests/derivation/least-effort/print/specialise/02-3 two-similar/DerivedGen.idr +++ b/tests/derivation/least-effort/print/specialise/02-3 two-similar/DerivedGen.idr @@ -8,4 +8,4 @@ import Deriving.DepTyCheck.Gen data X = MkX (List String) (List $ Fin n) -%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected new file mode 100644 index 000000000..03838dcc4 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected @@ -0,0 +1,403 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:1}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "len" + .$ var "fv^lam^1")) + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^lam^1", implicitTrue) + .$ var "x" + .$ var "xs")))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") + .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected new file mode 100644 index 000000000..9ca579b2b --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected @@ -0,0 +1,415 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}"))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "len" + .$ var "fv^lam^1")) + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^lam^1", implicitTrue) + .$ var "x" + .$ var "xs")))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") + .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected new file mode 100644 index 000000000..452b624c8 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected @@ -0,0 +1,310 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#1] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "len" + .$ var "fv^lam^1")) + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^lam^1", implicitTrue) + .$ var "x" + .$ var "xs")))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") + .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected new file mode 100644 index 000000000..bddc88446 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected @@ -0,0 +1,410 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#0 (m), #2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "m")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:2}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "len" + .$ var "fv^lam^1")) + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^lam^1", implicitTrue) + .$ var "x" + .$ var "xs")))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") + .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected new file mode 100644 index 000000000..8e294528d --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected @@ -0,0 +1,313 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> Gen MaybeEmpty (X n m) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[0, 1] MkX - used final order: [#2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" .$ bindVar "inter^<{arg:2}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" .$ bindVar "m" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "m")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0, 1] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>" .$ var "inter^<{arg:2}>") + } + ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "len" + .$ var "fv^lam^1")) + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^lam^1", implicitTrue) + .$ var "x" + .$ var "xs")))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") + .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected new file mode 100644 index 000000000..43d8fbfc9 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected @@ -0,0 +1,421 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (m : Nat ** X n m) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#0 (m), #2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "m")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:3}"))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .$ bindVar "fv^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "len" + .$ var "fv^lam^1")) + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^lam^1", implicitTrue) + .$ var "x" + .$ var "xs")))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") + .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/DerivedGen.idr index 7eec7a1d6..52c627a94 100644 --- a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/DerivedGen.idr +++ b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/DerivedGen.idr @@ -11,12 +11,12 @@ data X : Nat -> Type where Show (X n) where showPrec d $ MkX xs = showCon d "MkX" $ showArg xs -checkedGen : Fuel -> (n : _) -> Gen MaybeEmpty $ X n +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => (n : _) -> Gen MaybeEmpty $ X n checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} main : IO Unit main = runGs - [ G $ \fl => checkedGen fl 0 - , G $ \fl => checkedGen fl 1 - , G $ \fl => checkedGen fl 3 + [ G $ \fl => checkedGen @{smallStrs} fl 0 + , G $ \fl => checkedGen @{smallStrs} fl 1 + , G $ \fl => checkedGen @{smallStrs} fl 3 ] diff --git a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected new file mode 100644 index 000000000..cfb36bc9f --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected @@ -0,0 +1,67 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 String +Generated values: +----- +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +----- +MkX [""] +----- +MkX ["a"] +----- +MkX [""] +----- +MkX ["bc"] +----- +MkX [""] +----- +MkX ["a"] +----- +MkX ["a"] +----- +MkX [""] +----- +MkX ["a"] +----- +MkX ["bc"] +----- +----- +MkX ["a", "a", ""] +----- +MkX ["bc", "a", "a"] +----- +MkX ["a", "a", "a"] +----- +MkX ["", "a", "a"] +----- +MkX ["", "a", "a"] +----- +MkX ["bc", "a", "a"] +----- +MkX ["bc", "", "a"] +----- +MkX ["bc", "bc", "bc"] +----- +MkX ["bc", "", "bc"] +----- +MkX ["", "bc", ""] diff --git a/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/DerivedGen.idr index 3bf459c1a..2631401c7 100644 --- a/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/DerivedGen.idr +++ b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/DerivedGen.idr @@ -11,8 +11,8 @@ data X : Nat -> Type where Show (X n) where showPrec d $ MkX xs = showCon d "MkX" $ showArg xs -checkedGen : Fuel -> Gen MaybeEmpty (n ** X n) +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty (n ** X n) checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} main : IO Unit -main = runGs [ G checkedGen ] +main = runGs [ G $ \fl => checkedGen fl @{smallStrs} ] diff --git a/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/DerivedGen.idr index d0d3db9a2..ef613c59f 100644 --- a/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/DerivedGen.idr +++ b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/DerivedGen.idr @@ -10,8 +10,8 @@ data X = MkX (Vect n String) Show X where showPrec d $ MkX xs = showCon d "MkX" $ showArg xs -checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} main : IO Unit -main = runGs [ G checkedGen ] +main = runGs [ G $ \fl => checkedGen fl @{smallStrs} ] diff --git a/tests/derivation/least-effort/run/specialise/02-3 two-similar/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/02-3 two-similar/DerivedGen.idr index 3ba61636c..81f0281fa 100644 --- a/tests/derivation/least-effort/run/specialise/02-3 two-similar/DerivedGen.idr +++ b/tests/derivation/least-effort/run/specialise/02-3 two-similar/DerivedGen.idr @@ -9,8 +9,8 @@ data X = MkX (List String) (List $ Fin n) Show X where showPrec d $ MkX xs ys = showCon d "MkX" $ showArg xs ++ showArg ys -checkedGen : Fuel -> Gen MaybeEmpty X +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} main : IO Unit -main = runGs [ G checkedGen ] +main = runGs [ G $ \fl => checkedGen @{smallStrs} fl ] diff --git a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected new file mode 100644 index 000000000..41358de0c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +MkX [6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 6, 15] +----- +MkX [0, 1, 1, 3] +----- +MkX [14, 11, 1, 14, 3, 13, 14, 2, 6, 14, 14, 13, 14, 13, 7] +----- +MkX [3, 3, 11, 12, 13, 13, 8, 9, 10, 7, 6, 4, 10, 2] +----- +MkX [4, 1, 7, 0, 1, 2, 9, 5, 9, 0] +----- +MkX [11, 1, 0, 11, 11, 6, 10, 0, 6, 0, 5, 6] +----- +MkX [3, 3, 5, 11, 5, 9, 11, 11, 2, 0, 2, 1] +----- +MkX [8, 3, 8, 5, 6, 3, 2, 0, 0, 3, 7] +----- +MkX [3, 1, 0, 3] +----- +MkX [0, 3, 3, 3] diff --git a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected new file mode 100644 index 000000000..cf16861d8 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +(16 ** MkX [6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 6, 15]) +----- +(4 ** MkX [0, 1, 1, 3]) +----- +(15 ** MkX [14, 11, 1, 14, 3, 13, 14, 2, 6, 14, 14, 13, 14, 13, 7]) +----- +(14 ** MkX [3, 3, 11, 12, 13, 13, 8, 9, 10, 7, 6, 4, 10, 2]) +----- +(10 ** MkX [4, 1, 7, 0, 1, 2, 9, 5, 9, 0]) +----- +(12 ** MkX [11, 1, 0, 11, 11, 6, 10, 0, 6, 0, 5, 6]) +----- +(12 ** MkX [3, 3, 5, 11, 5, 9, 11, 11, 2, 0, 2, 1]) +----- +(11 ** MkX [8, 3, 8, 5, 6, 3, 2, 0, 0, 3, 7]) +----- +(4 ** MkX [3, 1, 0, 3]) +----- +(4 ** MkX [0, 3, 3, 3]) diff --git a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected new file mode 100644 index 000000000..7de5eed58 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected @@ -0,0 +1,67 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +----- +MkX [0, 2, 0] +----- +MkX [2, 2, 0] +----- +MkX [2, 2, 1] +----- +MkX [1, 2, 2] +----- +MkX [2, 1, 2] +----- +MkX [2, 2, 1] +----- +MkX [2, 0, 1] +----- +MkX [2, 2, 2] +----- +MkX [2, 2, 1] +----- +MkX [2, 2, 2] diff --git a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected new file mode 100644 index 000000000..b90f89ed9 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected @@ -0,0 +1,67 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +----- +MkX [1] +----- +MkX [8] +----- +MkX [2] +----- +MkX [3] +----- +MkX [3] +----- +MkX [6] +----- +MkX [2] +----- +MkX [13] +----- +MkX [0] +----- +MkX [1] +----- +----- +MkX [8, 15, 1] +----- +MkX [2, 9, 1] +----- +MkX [4, 4, 4] +----- +MkX [3, 0, 3] +----- +MkX [2, 2, 1] +----- +MkX [6, 5, 7] +----- +MkX [1, 1, 3] +----- +MkX [13, 4, 14] +----- +MkX [11, 12, 11] +----- +MkX [4, 8, 8] diff --git a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected new file mode 100644 index 000000000..6b613607d --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected @@ -0,0 +1,131 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +----- +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +MkX [0] +----- +----- +MkX [1] +----- +MkX [2] +----- +MkX [2] +----- +MkX [2] +----- +MkX [0] +----- +MkX [2] +----- +MkX [2] +----- +MkX [1] +----- +MkX [2] +----- +MkX [2] +----- +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +MkX [0, 0, 0] +----- +----- +MkX [0, 2, 0] +----- +MkX [2, 2, 0] +----- +MkX [2, 2, 1] +----- +MkX [1, 2, 2] +----- +MkX [2, 1, 2] +----- +MkX [2, 2, 1] +----- +MkX [2, 0, 1] +----- +MkX [2, 2, 2] +----- +MkX [2, 2, 1] +----- +MkX [2, 2, 2] diff --git a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected new file mode 100644 index 000000000..10294af85 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected @@ -0,0 +1,67 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +(16 ** MkX []) +----- +(4 ** MkX []) +----- +(17 ** MkX []) +----- +(10 ** MkX []) +----- +(8 ** MkX []) +----- +(17 ** MkX []) +----- +(12 ** MkX []) +----- +(12 ** MkX []) +----- +(10 ** MkX []) +----- +(4 ** MkX []) +----- +----- +(16 ** MkX [1]) +----- +(17 ** MkX [8]) +----- +(10 ** MkX [2]) +----- +(17 ** MkX [3]) +----- +(4 ** MkX [3]) +----- +(7 ** MkX [6]) +----- +(8 ** MkX [2]) +----- +(18 ** MkX [13]) +----- +(7 ** MkX [0]) +----- +(2 ** MkX [1]) +----- +----- +(16 ** MkX [8, 15, 1]) +----- +(10 ** MkX [2, 9, 1]) +----- +(5 ** MkX [4, 4, 4]) +----- +(4 ** MkX [3, 0, 3]) +----- +(3 ** MkX [2, 2, 1]) +----- +(10 ** MkX [6, 5, 7]) +----- +(4 ** MkX [1, 1, 3]) +----- +(15 ** MkX [13, 4, 14]) +----- +(13 ** MkX [11, 12, 11]) +----- +(9 ** MkX [4, 8, 8]) From dc969780bc38731e41d63318c94c0a22b4b29a7b Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 15:43:47 +0300 Subject: [PATCH 40/81] [ new ] Display specialised name in normal logs --- .../DepTyCheck/Util/Specialisation.idr | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 92e5d581a..ee38671ff 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -163,16 +163,26 @@ processArg sig argIdx ga with (ga.given) pure $ singleArg argIdx ga processArg sig argIdx ga | Just x = do let (appLhs, appTerms) = unAppAny x - case getGivens' x of - Just givens => do + let IVar _ tyName = appLhs + | _ => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given value head is not a variable, passing through" + pure $ singleArg argIdx ga + case lookupType tyName of + Just tyInfo => do + let (_ :: _) = appTerms + | [] => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a type invocation w/o arguments, specialising" + pure (x, []) + let givens = map (uncurry MkGenArg) $ zip tyInfo.args $ getGivens tyInfo.args (mkAllApps appTerms) logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a type invocation, traversing arguments: \{show $ map (fromMaybe "" . name . arg) givens}" map (mapFst $ reAppAny appLhs) $ processArgs' sig argIdx $ takeWhile (.isGiven) givens - _ => + Nothing => do if (snd (unPi ga.arg.type) == `(Type)) then do - logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a type invocation w/o arguments, specialising" - pure (x, []) + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a non-global type expr, passing through" + -- pure (x, []) + pure $ singleArg argIdx ga else do logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a non-type expr, passing through" pure $ singleArg argIdx ga @@ -293,7 +303,7 @@ specialiseIfNeeded sig fuel givenParamValues = do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" -- Declare derived type declare specDecls - logPoint Trace "deptycheck.util.specialisation" [sig] "Declared specialised type: \{show lambdaRet}" + logPoint Trace "deptycheck.util.specialisation" [sig] "Declared specialised type \{show specTy.name}: \{show lambdaRet}" pure (specTy, []) Just specTy => do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Found \{show specTy.name}" From 494778fe776b7b03f33c25509c49560e39b7192a Mon Sep 17 00:00:00 2001 From: Denis Buzdalov Date: Tue, 20 Jan 2026 16:41:47 +0300 Subject: [PATCH 41/81] [ test ] Add some lacking print tests + fix one run test --- .run-to-print-tests | 4 ++-- .../specialise/06-1 ty deeper/DerivedGen.idr | 3 +-- .../specialise/06-2 ty deep/DerivedGen.idr | 18 ++++++++++++++++++ .../print/specialise/06-2 ty deep/derive.ipkg | 1 + .../print/specialise/06-2 ty deep/run | 1 + .../specialise/06-3 ty deep hkd/DerivedGen.idr | 18 ++++++++++++++++++ .../specialise/06-3 ty deep hkd/derive.ipkg | 1 + .../print/specialise/06-3 ty deep hkd/run | 1 + .../specialise/06-4 ty deep hkd/DerivedGen.idr | 18 ++++++++++++++++++ .../specialise/06-4 ty deep hkd/derive.ipkg | 1 + .../print/specialise/06-4 ty deep hkd/run | 1 + .../specialise/06-1 ty deeper/DerivedGen.idr | 4 ++-- 12 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 tests/derivation/least-effort/print/specialise/06-2 ty deep/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/06-2 ty deep/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/06-2 ty deep/run create mode 100644 tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/run create mode 100644 tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/derive.ipkg create mode 120000 tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/run diff --git a/.run-to-print-tests b/.run-to-print-tests index 499961912..58b2c36b6 100755 --- a/.run-to-print-tests +++ b/.run-to-print-tests @@ -2,13 +2,13 @@ if [ "$1" = "--force" ]; then FORCE_REWRITE=1 + shift else FORCE_REWRITE=0 fi -shift if [ -z "$1" ] || [ -z "$2" ] ; then - echo "Usage: $0 [--force] [ ...]" >&2 + echo "Usage: $0 [--force] [ ...]" >&2 exit 1 fi diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr index e6afcaf85..ade389482 100644 --- a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr @@ -1,6 +1,5 @@ module DerivedGen -import Data.Fin import Deriving.DepTyCheck.Gen %default total @@ -13,4 +12,4 @@ data Y : Type -> Type where data X : Type where MkX : Either Nat (Y $ Either (Fin 5) String) -> X -%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty String => Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/06-2 ty deep/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/06-2 ty deep/DerivedGen.idr new file mode 100644 index 000000000..1da9baee5 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-2 ty deep/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data Z : Type -> Type where + MkZ : Either Nat a -> Z a + +data Y : Type -> Type where + MkY : Either (Z a) a -> Y a + +data X : Type where + MkX : Y Nat -> X + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/06-2 ty deep/derive.ipkg b/tests/derivation/least-effort/print/specialise/06-2 ty deep/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-2 ty deep/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/06-2 ty deep/run b/tests/derivation/least-effort/print/specialise/06-2 ty deep/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-2 ty deep/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/DerivedGen.idr new file mode 100644 index 000000000..8fe83911a --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data Z : Type -> Type where + MkZ : Either Nat a -> Z a + +data Y : (Type -> Type) -> Type -> Type where + MkY : Either (f a) a -> Y f a + +data X : Type where + MkX : Y Z Nat -> X + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/derive.ipkg b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/run b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/DerivedGen.idr new file mode 100644 index 000000000..762b09c82 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + +data Z : Type -> Type where + MkZ : Either Nat a -> Z a + +data Y : (Type -> Type) -> Type -> Type where + MkY : Either (f a) (f $ f a) -> Y f a + +data X : Type where + MkX : Y Z Nat -> X + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/derive.ipkg b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/run b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr index 87a41025f..20f1979f8 100644 --- a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr +++ b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr @@ -16,8 +16,8 @@ Show a => Show (Y a) where Show X where showPrec d $ MkX xs = showCon d "MkX" $ showArg xs -checkedGen : Gen MaybeEmpty String => Fuel -> Gen MaybeEmpty X +checkedGen : Fuel -> Gen MaybeEmpty String => Gen MaybeEmpty X checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} main : IO Unit -main = runGs [ G checkedGen ] +main = runGs [ G $ \fl => checkedGen fl ] From fcf5a4c54eed82fc16a3504a65e5b884a14f03c7 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 17:13:21 +0300 Subject: [PATCH 42/81] [ fix ] Fix incorrect gen signature in tests --- .../print/specialise/06-1 ty deeper/DerivedGen.idr | 2 +- .../least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr index ade389482..e3b606af2 100644 --- a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/DerivedGen.idr @@ -12,4 +12,4 @@ data Y : Type -> Type where data X : Type where MkX : Either Nat (Y $ Either (Fin 5) String) -> X -%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty String => Gen MaybeEmpty X +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X diff --git a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr index 20f1979f8..511995433 100644 --- a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr +++ b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/DerivedGen.idr @@ -16,8 +16,8 @@ Show a => Show (Y a) where Show X where showPrec d $ MkX xs = showCon d "MkX" $ showArg xs -checkedGen : Fuel -> Gen MaybeEmpty String => Gen MaybeEmpty X +checkedGen : Fuel -> (Fuel -> Gen MaybeEmpty String) => Gen MaybeEmpty X checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} main : IO Unit -main = runGs [ G $ \fl => checkedGen fl ] +main = runGs [ G $ \fl => checkedGen @{smallStrs} fl ] From 2adea515aa61baeee3cb2a70062f4b9b10015d1b Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 17:15:42 +0300 Subject: [PATCH 43/81] [ fix ] Fix bugs in specialiseIfNeeded logic - Specialise on primitive types - Use try-check for more correct visibility checking - Generate fully qulaify the type's namespace when generating it --- .../DepTyCheck/Util/Specialisation.idr | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index ee38671ff..39f869d7d 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -164,6 +164,9 @@ processArg sig argIdx ga with (ga.given) processArg sig argIdx ga | Just x = do let (appLhs, appTerms) = unAppAny x let IVar _ tyName = appLhs + | IPrimVal _ (PrT _) => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given a primitive type invocation, specialising" + pure (x, []) | _ => do logPoint DetailedDebug "deptycheck.util.specialisation" [sig, ga] "Given value head is not a variable, passing through" pure $ singleArg argIdx ga @@ -232,9 +235,9 @@ specTaskToName' t = do nameUnambigAndVis : Elaboration m => Name -> m Bool nameUnambigAndVis n = do - [(_, vis)] <- getVis n - | _ => pure False - pure $ vis /= Private + try (do + _ : Unit <- check `(let x = ~(var n) in ()) + pure True) (pure False) allConstructorsVisible : Elaboration m => TypeInfo -> m Bool allConstructorsVisible ti = do @@ -267,17 +270,23 @@ specialiseIfNeeded sig fuel givenParamValues = do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Checking specialisation need for \{show givenParamValues}..." -- Check if there are any given type args, if not return Nothing let True = any (\a => snd (unPi a.type) == `(Type)) $ index' sig.targetType.args <$> Prelude.toList sig.givenParams - | False => pure Nothing + | False => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Not found any given type args, specialisation not needed." + pure Nothing -- Check if all of the generated type's constructors are visible, if not return Nothing True <- allConstructorsVisible sig.targetType - | False => pure Nothing + | False => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "\{sig.targetType.name} has invisible constructors, specialisation impossible." + pure Nothing -- Assemble the `GenArg`s from `GenSignature` and given values let givenIdxVals = Prelude.toList sig.givenParams `zipV` givenParamValues let genArgs = mkArgs sig (withIndex sig.targetType.args) givenIdxVals -- Check if at least one `GenArg` can be specialised upon (i.e. is a type argument and has a non-passthrough given value) specable <- traverse (.isSpecialising) genArgs let True = any id specable - | False => pure Nothing + | False => do + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Not found any type arguments that can be specialised upon, specialisation not impossible." + pure Nothing -- Generate specialisation rhs, arguments, and given values (lambdaRet, fvArgs, givenSubst) <- processArgs sig genArgs let preNorm = foldr lam lambdaRet fvArgs @@ -298,7 +307,11 @@ specialiseIfNeeded sig fuel givenParamValues = do Nothing => do -- If not found at all, derive specialised type logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Specialised type not found, deriving..." - Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw specName lambdaTy lambdaBody + thisNS <- do + NS nsn _ <- inCurrentNS "" + | _ => fail "Internal error: inCurrentNS did not return NS" + pure nsn + Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw {nsProvider = inNS thisNS} specName lambdaTy lambdaBody | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" -- Declare derived type From aa0a3bcd6e46ae8a6f959ecef904a00f9965889e Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 17:15:57 +0300 Subject: [PATCH 44/81] [ test ] Add expected values to succeeding tests --- .../print/specialise/06-0 ty shallow/expected | 413 +++++++++++ .../print/specialise/06-1 ty deeper/expected | 687 ++++++++++++++++++ .../print/specialise/06-2 ty deep/expected | 473 ++++++++++++ .../specialise/06-3 ty deep hkd/expected | 473 ++++++++++++ .../specialise/06-4 ty deep hkd/expected | 630 ++++++++++++++++ .../run/specialise/06-0 ty shallow/expected | 27 + .../run/specialise/06-1 ty deeper/expected | 28 + .../run/specialise/06-2 ty deep/expected | 28 + .../run/specialise/06-3 ty deep hkd/expected | 28 + .../run/specialise/06-4 ty deep hkd/expected | 30 + 10 files changed, 2817 insertions(+) create mode 100644 tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected create mode 100644 tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected create mode 100644 tests/derivation/least-effort/print/specialise/06-2 ty deep/expected create mode 100644 tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/expected create mode 100644 tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/expected create mode 100644 tests/derivation/least-effort/run/specialise/06-0 ty shallow/expected create mode 100644 tests/derivation/least-effort/run/specialise/06-1 ty deeper/expected create mode 100644 tests/derivation/least-effort/run/specialise/06-2 ty deep/expected create mode 100644 tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/expected create mode 100644 tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/expected diff --git a/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected new file mode 100644 index 000000000..c63115bec --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected @@ -0,0 +1,413 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^4289176107705670177.Either^4289176107705670177: Prelude.Types.Either Prelude.Types.Nat (DerivedGen.Y Prelude.Types.Nat) +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^4289176107705670177.Either^4289176107705670177[] Either^4289176107705670177^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^4289176107705670177.Either^4289176107705670177[] Either^4289176107705670177^Con^1 - used final order: [#0 (x)] +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^11712255676025100806.Y^11712255676025100806: DerivedGen.Y Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] Y^11712255676025100806^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^1 - used final order: [#0 (x)] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^4289176107705670177.Either^4289176107705670177" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^4289176107705670177.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^4289176107705670177.Either^4289176107705670177" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^4289176107705670177.Either^4289176107705670177" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^4289176107705670177.Either^4289176107705670177^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^4289176107705670177.Either^4289176107705670177^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^4289176107705670177.Either^4289176107705670177^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Y^11712255676025100806.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^4289176107705670177.Either^4289176107705670177^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^4289176107705670177.Either^4289176107705670177[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0" .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected new file mode 100644 index 000000000..9b618b793 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected @@ -0,0 +1,687 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^17089122808763292221.Either^17089122808763292221: Prelude.Types.Either Prelude.Types.Nat (DerivedGen.Y (Prelude.Types.Either (Data.Fin.Fin lam^0) String)) +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^lam^0)] Either^17089122808763292221^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^lam^0)] Either^17089122808763292221^Con^1 - used final order: [#1 (x)] +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^7167106520753982886.Y^7167106520753982886: DerivedGen.Y (Prelude.Types.Either (Data.Fin.Fin lam^0) String) +LOG deptycheck.derive.least-effort:7: DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^lam^0)] Y^7167106520753982886^Con^0 - used final order: [#1] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^5595291053177582713.Either^5595291053177582713: Prelude.Types.Either Prelude.Types.Nat (Prelude.Types.Either (Data.Fin.Fin lam^0) String) +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^lam^0)] Either^5595291053177582713^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^lam^0)] Either^5595291053177582713^Con^1 - used final order: [#1 (x)] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13748098436294604892.Either^13748098436294604892: Prelude.Types.Either (Data.Fin.Fin lam^0) String +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^lam^0)] Either^13748098436294604892^Con^0 - used final order: [#1 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^lam^0)] Either^13748098436294604892^Con^1 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg + MW + AutoImplicit + (Just "external^<^prim^.String>[]") + ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ primVal (PrT StringType)) +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" .$ var "fv^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" .$ var "fv^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" .$ var "fv^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" .$ var "fv^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^17089122808763292221.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ ( var "Prelude.Types.S" + .$ ( var "Prelude.Types.S" + .$ ( var "Prelude.Types.S" + .$ (var "Prelude.Types.S" .$ (var "Prelude.Types.S" .$ var "Prelude.Types.Z"))))))) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" .$ var "fv^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" .$ var "fv^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^0" + .$ var "x" + .! ("fv^lam^0", var "fv^lam^0")))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Y^7167106520753982886.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^lam^0")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^1" + .! ("fv^lam^0", implicitTrue) + .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^lam^0)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" .$ var "fv^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "fv^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^5595291053177582713.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^lam^0")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0" + .! ("fv^lam^0", implicitTrue) + .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^lam^0)] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" .$ var "fv^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" .$ var "fv^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0" + .$ var "x" + .! ("fv^lam^0", var "fv^lam^0")))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^13748098436294604892.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^lam^0")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1" + .! ("fv^lam^0", implicitTrue) + .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^lam^0)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" .$ var "fv^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" .$ var "fv^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^0") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0" + .! ("fv^lam^0", implicitTrue) + .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1" + .$ var "x" + .! ("fv^lam^0", var "fv^lam^0")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^lam^0)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") + .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/06-2 ty deep/expected b/tests/derivation/least-effort/print/specialise/06-2 ty deep/expected new file mode 100644 index 000000000..da2f59fa1 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-2 ty deep/expected @@ -0,0 +1,473 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0] +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^11712255676025100806.Y^11712255676025100806: DerivedGen.Y Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] Y^11712255676025100806^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^8529713418737914198.Either^8529713418737914198: Prelude.Types.Either (DerivedGen.Z Prelude.Types.Nat) Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^8529713418737914198.Either^8529713418737914198[] Either^8529713418737914198^Con^0 - used final order: [#0 (x)] +LOG deptycheck.util.specialisation:10: DerivedGen.Z[0] Declared specialised type DerivedGen.Z^4772972569107533783.Z^4772972569107533783: DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^8529713418737914198.Either^8529713418737914198[] Either^8529713418737914198^Con^1 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Z^4772972569107533783.Z^4772972569107533783[] Z^4772972569107533783^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^1 - used final order: [#0 (x)] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Y^11712255676025100806.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^8529713418737914198.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0" .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^8529713418737914198.Either^8529713418737914198^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Z^4772972569107533783.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^8529713418737914198.Either^8529713418737914198^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^8529713418737914198.Either^8529713418737914198[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:4}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/expected b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/expected new file mode 100644 index 000000000..3dc6d985b --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/expected @@ -0,0 +1,473 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0] +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0, 1] Declared specialised type DerivedGen.Y^6741950274054397085.Y^6741950274054397085: DerivedGen.Y DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Y^6741950274054397085.Y^6741950274054397085[] Y^6741950274054397085^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^8529713418737914198.Either^8529713418737914198: Prelude.Types.Either (DerivedGen.Z Prelude.Types.Nat) Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^8529713418737914198.Either^8529713418737914198[] Either^8529713418737914198^Con^0 - used final order: [#0 (x)] +LOG deptycheck.util.specialisation:10: DerivedGen.Z[0] Declared specialised type DerivedGen.Z^4772972569107533783.Z^4772972569107533783: DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^8529713418737914198.Either^8529713418737914198[] Either^8529713418737914198^Con^1 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Z^4772972569107533783.Z^4772972569107533783[] Z^4772972569107533783^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^1 - used final order: [#0 (x)] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Y^6741950274054397085.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^8529713418737914198.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0" .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^8529713418737914198.Either^8529713418737914198^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Z^4772972569107533783.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^8529713418737914198.Either^8529713418737914198^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^8529713418737914198.Either^8529713418737914198[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:4}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/expected b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/expected new file mode 100644 index 000000000..712779e3f --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/expected @@ -0,0 +1,630 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0] +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0, 1] Declared specialised type DerivedGen.Y^6741950274054397085.Y^6741950274054397085: DerivedGen.Y DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Y^6741950274054397085.Y^6741950274054397085[] Y^6741950274054397085^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^70731854558853028.Either^70731854558853028: Prelude.Types.Either (DerivedGen.Z Prelude.Types.Nat) (DerivedGen.Z (DerivedGen.Z Prelude.Types.Nat)) +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^70731854558853028.Either^70731854558853028[] Either^70731854558853028^Con^0 - used final order: [#0 (x)] +LOG deptycheck.util.specialisation:10: DerivedGen.Z[0] Declared specialised type DerivedGen.Z^4772972569107533783.Z^4772972569107533783: DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^70731854558853028.Either^70731854558853028[] Either^70731854558853028^Con^1 - used final order: [#0 (x)] +LOG deptycheck.util.specialisation:10: DerivedGen.Z[0] Declared specialised type DerivedGen.Z^15549736185298716768.Z^15549736185298716768: DerivedGen.Z (DerivedGen.Z Prelude.Types.Nat) +LOG deptycheck.derive.least-effort:7: DerivedGen.Z^15549736185298716768.Z^15549736185298716768[] Z^15549736185298716768^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^9277747372264086100.Either^9277747372264086100: Prelude.Types.Either Prelude.Types.Nat (DerivedGen.Z Prelude.Types.Nat) +LOG deptycheck.derive.least-effort:7: DerivedGen.Z^4772972569107533783.Z^4772972569107533783[] Z^4772972569107533783^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^1 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^9277747372264086100.Either^9277747372264086100[] Either^9277747372264086100^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^9277747372264086100.Either^9277747372264086100[] Either^9277747372264086100^Con^1 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^70731854558853028.Either^70731854558853028" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Y^6741950274054397085.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^70731854558853028.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0" .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^70731854558853028.Either^70731854558853028" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^70731854558853028.Either^70731854558853028" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^70731854558853028.Either^70731854558853028^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Z^4772972569107533783.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^70731854558853028.Either^70731854558853028^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^70731854558853028.Either^70731854558853028^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Z^15549736185298716768.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^70731854558853028.Either^70731854558853028^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^70731854558853028.Either^70731854558853028[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^15549736185298716768.Z^15549736185298716768^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^9277747372264086100.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768^Con^0" .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^15549736185298716768.Z^15549736185298716768[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Z^4772972569107533783.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/run/specialise/06-0 ty shallow/expected b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/expected new file mode 100644 index 000000000..78b18e824 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-0 ty shallow/expected @@ -0,0 +1,27 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^4289176107705670177.Either^4289176107705670177: Prelude.Types.Either Prelude.Types.Nat (DerivedGen.Y Prelude.Types.Nat) +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^11712255676025100806.Y^11712255676025100806: DerivedGen.Y Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat +Generated values: +----- +----- +MkX (Right (MkY (Left 16))) +----- +MkX (Left 4) +----- +MkX (Left 17) +----- +MkX (Left 10) +----- +MkX (Left 8) +----- +MkX (Right (MkY (Right 17))) +----- +MkX (Right (MkY (Left 11))) +----- +MkX (Right (MkY (Left 11))) +----- +MkX (Left 10) +----- +MkX (Left 4) diff --git a/tests/derivation/least-effort/run/specialise/06-1 ty deeper/expected b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/expected new file mode 100644 index 000000000..489311cc3 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-1 ty deeper/expected @@ -0,0 +1,28 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^17089122808763292221.Either^17089122808763292221: Prelude.Types.Either Prelude.Types.Nat (DerivedGen.Y (Prelude.Types.Either (Data.Fin.Fin lam^0) String)) +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^7167106520753982886.Y^7167106520753982886: DerivedGen.Y (Prelude.Types.Either (Data.Fin.Fin lam^0) String) +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^5595291053177582713.Either^5595291053177582713: Prelude.Types.Either Prelude.Types.Nat (Prelude.Types.Either (Data.Fin.Fin lam^0) String) +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13748098436294604892.Either^13748098436294604892: Prelude.Types.Either (Data.Fin.Fin lam^0) String +Generated values: +----- +----- +MkX (Right (MkY (Left 16))) +----- +MkX (Left 4) +----- +MkX (Left 17) +----- +MkX (Left 10) +----- +MkX (Left 8) +----- +MkX (Right (MkY (Right (Right "a")))) +----- +MkX (Right (MkY (Left 17))) +----- +MkX (Right (MkY (Left 11))) +----- +MkX (Right (MkY (Left 11))) +----- +MkX (Left 10) diff --git a/tests/derivation/least-effort/run/specialise/06-2 ty deep/expected b/tests/derivation/least-effort/run/specialise/06-2 ty deep/expected new file mode 100644 index 000000000..8184164fd --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-2 ty deep/expected @@ -0,0 +1,28 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^11712255676025100806.Y^11712255676025100806: DerivedGen.Y Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^8529713418737914198.Either^8529713418737914198: Prelude.Types.Either (DerivedGen.Z Prelude.Types.Nat) Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: DerivedGen.Z[0] Declared specialised type DerivedGen.Z^4772972569107533783.Z^4772972569107533783: DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat +Generated values: +----- +----- +MkX (MkY (Right 16)) +----- +MkX (MkY (Left (MkZ (Left 3)))) +----- +MkX (MkY (Left (MkZ (Left 17)))) +----- +MkX (MkY (Left (MkZ (Right 10)))) +----- +MkX (MkY (Left (MkZ (Left 8)))) +----- +MkX (MkY (Right 17)) +----- +MkX (MkY (Right 12)) +----- +MkX (MkY (Right 12)) +----- +MkX (MkY (Left (MkZ (Right 7)))) +----- +MkX (MkY (Left (MkZ (Right 3)))) diff --git a/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/expected b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/expected new file mode 100644 index 000000000..b9823f974 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-3 ty deep hkd/expected @@ -0,0 +1,28 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0, 1] Declared specialised type DerivedGen.Y^6741950274054397085.Y^6741950274054397085: DerivedGen.Y DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^8529713418737914198.Either^8529713418737914198: Prelude.Types.Either (DerivedGen.Z Prelude.Types.Nat) Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: DerivedGen.Z[0] Declared specialised type DerivedGen.Z^4772972569107533783.Z^4772972569107533783: DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat +Generated values: +----- +----- +MkX (MkY (Right 16)) +----- +MkX (MkY (Left (MkZ (Left 3)))) +----- +MkX (MkY (Left (MkZ (Left 17)))) +----- +MkX (MkY (Left (MkZ (Right 10)))) +----- +MkX (MkY (Left (MkZ (Left 8)))) +----- +MkX (MkY (Right 17)) +----- +MkX (MkY (Right 12)) +----- +MkX (MkY (Right 12)) +----- +MkX (MkY (Left (MkZ (Right 7)))) +----- +MkX (MkY (Left (MkZ (Right 3)))) diff --git a/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/expected b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/expected new file mode 100644 index 000000000..8784cc719 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/06-4 ty deep hkd/expected @@ -0,0 +1,30 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: DerivedGen.Y[0, 1] Declared specialised type DerivedGen.Y^6741950274054397085.Y^6741950274054397085: DerivedGen.Y DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^70731854558853028.Either^70731854558853028: Prelude.Types.Either (DerivedGen.Z Prelude.Types.Nat) (DerivedGen.Z (DerivedGen.Z Prelude.Types.Nat)) +LOG deptycheck.util.specialisation:10: DerivedGen.Z[0] Declared specialised type DerivedGen.Z^4772972569107533783.Z^4772972569107533783: DerivedGen.Z Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: DerivedGen.Z[0] Declared specialised type DerivedGen.Z^15549736185298716768.Z^15549736185298716768: DerivedGen.Z (DerivedGen.Z Prelude.Types.Nat) +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^9277747372264086100.Either^9277747372264086100: Prelude.Types.Either Prelude.Types.Nat (DerivedGen.Z Prelude.Types.Nat) +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat +Generated values: +----- +----- +MkX (MkY (Right (MkZ (Left 16)))) +----- +MkX (MkY (Left (MkZ (Left 3)))) +----- +MkX (MkY (Left (MkZ (Left 17)))) +----- +MkX (MkY (Left (MkZ (Right 10)))) +----- +MkX (MkY (Left (MkZ (Left 8)))) +----- +MkX (MkY (Right (MkZ (Right (MkZ (Right 17)))))) +----- +MkX (MkY (Right (MkZ (Left 11)))) +----- +MkX (MkY (Right (MkZ (Left 11)))) +----- +MkX (MkY (Left (MkZ (Right 7)))) +----- +MkX (MkY (Left (MkZ (Right 3)))) From 7394b2e2a5d46091475a3ffb1048a8bb18882f2a Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 17:27:20 +0300 Subject: [PATCH 45/81] [ cleanup ] Break up too-log lines --- src/Deriving/DepTyCheck/Util/Specialisation.idr | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 39f869d7d..1b7e044ac 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -285,7 +285,8 @@ specialiseIfNeeded sig fuel givenParamValues = do specable <- traverse (.isSpecialising) genArgs let True = any id specable | False => do - logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Not found any type arguments that can be specialised upon, specialisation not impossible." + logPoint DetailedDebug "deptycheck.util.specialisation" [sig] + "Not found any type arguments that can be specialised upon, specialisation impossible." pure Nothing -- Generate specialisation rhs, arguments, and given values (lambdaRet, fvArgs, givenSubst) <- processArgs sig genArgs @@ -311,7 +312,8 @@ specialiseIfNeeded sig fuel givenParamValues = do NS nsn _ <- inCurrentNS "" | _ => fail "Internal error: inCurrentNS did not return NS" pure nsn - Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ specialiseDataRaw {nsProvider = inNS thisNS} specName lambdaTy lambdaBody + Right (specTy, specDecls) <- runEitherT {m} {e=SpecialisationError} $ + specialiseDataRaw {nsProvider = inNS thisNS} specName lambdaTy lambdaBody | Left err => fail "INTERNAL ERROR: Specialisation \{show lambdaBody} failed with error \{show err}." logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" -- Declare derived type @@ -342,5 +344,6 @@ specialiseIfNeeded sig fuel givenParamValues = do else `(the (Gen MaybeEmpty ~(dPairHelper generateds)) $ map (\invv => case invv of - ~(mkDPairHelper generateds bindVar (bindVar "inv")) => ~(mkDPairHelper generateds var `(cast @{~(var $ inSameNS specTy.name "mToP")} inv))) ~inv) + ~(mkDPairHelper generateds bindVar (bindVar "inv")) => + ~(mkDPairHelper generateds var `(cast @{~(var $ inSameNS specTy.name "mToP")} inv))) ~inv) pure $ Just (specDecls, specTy, inv) From 6d34bcac9c6b6bd68b7bac81f1af16b6e9feb477 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 17:38:14 +0300 Subject: [PATCH 46/81] [ test ] Update specialise-if-needed outputs --- .../spec-if-needed-001/expected | 8 ++--- .../spec-if-needed-002/expected | 8 ++--- .../spec-if-needed-003/expected | 10 +++---- .../spec-if-needed-004/expected | 30 +++++++++---------- .../spec-if-needed-005/expected | 16 +++++----- .../spec-if-needed-006/expected | 1 + 6 files changed, 37 insertions(+), 36 deletions(-) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected index 1127776ac..4b9a15aeb 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-001/expected @@ -3,12 +3,12 @@ LOG deptycheck.test.utils.specialise:0: Expanded e: Data.Vect.Vect _ Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Checking specialisation need for [Prelude.Types.Nat]... LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] len No given value, passing through -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] (elem := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] (elem := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Task before normalisation: \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] NormaliseTask returned: lambdaTy = (lam^0 : Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] lambdaBody = \ lam^0 => Data.Vect.Vect lam^0 Prelude.Types.Nat; LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type name: Vect^9686363643684445030.Vect^9686363643684445030 LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Derived Vect^9686363643684445030.Vect^9686363643684445030 -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type: Data.Vect.Vect lam^0 Prelude.Types.Nat -LOG deptycheck.test.utils.specialise:0: Vect^9686363643684445030.Vect^9686363643684445030[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Data.Vect.Vect[1(elem)] Derived Test.Vect^9686363643684445030.Vect^9686363643684445030 +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type Test.Vect^9686363643684445030.Vect^9686363643684445030: Data.Vect.Vect lam^0 Prelude.Types.Nat +LOG deptycheck.test.utils.specialise:0: Test.Vect^9686363643684445030.Vect^9686363643684445030[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index 65603031f..d9396c811 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -2,13 +2,13 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Prelude.Types.S LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Checking specialisation need for [Prelude.Types.Nat, Prelude.Types.S]... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] (t := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] (t := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] ({arg:1} := Prelude.Types.S) Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: \ lam^0 => Test.X Prelude.Types.Nat lam^0 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:2} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^17949373096448478648.X^17949373096448478648 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived X^17949373096448478648.X^17949373096448478648 -LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type: Test.X Prelude.Types.Nat lam^0 -LOG deptycheck.test.utils.specialise:0: X^17949373096448478648.X^17949373096448478648[0(fv^lam^0)] CallGen params: [Prelude.Types.S] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived Test.X^17949373096448478648.X^17949373096448478648 +LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type Test.X^17949373096448478648.X^17949373096448478648: Test.X Prelude.Types.Nat lam^0 +LOG deptycheck.test.utils.specialise:0: Test.X^17949373096448478648.X^17949373096448478648[0(fv^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected index 444f3e516..9215a3913 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-003/expected @@ -2,13 +2,13 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.X Prelude.Types.Nat Data.Fin.Fin LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Checking specialisation need for [Prelude.Types.Nat, Data.Fin.Fin]... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] (t := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] ({arg:1} := Data.Fin.Fin) Given a type invocation, traversing arguments: [n] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] (t := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] ({arg:1} := Data.Fin.Fin) Given a type invocation w/o arguments, specialising LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: Test.X Prelude.Types.Nat Data.Fin.Fin LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = Test.X Prelude.Types.Nat Data.Fin.Fin; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^8135581006587252120.X^8135581006587252120 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived X^8135581006587252120.X^8135581006587252120 -LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type: Test.X Prelude.Types.Nat Data.Fin.Fin -LOG deptycheck.test.utils.specialise:0: X^8135581006587252120.X^8135581006587252120[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived Test.X^8135581006587252120.X^8135581006587252120 +LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type Test.X^8135581006587252120.X^8135581006587252120: Test.X Prelude.Types.Nat Data.Fin.Fin +LOG deptycheck.test.utils.specialise:0: Test.X^8135581006587252120.X^8135581006587252120[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index 58a88589d..9d283a2fd 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -2,33 +2,33 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn (Test.X Test.Nt (fromInteger 5) Test.Nn) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn, Test.X Test.Nt (fromInteger 5) Test.Nn]... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:1} := Test.Nn) Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:2} := Test.X Test.Nt (fromInteger 5) Test.Nn) Given a type invocation, traversing arguments: [f, n, {arg:3}] -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (f := Test.Nt) Given a type invocation w/o arguments, specialising +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (f := Test.Nt) Given a non-global type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (n := fromInteger 5) Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:3} := Test.Nn) Given a non-type expr, passing through -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Test.Nt lam^1 lam^2) -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:5} : Test.Nt lam^1) -> Prelude.Types.Nat) -> Type; -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Test.Nt lam^1 lam^2); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^9242445846110651992.Y^9242445846110651992 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : ({arg:5} : Prelude.Types.Nat) -> Type) -> (lam^2 : Prelude.Types.Nat) -> (lam^3 : ({arg:6} : lam^1 lam^2) -> Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3); +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^14421981371219706324.Y^14421981371219706324 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Y^9242445846110651992.Y^9242445846110651992 -LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Test.Nt lam^1 lam^2) -LOG deptycheck.test.utils.specialise:0: Y^9242445846110651992.Y^9242445846110651992[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn, fromInteger 5, Test.Nn] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^14421981371219706324.Y^14421981371219706324 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^14421981371219706324.Y^14421981371219706324: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) +LOG deptycheck.test.utils.specialise:0: Test.Y^14421981371219706324.Y^14421981371219706324[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn', Test.X Data.Fin.Fin (fromInteger 5) Test.Nn']... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:1} := Test.Nn') Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:2} := Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') Given a type invocation, traversing arguments: [f, n, {arg:3}] -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (f := Data.Fin.Fin) Given a type invocation, traversing arguments: [n] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (f := Data.Fin.Fin) Given a type invocation w/o arguments, specialising LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (n := fromInteger 5) Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:3} := Test.Nn') Given a non-type expr, passing through LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:5} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:6} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^17936145782101774282.Y^17936145782101774282 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Y^17936145782101774282.Y^17936145782101774282 -LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) -LOG deptycheck.test.utils.specialise:0: Y^17936145782101774282.Y^17936145782101774282[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^17936145782101774282.Y^17936145782101774282 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^17936145782101774282.Y^17936145782101774282: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) +LOG deptycheck.test.utils.specialise:0: Test.Y^17936145782101774282.Y^17936145782101774282[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected index b721fa702..b91a0d84f 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected @@ -2,22 +2,22 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [Prelude.Types.Nat]... -LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] ({arg:1} := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] ({arg:1} := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Task before normalisation: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] lambdaBody = Prelude.Basics.List Prelude.Types.Nat; LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type name: List^4779069909474151191.List^4779069909474151191 LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Derived List^4779069909474151191.List^4779069909474151191 -LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type: Prelude.Basics.List Prelude.Types.Nat -LOG 0: List^4779069909474151191.List^4779069909474151191 -LOG 0: [Prelude.Types.Nat, Prelude.Basics.List, List^4779069909474151191.List^4779069909474151191] +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Derived Test.List^4779069909474151191.List^4779069909474151191 +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type Test.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +LOG 0: Test.List^4779069909474151191.List^4779069909474151191 +LOG 0: [Prelude.Types.Nat, Prelude.Basics.List, Test.List^4779069909474151191.List^4779069909474151191] LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [Prelude.Types.Nat]... -LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] ({arg:1} := Prelude.Types.Nat) Given a type invocation, traversing arguments: [] +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] ({arg:1} := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Task before normalisation: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] NormaliseTask returned: lambdaTy = Type; LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] lambdaBody = Prelude.Basics.List Prelude.Types.Nat; LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type name: List^4779069909474151191.List^4779069909474151191 -LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Found List^4779069909474151191.List^4779069909474151191 -LOG deptycheck.test.utils.specialise:0: List^4779069909474151191.List^4779069909474151191[] CallGen params: [] +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Found Test.List^4779069909474151191.List^4779069909474151191 +LOG deptycheck.test.utils.specialise:0: Test.List^4779069909474151191.List^4779069909474151191[] CallGen params: [] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/expected index 7b5f132df..332a440ff 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-006/expected @@ -2,3 +2,4 @@ 2/2: Building Test (Test.idr) LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List a LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [a]... +LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Not found any type arguments that can be specialised upon, specialisation impossible. From 5ed60078eb9821d8e7ffc356c426bd123d127d42 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 17:55:00 +0300 Subject: [PATCH 47/81] [ test ] Fix more tests --- .../core/norec part noext 003/expected | 2 +- .../core/norec part noext 004/expected | 2 +- .../core/norec part noext 005/expected | 4 +-- .../core/norec part w_ext 001/expected | 2 +- .../core/norec part w_ext 002/expected | 2 +- .../core/norec part w_ext 003/expected | 4 +-- .../core/norec t-pi--.. noext 003/expected | 2 +- .../core/norec t-pi--.. noext 004/expected | 2 +- .../specialise/01-1 non-ty imm givn/expected | 2 +- .../03-0 non-ty imm-deep-same exist/expected | 2 +- .../03-1 non-ty imm-deep-same gend/expected | 2 +- .../03-2 non-ty imm-deep-same givn/expected | 2 +- .../expected | 2 +- .../expected | 2 +- .../expected | 2 +- .../05-0 non-ty complex exist-both/expected | 26 +++++++++++++++++++ 16 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/expected diff --git a/tests/derivation/core/norec part noext 003/expected b/tests/derivation/core/norec part noext 003/expected index 053ab44b0..1b0cf7bda 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) -LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type: Prelude.Types.Maybe Prelude.Basics.Bool +LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926: Prelude.Types.Maybe Prelude.Basics.Bool Generated values: ----- ----- diff --git a/tests/derivation/core/norec part noext 004/expected b/tests/derivation/core/norec part noext 004/expected index 2bc4b9948..8b2a26bf5 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) -LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair Prelude.Basics.Bool Prelude.Basics.Bool +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type DerivedGen.Pair^2851741735237823607.Pair^2851741735237823607: Builtin.Pair Prelude.Basics.Bool Prelude.Basics.Bool Generated values: ----- ----- diff --git a/tests/derivation/core/norec part noext 005/expected b/tests/derivation/core/norec part noext 005/expected index 4bb54f30d..90102d258 100644 --- a/tests/derivation/core/norec part noext 005/expected +++ b/tests/derivation/core/norec part noext 005/expected @@ -1,7 +1,7 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type: Prelude.Types.Maybe Prelude.Basics.Bool -LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair Prelude.Basics.Bool Prelude.Basics.Bool +LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926: Prelude.Types.Maybe Prelude.Basics.Bool +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type DerivedGen.Pair^2851741735237823607.Pair^2851741735237823607: Builtin.Pair Prelude.Basics.Bool Prelude.Basics.Bool Generated values: ----- ----- diff --git a/tests/derivation/core/norec part w_ext 001/expected b/tests/derivation/core/norec part w_ext 001/expected index ae843080a..e22591703 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) -LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type: Prelude.Types.Maybe String +LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type DerivedGen.Maybe^13367506090110851422.Maybe^13367506090110851422: Prelude.Types.Maybe String Generated values: ----- ----- diff --git a/tests/derivation/core/norec part w_ext 002/expected b/tests/derivation/core/norec part w_ext 002/expected index af24e40c0..f928a418d 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) -LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair String Prelude.Types.Nat +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type DerivedGen.Pair^3343132386166297942.Pair^3343132386166297942: Builtin.Pair String Prelude.Types.Nat Generated values: ----- ----- diff --git a/tests/derivation/core/norec part w_ext 003/expected b/tests/derivation/core/norec part w_ext 003/expected index 0c8855edf..7ce1b8f9e 100644 --- a/tests/derivation/core/norec part w_ext 003/expected +++ b/tests/derivation/core/norec part w_ext 003/expected @@ -1,7 +1,7 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair String (Builtin.Pair Prelude.Types.Nat String) -LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type: Builtin.Pair Prelude.Types.Nat String +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type DerivedGen.Pair^11732935965551223900.Pair^11732935965551223900: Builtin.Pair String (Builtin.Pair Prelude.Types.Nat String) +LOG deptycheck.util.specialisation:10: Builtin.Pair[0, 1] Declared specialised type DerivedGen.Pair^1493320044233062328.Pair^1493320044233062328: Builtin.Pair Prelude.Types.Nat String Generated values: ----- ----- diff --git a/tests/derivation/core/norec t-pi--.. noext 003/expected b/tests/derivation/core/norec t-pi--.. noext 003/expected index 08989cf5d..ff38df45d 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) -LOG deptycheck.util.specialisation:10: Builtin.Equal[0(a), 1(b), 2, 3] Declared specialised type: Builtin.Equal {a = Prelude.Basics.Bool} {b = Prelude.Basics.Bool} lam^0 lam^1 +LOG deptycheck.util.specialisation:10: Builtin.Equal[0(a), 1(b), 2, 3] Declared specialised type DerivedGen.Equal^17761735534830529519.Equal^17761735534830529519: Builtin.Equal {a = Prelude.Basics.Bool} {b = Prelude.Basics.Bool} lam^0 lam^1 Generated values: ----- ----- diff --git a/tests/derivation/core/norec t-pi--.. noext 004/expected b/tests/derivation/core/norec t-pi--.. noext 004/expected index fdf59b482..736e5465d 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) -LOG deptycheck.util.specialisation:10: Builtin.Equal[0(a), 1(b), 2, 3] Declared specialised type: Builtin.Equal {a = Prelude.Basics.Bool} {b = Prelude.Basics.Bool} lam^0 lam^1 +LOG deptycheck.util.specialisation:10: Builtin.Equal[0(a), 1(b), 2, 3] Declared specialised type DerivedGen.Equal^17761735534830529519.Equal^17761735534830529519: Builtin.Equal {a = Prelude.Basics.Bool} {b = Prelude.Basics.Bool} lam^0 lam^1 Generated values: ----- ----- diff --git a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected index cfb36bc9f..0c4051831 100644 --- a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected +++ b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 String +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^120651999565177027.Vect^120651999565177027: Data.Vect.Vect lam^0 String Generated values: ----- ----- diff --git a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected index 41358de0c..f89739b1e 100644 --- a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected +++ b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) Generated values: ----- ----- diff --git a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected index cf16861d8..22f214fc7 100644 --- a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected +++ b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) Generated values: ----- ----- diff --git a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected index 7de5eed58..0272c4095 100644 --- a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected +++ b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) Generated values: ----- ----- diff --git a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected index b90f89ed9..9571e8b69 100644 --- a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected +++ b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) Generated values: ----- ----- diff --git a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected index 6b613607d..068d8c7c4 100644 --- a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected +++ b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) Generated values: ----- ----- diff --git a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected index 10294af85..0f905df79 100644 --- a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected +++ b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected @@ -1,6 +1,6 @@ 1/2: Building RunDerivedGen (RunDerivedGen.idr) 2/2: Building DerivedGen (DerivedGen.idr) -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) Generated values: ----- ----- diff --git a/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/expected b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/expected new file mode 100644 index 000000000..e67ad2e6f --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/expected @@ -0,0 +1,26 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^6814960928365568963.Either^6814960928365568963: Prelude.Types.Either (Data.Nat.LTE lam^0 lam^1) (Data.Nat.LTE lam^2 lam^3) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +MkX [6, 6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 8] +----- +MkX [8, 9, 8, 9, 9, 8, 8, 8, 9, 6] +----- +MkX [10, 7, 11, 11, 11, 7, 11, 1, 11, 2, 7, 10] +----- +MkX [0] +----- +MkX [] +----- +MkX [5, 0, 2, 1, 11, 4, 11, 5, 10, 3, 3, 9] +----- +MkX [0] +----- +MkX [3, 3, 3, 3] +----- +MkX [1, 0] +----- +MkX [4, 4, 8, 3, 16, 5, 7, 4, 7, 0, 5, 8, 12, 1, 3, 17, 4, 12] From 15318ad89801e1ebc4aa99bd292d149f74de1e3d Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 20 Jan 2026 18:13:52 +0300 Subject: [PATCH 48/81] [ test ] Fixup print tests --- .run-to-print-tests | 76 ------------------- .../specialise/01-1 non-ty imm givn/expected | 64 +++++++++------- .../03-0 non-ty imm-deep-same exist/expected | 66 +++++++++------- .../03-1 non-ty imm-deep-same gend/expected | 66 +++++++++------- .../03-2 non-ty imm-deep-same givn/expected | 66 +++++++++------- .../expected | 66 +++++++++------- .../expected | 66 +++++++++------- .../expected | 66 +++++++++------- 8 files changed, 264 insertions(+), 272 deletions(-) delete mode 100755 .run-to-print-tests diff --git a/.run-to-print-tests b/.run-to-print-tests deleted file mode 100755 index 58b2c36b6..000000000 --- a/.run-to-print-tests +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh - -if [ "$1" = "--force" ]; then - FORCE_REWRITE=1 - shift -else - FORCE_REWRITE=0 -fi - -if [ -z "$1" ] || [ -z "$2" ] ; then - echo "Usage: $0 [--force] [ ...]" >&2 - exit 1 -fi - -PRINT_DIR="$1" -shift - -if [ -e "$PRINT_DIR" ]; then - if [ ! -d "$PRINT_DIR" ]; then - echo "Given target '$PRINT_DIR' is not a directory" >&2 - exit 2 - fi -else - echo "Creating a target dir '$PRINT_DIR'..." - mkdir -p "$PRINT_DIR" -fi - -for i in "$@"; do - CURR=$(basename "$i") - - if [ ! -e "$i"/run ]; then - echo "Ignoring '$CURR' since no 'run' file..." - continue - elif [ "$CURR" = "_common" ]; then - if [ ! -e "$PRINT_DIR/$CURR" ]; then - echo "Speial treatment for the '$CURR' dir..." - cp --no-dereference "$i" "$PRINT_DIR" - else - echo "Ignoring '$CURR' dir since it already exists in '$PRINT_DIR'" - fi - continue - fi - - printf "Processing '%s'... " "$CURR" - TARGET="$PRINT_DIR/$CURR" - - if [ -e "$TARGET" ]; then - printf "ALREADY EXISTS, " - if [ "$FORCE_REWRITE" = 1 ]; then - printf "REWRITING... " - else - echo "IGNORING" - continue - fi - fi - - printf "creating target dir... " - mkdir -p "$TARGET" - - printf "copying aux files... " - for j in "run" "derive.ipkg"; do - cp --no-dereference "$i/$j" "$TARGET" - done - - printf "generating main file... " - { - sed -E \ - -e 's/import RunDerivedGen/import Deriving.DepTyCheck.Gen/' \ - -e 's/(%default total)/\1\n\n%language ElabReflection/' \ - -e '/Show|checkedGen/,$d' \ - "$i/DerivedGen.idr" - sed -nE 's/checkedGen :/%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $/p' "$i/DerivedGen.idr" - } > "$TARGET/DerivedGen.idr" - - echo "done" -done diff --git a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected index 76aee4ffa..9508f0f07 100644 --- a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected +++ b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected @@ -1,9 +1,9 @@ 1/1: Building DerivedGen (DerivedGen.idr) LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> (n : Nat) -> Gen MaybeEmpty (X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#1] -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 String -LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] Vect^120651999565177027^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] Vect^120651999565177027^Con^1 - used final order: [#2 (xs), #1 (x)] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^120651999565177027.Vect^120651999565177027: Data.Vect.Vect lam^0 String +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] Vect^120651999565177027^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] Vect^120651999565177027^Con^1 - used final order: [#2 (xs), #1 (x)] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW @@ -37,13 +37,13 @@ LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^1206519995651 , opts = [] , type = mkTy - { name = "[0]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + .$ (var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") } }) , IDef @@ -76,8 +76,10 @@ LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^1206519995651 .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ var "cast" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n")) + .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "n")) .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) @@ -92,8 +94,8 @@ LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^1206519995651 ] , IDef emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .= local { decls = [ IClaim @@ -103,13 +105,13 @@ LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^1206519995651 , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + .$ (var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") } }) , IClaim @@ -119,60 +121,66 @@ LOG deptycheck.derive.least-effort:7: Vect^120651999565177027.Vect^1206519995651 , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + .$ (var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^120651999565177027.Vect^120651999565177027^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ var "Vect^120651999565177027.Vect^120651999565177027^Con^0") - , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + .$ var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^0") + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^120651999565177027.Vect^120651999565177027^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ var "cast" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "len")) + .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "len")) .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse .=> var ">>=" .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Vect^120651999565177027.Vect^120651999565177027^Con^1" + .$ ( var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^1" .! ("len", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] (non-spending)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^") + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^") .$ var "Nil"))) diff --git a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected index 03838dcc4..026b6a0af 100644 --- a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected +++ b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected @@ -1,9 +1,9 @@ 1/1: Building DerivedGen (DerivedGen.idr) LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -31,14 +31,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") } }) , IClaim @@ -106,8 +106,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse .=> var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "n" .$ var "n")) @@ -125,8 +125,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[0, 1]" - [ var "[0, 1]" + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^" @@ -139,14 +139,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IClaim @@ -156,44 +158,49 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "len" .$ var "fv^lam^1")) @@ -203,28 +210,31 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) .! ("fv^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") diff --git a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected index 9ca579b2b..a277d05e4 100644 --- a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected +++ b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected @@ -1,9 +1,9 @@ 1/1: Building DerivedGen (DerivedGen.idr) LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -36,14 +36,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") } }) , IClaim @@ -116,8 +116,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse .=> var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "n" .$ var "n")) @@ -137,8 +137,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[0, 1]" - [ var "[0, 1]" + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^" @@ -151,14 +151,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IClaim @@ -168,44 +170,49 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "len" .$ var "fv^lam^1")) @@ -215,28 +222,31 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) .! ("fv^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") diff --git a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected index 452b624c8..8dd6cad22 100644 --- a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected +++ b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected @@ -1,9 +1,9 @@ 1/1: Building DerivedGen (DerivedGen.idr) LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#1] -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -33,14 +33,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") } }) , IClaim @@ -95,8 +95,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "n" .$ var "n")) @@ -114,8 +114,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[0, 1]" - [ var "[0, 1]" + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^" @@ -128,14 +128,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IClaim @@ -145,44 +147,49 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "len" .$ var "fv^lam^1")) @@ -192,28 +199,31 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) .! ("fv^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") diff --git a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected index bddc88446..8b39026e7 100644 --- a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected +++ b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected @@ -1,9 +1,9 @@ 1/1: Building DerivedGen (DerivedGen.idr) LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#0 (m), #2] -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -35,14 +35,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") } }) , IClaim @@ -113,8 +113,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse .=> var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "n" .$ var "m")) @@ -132,8 +132,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[0, 1]" - [ var "[0, 1]" + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^" @@ -146,14 +146,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IClaim @@ -163,44 +165,49 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "len" .$ var "fv^lam^1")) @@ -210,28 +217,31 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) .! ("fv^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") diff --git a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected index 8e294528d..0811cb639 100644 --- a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected +++ b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected @@ -1,9 +1,9 @@ 1/1: Building DerivedGen (DerivedGen.idr) LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> Gen MaybeEmpty (X n m) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0, 1] MkX - used final order: [#2] -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -35,14 +35,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") } }) , IClaim @@ -98,8 +98,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "n" .$ var "m")) @@ -117,8 +117,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[0, 1]" - [ var "[0, 1]" + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^" @@ -131,14 +131,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IClaim @@ -148,44 +150,49 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "len" .$ var "fv^lam^1")) @@ -195,28 +202,31 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) .! ("fv^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") diff --git a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected index 43d8fbfc9..acf2a9b38 100644 --- a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected @@ -1,9 +1,9 @@ 1/1: Building DerivedGen (DerivedGen.idr) LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (m : Nat ** X n m) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#0 (m), #2] -LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -38,14 +38,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") } }) , IClaim @@ -119,8 +119,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse .=> var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "n" .$ var "m")) @@ -143,8 +143,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[0, 1]" - [ var "[0, 1]" + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^" @@ -157,14 +157,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IClaim @@ -174,44 +176,49 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^lam^0" + .$ var "fv^lam^1") } }) , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] , IDef emptyFC - "<>" - [ var "<>" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") .$ bindVar "fv^lam^1" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" .$ var "^outmost-fuel^" .$ var "len" .$ var "fv^lam^1")) @@ -221,28 +228,31 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) .! ("fv^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + , var "<>" + .$ implicitTrue + .$ implicitTrue + .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) + .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") .$ ( var "::" - .$ ( var "<>" + .$ ( var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^") From 11894217f36f817be68459013dc23391f4861a32 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 21 Jan 2026 16:35:50 +0300 Subject: [PATCH 49/81] [ test ] Add test for obscure spec bug (yet unfixed) --- .../specdata-025-lamCollision/Test.idr | 26 +++++++++++++++++++ .../specdata-025-lamCollision/expected | 1 + .../specdata-025-lamCollision/run | 1 + .../specdata-025-lamCollision/test.ipkg | 1 + 4 files changed, 29 insertions(+) create mode 100644 elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Test.idr create mode 100644 elab-util-extra/tests/specialise-data/specdata-025-lamCollision/expected create mode 120000 elab-util-extra/tests/specialise-data/specdata-025-lamCollision/run create mode 120000 elab-util-extra/tests/specialise-data/specdata-025-lamCollision/test.ipkg diff --git a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Test.idr b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Test.idr new file mode 100644 index 000000000..e11c18bb3 --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Test.idr @@ -0,0 +1,26 @@ +module Test + +import Shared + +%default total + +%language ElabReflection +%logging "specialiseData" 20 +%logging "specialiseData.specDecls" 0 + +data Y : Type -> Type where + MkY : Either Nat a -> Y a + +data X : Type where + MkX : Either Nat (Y $ Either (Fin 5) String) -> X + +Show a => Show (Y a) where + showPrec d $ MkY e = showCon d "MkY" $ showArg e + +Show X where + showPrec d $ MkX xs = showCon d "MkX" $ showArg xs + +%runElab specialiseDataLam' "EitherSpec" $ \a, b => Either Nat (Y (Either (Fin a) b)) + +%runElab specialiseDataLam' "EitherSpec2" $ \a, b => EitherSpec a b + diff --git a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/expected b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/expected new file mode 100644 index 000000000..31e5db7f3 --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/expected @@ -0,0 +1 @@ +1/1: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/run b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/run new file mode 120000 index 000000000..64c976f45 --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/run @@ -0,0 +1 @@ +../_shared/run \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/test.ipkg b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/test.ipkg new file mode 120000 index 000000000..f5e58508a --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/test.ipkg @@ -0,0 +1 @@ +../_shared/test/test.ipkg \ No newline at end of file From 49bf59c933d5fbb6a6768fb21df36f4f23876d8b Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 21 Jan 2026 17:21:04 +0300 Subject: [PATCH 50/81] [ fix ] Prepend type name to type arguments --- elab-util-extra/src/Deriving/SpecialiseData.idr | 2 +- .../specdata-025-lamCollision/Test.idr | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 7cf07cc74..90dd27b2e 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -325,7 +325,7 @@ getTask resultName resultKind resultContent = do let Yes tqArgsNamed = all isNamedArg tqArgs | _ => throwError UnnamedArgInLambdaError -- Create aliases for spec lambda's arguments and perform substitution - let (Element tqArgs tqArgsNamed, tqAlias) = transformArgNames (prependS "fv^") tqArgs + let (Element tqArgs tqArgsNamed, tqAlias) = transformArgNames (prependS "fv^\{resultName}^") tqArgs let tqRet = substituteVariables (fromList $ mapSnd var <$> tqAlias) tqRet let (ttArgs, _) = unPi resultKind -- Check for partial application in spec diff --git a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Test.idr b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Test.idr index e11c18bb3..717474bfc 100644 --- a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Test.idr @@ -5,22 +5,10 @@ import Shared %default total %language ElabReflection -%logging "specialiseData" 20 -%logging "specialiseData.specDecls" 0 data Y : Type -> Type where MkY : Either Nat a -> Y a -data X : Type where - MkX : Either Nat (Y $ Either (Fin 5) String) -> X - -Show a => Show (Y a) where - showPrec d $ MkY e = showCon d "MkY" $ showArg e - -Show X where - showPrec d $ MkX xs = showCon d "MkX" $ showArg xs - %runElab specialiseDataLam' "EitherSpec" $ \a, b => Either Nat (Y (Either (Fin a) b)) %runElab specialiseDataLam' "EitherSpec2" $ \a, b => EitherSpec a b - From 7b8907406323c1a25f5d0ee53acc6132abd8ac0f Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 21 Jan 2026 18:38:20 +0300 Subject: [PATCH 51/81] [ test ] Port specialise-data tests over to symlinks --- elab-util-extra/tests/pack.toml | 4 ---- .../tests/specialise-data/_shared/specdata-shared.ipkg | 5 ----- elab-util-extra/tests/specialise-data/_shared/test/test.ipkg | 2 +- .../tests/specialise-data/specdata-001-listNat/Shared.idr | 1 + .../tests/specialise-data/specdata-001-listNat/expected | 3 ++- .../tests/specialise-data/specdata-002-maybeFin/Shared.idr | 1 + .../tests/specialise-data/specdata-002-maybeFin/expected | 3 ++- .../specialise-data/specdata-003-listVectNat/Shared.idr | 1 + .../tests/specialise-data/specdata-003-listVectNat/expected | 3 ++- .../tests/specialise-data/specdata-004-list/Shared.idr | 1 + .../tests/specialise-data/specdata-004-list/expected | 3 ++- .../tests/specialise-data/specdata-005-vect/Shared.idr | 1 + .../tests/specialise-data/specdata-005-vect/expected | 3 ++- .../tests/specialise-data/specdata-006-eitherVoid/Shared.idr | 1 + .../tests/specialise-data/specdata-006-eitherVoid/expected | 3 ++- .../tests/specialise-data/specdata-007-vectConst/Shared.idr | 1 + .../tests/specialise-data/specdata-007-vectConst/expected | 3 ++- .../tests/specialise-data/specdata-008-depOnArg/Shared.idr | 1 + .../tests/specialise-data/specdata-008-depOnArg/expected | 3 ++- .../tests/specialise-data/specdata-009-finConst/Shared.idr | 1 + .../tests/specialise-data/specdata-009-finConst/expected | 3 ++- .../tests/specialise-data/specdata-010-name/Shared.idr | 1 + .../tests/specialise-data/specdata-010-name/expected | 3 ++- .../tests/specialise-data/specdata-011-nat/Shared.idr | 1 + .../tests/specialise-data/specdata-011-nat/expected | 3 ++- .../tests/specialise-data/specdata-012-void/Shared.idr | 1 + .../tests/specialise-data/specdata-012-void/expected | 3 ++- .../tests/specialise-data/specdata-013-vectSum/Shared.idr | 1 + .../tests/specialise-data/specdata-013-vectSum/expected | 3 ++- .../specdata-014-autoImplicitInArg/Shared.idr | 1 + .../specialise-data/specdata-014-autoImplicitInArg/expected | 3 ++- .../specdata-015-autoImplicitInArg2/Shared.idr | 1 + .../specialise-data/specdata-015-autoImplicitInArg2/expected | 3 ++- .../specialise-data/specdata-016-higherKindedType/Shared.idr | 1 + .../specialise-data/specdata-016-higherKindedType/expected | 3 ++- .../specdata-017-defaultInArgConst/Shared.idr | 1 + .../specialise-data/specdata-017-defaultInArgConst/expected | 3 ++- .../specialise-data/specdata-018-defaultInArgVal/Shared.idr | 1 + .../specialise-data/specdata-018-defaultInArgVal/expected | 3 ++- .../specialise-data/specdata-019-defaultInArgDep/Shared.idr | 1 + .../specialise-data/specdata-019-defaultInArgDep/expected | 3 ++- .../specialise-data/specdata-020-defaultInArgDep2/Shared.idr | 1 + .../specialise-data/specdata-020-defaultInArgDep2/expected | 3 ++- .../tests/specialise-data/specdata-021-eqTy/Shared.idr | 1 + .../tests/specialise-data/specdata-021-eqTy/expected | 3 ++- .../tests/specialise-data/specdata-022-eqVal/Shared.idr | 1 + .../tests/specialise-data/specdata-022-eqVal/expected | 3 ++- .../tests/specialise-data/specdata-023-omegaTy/Shared.idr | 1 + .../tests/specialise-data/specdata-023-omegaTy/expected | 3 ++- .../tests/specialise-data/specdata-024-customNS/Shared.idr | 1 + .../tests/specialise-data/specdata-024-customNS/expected | 3 ++- .../specialise-data/specdata-025-lamCollision/Shared.idr | 1 + .../tests/specialise-data/specdata-025-lamCollision/expected | 3 ++- 53 files changed, 76 insertions(+), 35 deletions(-) delete mode 100644 elab-util-extra/tests/specialise-data/_shared/specdata-shared.ipkg create mode 120000 elab-util-extra/tests/specialise-data/specdata-001-listNat/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-002-maybeFin/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-003-listVectNat/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-004-list/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-005-vect/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-007-vectConst/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-008-depOnArg/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-009-finConst/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-010-name/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-011-nat/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-012-void/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-013-vectSum/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-021-eqTy/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-022-eqVal/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-023-omegaTy/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-024-customNS/Shared.idr create mode 120000 elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Shared.idr diff --git a/elab-util-extra/tests/pack.toml b/elab-util-extra/tests/pack.toml index 60b22c210..0a9d447ab 100644 --- a/elab-util-extra/tests/pack.toml +++ b/elab-util-extra/tests/pack.toml @@ -3,7 +3,3 @@ type = "local" path = "unify-with-compiler/_shared" ipkg = "unifywc-shared.ipkg" -[custom.all.specdata-shared] -type = "local" -path = "specialise-data/_shared" -ipkg = "specdata-shared.ipkg" diff --git a/elab-util-extra/tests/specialise-data/_shared/specdata-shared.ipkg b/elab-util-extra/tests/specialise-data/_shared/specdata-shared.ipkg deleted file mode 100644 index b5552f5bf..000000000 --- a/elab-util-extra/tests/specialise-data/_shared/specdata-shared.ipkg +++ /dev/null @@ -1,5 +0,0 @@ -package specdata-shared - -depends = elab-util-extra - -modules = Shared diff --git a/elab-util-extra/tests/specialise-data/_shared/test/test.ipkg b/elab-util-extra/tests/specialise-data/_shared/test/test.ipkg index effb38a7a..abef6abfd 100644 --- a/elab-util-extra/tests/specialise-data/_shared/test/test.ipkg +++ b/elab-util-extra/tests/specialise-data/_shared/test/test.ipkg @@ -2,5 +2,5 @@ package test opts = "--no-color --console-width 0" -depends = specdata-shared, elab-util-extra +depends = elab-util-extra diff --git a/elab-util-extra/tests/specialise-data/specdata-001-listNat/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-001-listNat/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-001-listNat/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-001-listNat/expected b/elab-util-extra/tests/specialise-data/specdata-001-listNat/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-001-listNat/expected +++ b/elab-util-extra/tests/specialise-data/specdata-001-listNat/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/expected b/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/expected +++ b/elab-util-extra/tests/specialise-data/specdata-002-maybeFin/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/expected b/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/expected +++ b/elab-util-extra/tests/specialise-data/specdata-003-listVectNat/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-004-list/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-004-list/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-004-list/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-004-list/expected b/elab-util-extra/tests/specialise-data/specdata-004-list/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-004-list/expected +++ b/elab-util-extra/tests/specialise-data/specdata-004-list/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-005-vect/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-005-vect/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-005-vect/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-005-vect/expected b/elab-util-extra/tests/specialise-data/specdata-005-vect/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-005-vect/expected +++ b/elab-util-extra/tests/specialise-data/specdata-005-vect/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/expected b/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/expected +++ b/elab-util-extra/tests/specialise-data/specdata-006-eitherVoid/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-007-vectConst/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-007-vectConst/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-007-vectConst/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-007-vectConst/expected b/elab-util-extra/tests/specialise-data/specdata-007-vectConst/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-007-vectConst/expected +++ b/elab-util-extra/tests/specialise-data/specdata-007-vectConst/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/expected b/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/expected +++ b/elab-util-extra/tests/specialise-data/specdata-008-depOnArg/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-009-finConst/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-009-finConst/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-009-finConst/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-009-finConst/expected b/elab-util-extra/tests/specialise-data/specdata-009-finConst/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-009-finConst/expected +++ b/elab-util-extra/tests/specialise-data/specdata-009-finConst/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-010-name/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-010-name/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-010-name/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-010-name/expected b/elab-util-extra/tests/specialise-data/specdata-010-name/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-010-name/expected +++ b/elab-util-extra/tests/specialise-data/specdata-010-name/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-011-nat/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-011-nat/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-011-nat/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-011-nat/expected b/elab-util-extra/tests/specialise-data/specdata-011-nat/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-011-nat/expected +++ b/elab-util-extra/tests/specialise-data/specdata-011-nat/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-012-void/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-012-void/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-012-void/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-012-void/expected b/elab-util-extra/tests/specialise-data/specdata-012-void/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-012-void/expected +++ b/elab-util-extra/tests/specialise-data/specdata-012-void/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-013-vectSum/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-013-vectSum/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-013-vectSum/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-013-vectSum/expected b/elab-util-extra/tests/specialise-data/specdata-013-vectSum/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-013-vectSum/expected +++ b/elab-util-extra/tests/specialise-data/specdata-013-vectSum/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/expected b/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/expected +++ b/elab-util-extra/tests/specialise-data/specdata-014-autoImplicitInArg/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/expected b/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/expected +++ b/elab-util-extra/tests/specialise-data/specdata-015-autoImplicitInArg2/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/expected b/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/expected +++ b/elab-util-extra/tests/specialise-data/specdata-016-higherKindedType/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/expected b/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/expected +++ b/elab-util-extra/tests/specialise-data/specdata-017-defaultInArgConst/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/expected b/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/expected +++ b/elab-util-extra/tests/specialise-data/specdata-018-defaultInArgVal/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/expected b/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/expected +++ b/elab-util-extra/tests/specialise-data/specdata-019-defaultInArgDep/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/expected b/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/expected +++ b/elab-util-extra/tests/specialise-data/specdata-020-defaultInArgDep2/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-021-eqTy/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-021-eqTy/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-021-eqTy/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-021-eqTy/expected b/elab-util-extra/tests/specialise-data/specdata-021-eqTy/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-021-eqTy/expected +++ b/elab-util-extra/tests/specialise-data/specdata-021-eqTy/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-022-eqVal/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-022-eqVal/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-022-eqVal/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-022-eqVal/expected b/elab-util-extra/tests/specialise-data/specdata-022-eqVal/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-022-eqVal/expected +++ b/elab-util-extra/tests/specialise-data/specdata-022-eqVal/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/expected b/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/expected +++ b/elab-util-extra/tests/specialise-data/specdata-023-omegaTy/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-024-customNS/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-024-customNS/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-024-customNS/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-024-customNS/expected b/elab-util-extra/tests/specialise-data/specdata-024-customNS/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-024-customNS/expected +++ b/elab-util-extra/tests/specialise-data/specdata-024-customNS/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/expected b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/expected index 31e5db7f3..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/expected +++ b/elab-util-extra/tests/specialise-data/specdata-025-lamCollision/expected @@ -1 +1,2 @@ -1/1: Building Test (Test.idr) +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) From c2fa8843322e5e06d0ef33a2d33b9fcab08da1fc Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 21 Jan 2026 18:38:40 +0300 Subject: [PATCH 52/81] [ fix ] Allow for dependent lambdas in specialisation --- .../src/Deriving/SpecialiseData.idr | 86 +++++++++++++------ .../specdata-026-depInLambda/Shared.idr | 1 + .../specdata-026-depInLambda/Test.idr | 12 +++ .../specdata-026-depInLambda/expected | 2 + .../specdata-026-depInLambda/run | 1 + .../specdata-026-depInLambda/test.ipkg | 1 + 6 files changed, 78 insertions(+), 25 deletions(-) create mode 120000 elab-util-extra/tests/specialise-data/specdata-026-depInLambda/Shared.idr create mode 100644 elab-util-extra/tests/specialise-data/specdata-026-depInLambda/Test.idr create mode 100644 elab-util-extra/tests/specialise-data/specdata-026-depInLambda/expected create mode 120000 elab-util-extra/tests/specialise-data/specdata-026-depInLambda/run create mode 120000 elab-util-extra/tests/specialise-data/specdata-026-depInLambda/test.ipkg diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 90dd27b2e..1bb3f6d68 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -1050,29 +1050,65 @@ parameters (t : SpecTask) ||| Valid task lambda interface ||| ||| Auto-implemented by any Type or any function that returns Type. -export -interface TaskLambda (t : Type) where - -export -TaskLambda Type - -export -TaskLambda b => TaskLambda (a -> b) - -export -TaskLambda b => TaskLambda (a => b) - -export -TaskLambda b => TaskLambda ({_ : a} -> b) - -export -TaskLambda b => TaskLambda ((0 _ : a) -> b) - -export -TaskLambda b => TaskLambda ((0 _ : a) => b) +-- export +-- interface TaskLambda (t : Type) where +-- +-- export +-- TaskLambda Type +-- +-- %hint +-- export +-- tlImplTy : (a : Type) -> TaskLambda a +-- +-- export +-- TaskLambda b => TaskLambda (a -> b) +-- +-- export +-- TaskLambda b => TaskLambda (a => b) +-- +-- export +-- TaskLambda b => TaskLambda ({_ : a} -> b) +-- +-- export +-- {x : _} -> TaskLambda b => TaskLambda ({default x _ : a} -> b) +-- +-- export +-- TaskLambda b => TaskLambda ((0 _ : a) -> b) +-- +-- export +-- TaskLambda b => TaskLambda ((0 _ : a) => b) +-- +-- export +-- TaskLambda b => TaskLambda ({0 _ : a} -> b) +-- +-- export +-- {0 x : _} -> TaskLambda b => TaskLambda ({default x 0 _ : a} -> b) +-- +-- %hint +-- export +-- tlImpl0 : {a : Type} -> {0 f : a -> Type} -> (x : a) => TaskLambda (f x) => TaskLambda ((x : a) -> f x) +-- +-- export +-- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda (a => f a) +-- +-- export +-- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ({_: a} -> f a) +-- +-- export +-- {x : _} -> {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ({default x _: a} -> f a) +-- +-- export +-- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ((0 _ : a) -> f a) +-- +-- export +-- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ((0 _ : a) => f a) +-- +-- export +-- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ({0 _: a} -> f a) +-- +-- export +-- {0 x : _} -> {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ({default x 0 _: a} -> f a) -export -TaskLambda b => TaskLambda ({0 _ : a} -> b) --------------------------- --- DATA SPECIALISATION --- @@ -1149,7 +1185,7 @@ specialiseDataArgs resultName fvArgs lambdaRHS = ||| ``` export specialiseDataLam : - TaskLambda taskT => + -- TaskLambda taskT => Monad m => Elaboration m => (nsProvider : NamespaceProvider m) => @@ -1186,7 +1222,7 @@ specialiseDataLam'' : (nsProvider : NamespaceProvider m) => (unifier : CanUnify m) => SpecialisationParams => - TaskLambda taskT => + -- TaskLambda taskT => Name -> (0 task: taskT) -> m $ List Decl @@ -1217,7 +1253,7 @@ specialiseDataLam' : (nsProvider : NamespaceProvider m) => (unifier : CanUnify m) => SpecialisationParams => - TaskLambda taskT => + -- TaskLambda taskT => Name -> (0 task: taskT) -> m () diff --git a/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/Test.idr b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/Test.idr new file mode 100644 index 000000000..c4fed899c --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/Test.idr @@ -0,0 +1,12 @@ +module Test + +import Shared + +%default total + +%language ElabReflection + +data X : (n : Nat) -> Fin n -> Type where + MkX : X 5 4 + +%runElab specialiseDataLam' "Y" $ \a, b => X a b diff --git a/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/expected b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/expected new file mode 100644 index 000000000..4a77231de --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/expected @@ -0,0 +1,2 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/run b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/run new file mode 120000 index 000000000..64c976f45 --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/run @@ -0,0 +1 @@ +../_shared/run \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/test.ipkg b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/test.ipkg new file mode 120000 index 000000000..f5e58508a --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-026-depInLambda/test.ipkg @@ -0,0 +1 @@ +../_shared/test/test.ipkg \ No newline at end of file From 0e09258a8d4ec019c1c39a7b776054aa3d4b715a Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 21 Jan 2026 19:14:41 +0300 Subject: [PATCH 53/81] [ test ] Adjust spec-if-needed expecteds for 2e969a89 --- .../utils/specialise-if-needed/spec-if-needed-002/expected | 2 +- .../utils/specialise-if-needed/spec-if-needed-004/expected | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index d9396c811..4accb6e48 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -11,4 +11,4 @@ LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^ LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived Test.X^17949373096448478648.X^17949373096448478648 LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type Test.X^17949373096448478648.X^17949373096448478648: Test.X Prelude.Types.Nat lam^0 -LOG deptycheck.test.utils.specialise:0: Test.X^17949373096448478648.X^17949373096448478648[0(fv^lam^0)] CallGen params: [Prelude.Types.S] +LOG deptycheck.test.utils.specialise:0: Test.X^17949373096448478648.X^17949373096448478648[0(fv^X^17949373096448478648.X^17949373096448478648^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index 9d283a2fd..bcddf3241 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -15,7 +15,7 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^14421981371219706324.Y^14421981371219706324 LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^14421981371219706324.Y^14421981371219706324: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) -LOG deptycheck.test.utils.specialise:0: Test.Y^14421981371219706324.Y^14421981371219706324[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2), 3(fv^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] +LOG deptycheck.test.utils.specialise:0: Test.Y^14421981371219706324.Y^14421981371219706324[0(fv^Y^14421981371219706324.Y^14421981371219706324^lam^0), 1(fv^Y^14421981371219706324.Y^14421981371219706324^lam^1), 2(fv^Y^14421981371219706324.Y^14421981371219706324^lam^2), 3(fv^Y^14421981371219706324.Y^14421981371219706324^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn', Test.X Data.Fin.Fin (fromInteger 5) Test.Nn']... LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising @@ -31,4 +31,4 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^17936145782101774282.Y^17936145782101774282 LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^17936145782101774282.Y^17936145782101774282: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) -LOG deptycheck.test.utils.specialise:0: Test.Y^17936145782101774282.Y^17936145782101774282[0(fv^lam^0), 1(fv^lam^1), 2(fv^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] +LOG deptycheck.test.utils.specialise:0: Test.Y^17936145782101774282.Y^17936145782101774282[0(fv^Y^17936145782101774282.Y^17936145782101774282^lam^0), 1(fv^Y^17936145782101774282.Y^17936145782101774282^lam^1), 2(fv^Y^17936145782101774282.Y^17936145782101774282^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] From 1597497f51b92390bde3ace7492294d68d2bfb15 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Fri, 23 Jan 2026 19:38:55 +0300 Subject: [PATCH 54/81] [ new ] Sketch out the recursive constructor argument finder --- .../src/Deriving/SpecialiseData.idr | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 1bb3f6d68..519ca2556 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -514,6 +514,51 @@ parameters (t : SpecTask) let piInfo = if fromLambda && (fvData.piInfo == ExplicitArg) then ImplicitArg else fvData.piInfo Element (MkArg rig piInfo (Just fvData.name) fvData.type) ItIsNamed + 0 snocLengthEqS : (prev : List a) -> (new : a) -> length (snoc prev new) = S (length prev) + snocLengthEqS [] _ = Refl + snocLengthEqS (x :: xs) y = rewrite snocLengthEqS xs y in Refl + + 0 snocAll : {0 prev : Vect _ _} -> All IsNamedArg prev -> (new : Arg) -> IsNamedArg new -> All IsNamedArg (snoc prev new) + snocAll [] new y = [y] + snocAll (y :: ys) new z = y :: snocAll ys new z + + findRecursiveApps : + Monad m => + (unifier : CanUnify m) => + (SortedMap Name TTImp, (p : List Bool ** Subset (Vect (length p) Arg) (All IsNamedArg))) -> + (Subset Arg IsNamedArg) -> + m (SortedMap Name TTImp, (p : List Bool ** Subset (Vect (length p) Arg) (All IsNamedArg))) + findRecursiveApps (substCast, (prev ** Element prevArgs prevNamed)) (Element thisArg thisArgNamed) = do + let Element ta _ = allL2V t.tqArgs @{t.tqArgsNamed} + let uniTask = MkUniTask {lfv=_} prevArgs thisArg.type {rfv=_} ta t.fullInvocation + ur <- unify uniTask + case ur of + Success ur => do + let typeArgs = t.ttArgs.appsWith @{t.ttArgsNamed} var ur.fullResult + let tyRet = reAppAny (var t.resultName) typeArgs + let mToP = var $ inGenNS t "mToP" + pure + ( substCast + , ( snoc prev True ** + rewrite snocLengthEqS prev True + in Element (snoc prevArgs ?newArg) ?snocAllRhs + ) + ) + _ => do + pure $ + (substCast + , ( snoc prev False ** + rewrite snocLengthEqS prev False + in Element (snoc prevArgs thisArg) + (snocAll prevNamed thisArg thisArgNamed) + ) + ) + + -- record ConExt where + -- constructor MkConExt + -- con : Con + -- isArgRecursive + ||| Generate a specialised constructor mkSpecCon : (params : SpecialisationParams) => From 9bbd3e8c904abe62c15e781a4ad62851f336b428 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 26 Jan 2026 15:37:26 +0300 Subject: [PATCH 55/81] [ new ] Generate separate specialised type signature --- .../src/Deriving/SpecialiseData.idr | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 519ca2556..3994f3bd4 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -554,11 +554,6 @@ parameters (t : SpecTask) ) ) - -- record ConExt where - -- constructor MkConExt - -- con : Con - -- isArgRecursive - ||| Generate a specialised constructor mkSpecCon : (params : SpecialisationParams) => @@ -592,6 +587,21 @@ parameters (t : SpecTask) , cons } `Element` TheyAllAreNamed t.ttArgsNamed consAreNamed + ||| Data declaration. + ||| + ||| This merges constructors `IData` and `MkData`. + public export + iDataLater : + (vis : Visibility) + -> (name : Name) + -> (tycon : TTImp) + -> Decl + iDataLater v n tycon = + IData EmptyFC (specified v) Nothing (MkLater EmptyFC n tycon) + + mkSpecTySig : Decl + mkSpecTySig = iDataLater Public (inGenNS t t.resultName) (piAll type t.ttArgs) + ------------------------------------ --- POLY TO POLY CAST DERIVATION --- ------------------------------------ @@ -1028,6 +1038,7 @@ parameters (t : SpecTask) ||| Generate declarations for given task, unification results, and specialised type specDecls : MonadLog m => UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => m $ List Decl specDecls uniResults specTy = do + let specTySig = mkSpecTySig let specTyDecl = specTy.decl logPoint DetailedDebug "specialiseData.specDecls" [specTy] "specTyDecl : \{show specTyDecl}" @@ -1077,7 +1088,7 @@ parameters (t : SpecTask) , numDecls ] pure $ singleton $ INamespace EmptyFC (MkNS [ show t.resultName ]) $ - specTyDecl :: join + specTySig :: specTyDecl :: join [ mToPImplDecls , mToPDecls , multiInjDecls @@ -1304,3 +1315,10 @@ specialiseDataLam' : m () specialiseDataLam' resultName task = specialiseDataLam'' resultName task >>= declare + +xx : List Decl +xx = `[ + data X : Nat -> Type + + data Y : Nat -> Type +] From e9478e9601258d65db4af8e53e76a236d31835f4 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 26 Jan 2026 17:02:42 +0300 Subject: [PATCH 56/81] [ refactor ] Pre-cache specialised type invocation --- .../src/Deriving/SpecialiseData.idr | 103 +++++++++--------- 1 file changed, 53 insertions(+), 50 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 3994f3bd4..5f4273d28 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -84,6 +84,8 @@ record SpecTask where resultName : Name ||| Invocation of polymorphic type extracted from unification task fullInvocation : TTImp + ||| Invocation of specialised type given default arguents + specInvocation : TTImp ||| Polymorphic type's TypeInfo polyTy : TypeInfo ||| Proof that all the constructors of the polymorphic type are named @@ -147,15 +149,17 @@ export NoNS : Monad m => NamespaceProvider m NoNS = inNS (MkNS []) -||| Prepend namespace into which everything is generated to name -inGenNS : SpecTask -> Name -> Name -inGenNS task n = do - let MkNS tns = task.currentNs +inGenNSImpl : Namespace -> Name -> Name -> Name +inGenNSImpl (MkNS strs) p n = do let newNS = case n of - (NS (MkNS subs) n) => subs - n => [] - NS (MkNS $ newNS ++ show task.resultName :: tns) $ dropNS n + (NS (MkNS subs) n) => subs + n => [] + NS (MkNS $ newNS ++ show p :: strs) $ dropNS n + +||| Prepend namespace into which everything is generated to name +inGenNS : SpecTask -> Name -> Name +inGenNS task = inGenNSImpl task.currentNs task.resultName ||| Given a sequence of arguments, return list of argument name-BindVar pairs argsToBindMap : Foldable f => f Arg -> List (Name, TTImp) @@ -304,6 +308,30 @@ cleanupHoleAutoImplicitsImpl (IAutoApp _ x (Implicit _ _)) = x cleanupHoleAutoImplicitsImpl (INamedApp _ x _ (Implicit _ _)) = x cleanupHoleAutoImplicitsImpl x = x +||| Generate an AnyApp for given Arg, with the argument value either +||| retrieved from the map if present or generated with `fallback` +(.appWith) : + (arg : Arg) -> + (0 _ : IsNamedArg arg) => + (fallback : Name -> TTImp) -> + (argValues : SortedMap Name TTImp) -> + AnyApp +(.appWith) arg@(MkArg _ _ (Just n) _) f argVals = + appArg arg $ fromMaybe (f n) $ lookup n argVals + +||| Generate a List AnyApp for given argument List, +||| with arguments retrieved from the map if present or generated with `fallback` +(.appsWith) : + (args: List Arg) -> + (0 _ : All IsNamedArg args) => + (fallback : Name -> TTImp) -> + (argValues : SortedMap Name TTImp) -> + List AnyApp +(.appsWith) [] _ _ = [] +(.appsWith) (x :: xs) @{_ :: _} f argVals = + x.appWith f argVals :: xs.appsWith f argVals + + ||| Get all the information needed for specialisation from task getTask : Monad m => @@ -344,6 +372,7 @@ getTask resultName resultKind resultContent = do -- Prove all its arguments/constructors/constructor arguments are named let Yes polyTyNamed = areAllTyArgsNamed polyTy | No _ => throwError $ UnnamedArgInPolyTyError polyTy.name + let specInvocation = reAppAny (var (inGenNSImpl currentNs resultName resultName)) $ ttArgs.appsWith @{ttArgsNamed} var empty pure $ MkSpecTask { tqArgs , tqRet @@ -353,33 +382,11 @@ getTask resultName resultKind resultContent = do , currentNs , resultName = snd $ unNS resultName , fullInvocation = tqRet --- TODO: intelligent full invocation + , specInvocation , polyTy , polyTyNamed } -||| Generate an AnyApp for given Arg, with the argument value either -||| retrieved from the map if present or generated with `fallback` -(.appWith) : - (arg : Arg) -> - (0 _ : IsNamedArg arg) => - (fallback : Name -> TTImp) -> - (argValues : SortedMap Name TTImp) -> - AnyApp -(.appWith) arg@(MkArg _ _ (Just n) _) f argVals = - appArg arg $ fromMaybe (f n) $ lookup n argVals - -||| Generate a List AnyApp for given argument List, -||| with arguments retrieved from the map if present or generated with `fallback` -(.appsWith) : - (args: List Arg) -> - (0 _ : All IsNamedArg args) => - (fallback : Name -> TTImp) -> - (argValues : SortedMap Name TTImp) -> - List AnyApp -(.appsWith) [] _ _ = [] -(.appsWith) (x :: xs) @{_ :: _} f argVals = - x.appWith f argVals :: xs.appsWith f argVals - namespace TypeInfoInvoke ||| Returns a full application of the given type constructor ||| with argument values sourced from `argValues` @@ -587,9 +594,9 @@ parameters (t : SpecTask) , cons } `Element` TheyAllAreNamed t.ttArgsNamed consAreNamed - ||| Data declaration. + ||| Data claim. ||| - ||| This merges constructors `IData` and `MkData`. + ||| This merges constructors `IData` and `MkLater`. public export iDataLater : (vis : Visibility) @@ -614,7 +621,7 @@ parameters (t : SpecTask) ||| Generate specialised to polymorphic type conversion function signature mkMToPImplSig : UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TTImp mkMToPImplSig _ mt = - forallMTArgs $ arg (mt.apply var empty) .-> t.fullInvocation + forallMTArgs $ arg t.specInvocation .-> t.fullInvocation ||| Generate specialised to polymorphic type conversion function clause ||| for given constructor @@ -651,7 +658,7 @@ parameters (t : SpecTask) ||| Generate specialised to polymorphic cast signature mkMToPSig : (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TTImp mkMToPSig mt = do - forallMTArgs $ `(Cast ~(mt.apply var empty) ~(t.fullInvocation)) + forallMTArgs $ `(Cast ~(t.specInvocation) ~(t.fullInvocation)) ||| Generate specialised to polymorphic cast declarations mkMToPDecls : (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => List Decl @@ -825,7 +832,7 @@ parameters (t : SpecTask) ||| Decidable equality signatures mkDecEqImplSig : (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TTImp mkDecEqImplSig ti = - let tInv = ti.apply var empty + let tInv = t.specInvocation in forallMTArgs $ piAll `(Dec (Equal {a = ~tInv} {b = ~tInv} x1 x2)) @@ -858,7 +865,7 @@ parameters (t : SpecTask) [ public' "decEqImpl" $ mkDecEqImplSig ti , def "decEqImpl" [ mkDecEqImplClause ] , interfaceHint Public "decEq'" $ forallMTArgs - `(DecEq ~(t.fullInvocation) => DecEq ~(ti.apply var empty)) + `(DecEq ~(t.fullInvocation) => DecEq ~(t.specInvocation)) , def "decEq'" [ `(decEq') .= `((Mk DecEq) ~(var $ inGenNS t "decEqImpl")) ] ] @@ -877,15 +884,15 @@ parameters (t : SpecTask) let mToPImpl = var $ inGenNS t "mToPImpl" [ public' "showImpl" $ forallMTArgs - `(Show ~(t.fullInvocation) => ~(ti.apply var empty) -> String) + `(Show ~(t.fullInvocation) => ~(t.specInvocation) -> String) , def "showImpl" [ `(showImpl x) .= `(show $ ~mToPImpl x) ] , public' "showPrecImpl" $ forallMTArgs - `(Show ~(t.fullInvocation) => Prec -> ~(ti.apply var empty) -> String) + `(Show ~(t.fullInvocation) => Prec -> ~(t.specInvocation) -> String) , def "showPrecImpl" [ `(showPrecImpl p x) .= `(showPrec p $ ~mToPImpl x) ] , interfaceHint Public "show'" $ forallMTArgs $ - `(Show ~(t.fullInvocation) => Show ~(ti.apply var empty)) + `(Show ~(t.fullInvocation) => Show ~(t.specInvocation)) , def "show'" [ `(show') .= `(MkShow showImpl showPrecImpl) ] ] @@ -901,7 +908,7 @@ parameters (t : SpecTask) List Decl mkEqDecls _ ti = do let mToPImpl = var $ inGenNS t "mToPImpl" - let tInv = ti.apply var empty + let tInv = t.specInvocation [ public' "eqImpl" $ forallMTArgs `(Eq ~(t.fullInvocation) => ~tInv -> ~tInv -> Bool) @@ -926,7 +933,7 @@ parameters (t : SpecTask) (0 _ : AllTyArgsNamed mt) => TTImp mkPToMImplSig _ mt = - forallMTArgs $ arg t.fullInvocation .-> mt.apply var empty + forallMTArgs $ arg t.fullInvocation .-> t.specInvocation ||| Generate specialised to polymorphic type conversion function clause ||| for given constructor @@ -962,7 +969,7 @@ parameters (t : SpecTask) ||| Generate specialised to polymorphic cast signature mkPToMSig : (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TTImp mkPToMSig mt = do - forallMTArgs $ `(Cast ~(t.fullInvocation) ~(mt.apply var empty)) + forallMTArgs $ `(Cast ~(t.fullInvocation) ~(t.specInvocation)) ||| Generate specialised to polymorphic cast declarations mkPToMDecls : (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => List Decl @@ -981,7 +988,7 @@ parameters (t : SpecTask) List Decl mkFromStringDecls ti = do let pToMImpl = var $ inGenNS t "pToMImpl" - let tInv = ti.apply var empty + let tInv = t.specInvocation [ public' "fromStringImpl" $ forallMTArgs `(FromString ~(t.fullInvocation) => String -> ~tInv) @@ -1004,7 +1011,7 @@ parameters (t : SpecTask) mkNumDecls ti = do let pToMImpl = var $ inGenNS t "pToMImpl" let mToPImpl = var $ inGenNS t "mToPImpl" - let tInv = ti.apply var empty + let tInv = t.specInvocation [ public' "numImpl" $ forallMTArgs `(Num ~(t.fullInvocation) => Integer -> ~tInv) @@ -1316,9 +1323,5 @@ specialiseDataLam' : specialiseDataLam' resultName task = specialiseDataLam'' resultName task >>= declare -xx : List Decl -xx = `[ - data X : Nat -> Type - - data Y : Nat -> Type -] +il : TTImp +il = local [ iData Public "X.Y" `(Type) [] [], claim MW Public [] "X.z" `(Nat), def "X.z" [ var "X.z" .= `(10) ] ] `(X.z) From d3935c17edf460e728775b9c2445171483124ade Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 27 Jan 2026 14:50:55 +0300 Subject: [PATCH 57/81] [ refactor ] Decouple claims from definitions --- .../src/Deriving/SpecialiseData.idr | 220 +++++++++++------- .../tests/specialise-data/_shared/test.ipkg | 6 + 2 files changed, 141 insertions(+), 85 deletions(-) create mode 100644 elab-util-extra/tests/specialise-data/_shared/test.ipkg diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 5f4273d28..e51a8fe6c 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -607,21 +607,121 @@ parameters (t : SpecTask) IData EmptyFC (specified v) Nothing (MkLater EmptyFC n tycon) mkSpecTySig : Decl - mkSpecTySig = iDataLater Public (inGenNS t t.resultName) (piAll type t.ttArgs) - - ------------------------------------ - --- POLY TO POLY CAST DERIVATION --- - ------------------------------------ + mkSpecTySig = iDataLater Public t.resultName (piAll type t.ttArgs) + ------------------------ + --- CLAIM DERIVATION --- + ------------------------ ||| Generate IPi with implicit type arguments and given return forallMTArgs : TTImp -> TTImp forallMTArgs = flip (foldr pi) $ makeTypeArgM0 . hideExplicitArg <$> t.ttArgs + ||| Generate specialised to polimorphic type conversion function signature + mkMToPImplClaim : Decl + mkMToPImplClaim = public' "mToPImpl" $ forallMTArgs $ arg t.specInvocation .-> t.fullInvocation + + ||| Generate specialised to polimorphic cast signature + mkMToPClaim : Decl + mkMToPClaim = interfaceHint Public "mToP" $ forallMTArgs $ `(Cast ~(t.specInvocation) ~(t.fullInvocation)) + + ||| Decidable equality signatures + mkDecEqImplClaim : Decl + mkDecEqImplClaim = + let tInv = t.specInvocation + in public' "decEqImpl" $ forallMTArgs $ + piAll + `(Dec (Equal {a = ~tInv} {b = ~tInv} x1 x2)) + [ MkArg MW AutoImplicit Nothing `(DecEq ~(t.fullInvocation)) + , MkArg MW ExplicitArg (Just "x1") tInv + , MkArg MW ExplicitArg (Just "x2") tInv + ] + + mkDecEqClaim : Decl + mkDecEqClaim = interfaceHint Public "decEq'" $ forallMTArgs `(DecEq ~(t.fullInvocation) => DecEq ~(t.specInvocation)) + + mkShowClaims : List Decl + mkShowClaims = + [ public' "showImpl" $ + forallMTArgs + `(Show ~(t.fullInvocation) => ~(t.specInvocation) -> String) + , public' "showPrecImpl" $ + forallMTArgs + `(Show ~(t.fullInvocation) => Prec -> ~(t.specInvocation) -> String) + , interfaceHint Public "show'" $ forallMTArgs $ + `(Show ~(t.fullInvocation) => Show ~(t.specInvocation)) + ] + + mkEqClaims : List Decl + mkEqClaims = do + let tInv = t.specInvocation + [ public' "eqImpl" $ forallMTArgs + `(Eq ~(t.fullInvocation) => ~tInv -> ~tInv -> Bool) + , public' "neqImpl" $ forallMTArgs + `(Eq ~(t.fullInvocation) => ~tInv -> ~tInv -> Bool) + , interfaceHint Public "eq'" $ forallMTArgs $ + `(Eq ~(t.fullInvocation) => Eq ~tInv) + ] ||| Generate specialised to polymorphic type conversion function signature - mkMToPImplSig : UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TTImp - mkMToPImplSig _ mt = - forallMTArgs $ arg t.specInvocation .-> t.fullInvocation + mkPToMImplClaim : Decl + mkPToMImplClaim = public' "pToMImpl" $ forallMTArgs $ arg t.fullInvocation .-> t.specInvocation + + ||| Generate specialised to polimorphic cast signature + mkPToMClaim : Decl + mkPToMClaim = + interfaceHint Public "pToM" $ forallMTArgs $ `(Cast ~(t.fullInvocation) ~(t.specInvocation)) + + mkFromStringClaims : List Decl + mkFromStringClaims = do + let tInv = t.specInvocation + [ public' "fromStringImpl" $ + forallMTArgs + `(FromString ~(t.fullInvocation) => String -> ~tInv) + , interfaceHint Public "fromString'" $ + forallMTArgs `(FromString ~(t.fullInvocation) => FromString ~tInv) + ] + + mkNumClaims : List Decl + mkNumClaims = do + let tInv = t.specInvocation + [ public' "numImpl" $ + forallMTArgs + `(Num ~(t.fullInvocation) => Integer -> ~tInv) + , public' "plusImpl" $ + forallMTArgs + `(Num ~(t.fullInvocation) => ~tInv -> ~tInv -> ~tInv) + , public' "starImpl" $ + forallMTArgs + `(Num ~(t.fullInvocation) => ~tInv -> ~tInv -> ~tInv) + , interfaceHint Public "num'" $ + forallMTArgs `(Num ~(t.fullInvocation) => Num ~tInv) + ] + + standardClaims : List Decl + standardClaims = + [ mkMToPImplClaim + , mkMToPClaim + , mkDecEqImplClaim + , mkDecEqClaim + ] ++ join + [ mkShowClaims + , mkEqClaims + ] + + decidedClaims : List Decl + decidedClaims = + [ mkPToMImplClaim + , mkPToMClaim + ] ++ join + [ mkFromStringClaims + , mkNumClaims + ] + + ------------------------------------ + --- POLY TO POLY CAST DERIVATION --- + ------------------------------------ + + ||| Generate specialised to polymorphic type conversion function clause ||| for given constructor @@ -649,10 +749,8 @@ parameters (t : SpecTask) (0 _ : AllTyArgsNamed mt) => List Decl mkMToPImplDecls urs mt = do - let sig = mkMToPImplSig urs mt let clauses = map2UConsN mkMToPImplClause urs mt - [ public' "mToPImpl" sig - , def "mToPImpl" clauses + [ def "mToPImpl" clauses ] ||| Generate specialised to polymorphic cast signature @@ -663,8 +761,7 @@ parameters (t : SpecTask) ||| Generate specialised to polymorphic cast declarations mkMToPDecls : (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => List Decl mkMToPDecls mt = - [ interfaceHint Public "mToP" $ mkMToPSig mt - , def "mToP" [ (var "mToP") .= `(MkCast mToPImpl)] + [ def "mToP" [ (var "mToP") .= `(MkCast mToPImpl)] ] ----------------------------------- @@ -829,18 +926,6 @@ parameters (t : SpecTask) --- DECIDABLE EQUALITY DERIVATION --- ------------------------------------- - ||| Decidable equality signatures - mkDecEqImplSig : (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TTImp - mkDecEqImplSig ti = - let tInv = t.specInvocation - in forallMTArgs $ - piAll - `(Dec (Equal {a = ~tInv} {b = ~tInv} x1 x2)) - [ MkArg MW AutoImplicit Nothing `(DecEq ~(t.fullInvocation)) - , MkArg MW ExplicitArg (Just "x1") tInv - , MkArg MW ExplicitArg (Just "x2") tInv - ] - ||| Decidable equality clause mkDecEqImplClause : Clause mkDecEqImplClause = @@ -854,7 +939,6 @@ parameters (t : SpecTask) x2' = (~mToPImpl x2); in decEq x1' x2') - ||| Derive decidable equality mkDecEqDecls : UniResults -> @@ -862,10 +946,7 @@ parameters (t : SpecTask) (0 _ : AllTyArgsNamed mt) => List Decl mkDecEqDecls _ ti = do - [ public' "decEqImpl" $ mkDecEqImplSig ti - , def "decEqImpl" [ mkDecEqImplClause ] - , interfaceHint Public "decEq'" $ forallMTArgs - `(DecEq ~(t.fullInvocation) => DecEq ~(t.specInvocation)) + [ def "decEqImpl" [ mkDecEqImplClause ] , def "decEq'" [ `(decEq') .= `((Mk DecEq) ~(var $ inGenNS t "decEqImpl")) ] ] @@ -882,17 +963,9 @@ parameters (t : SpecTask) List Decl mkShowDecls _ ti = do let mToPImpl = var $ inGenNS t "mToPImpl" - [ public' "showImpl" $ - forallMTArgs - `(Show ~(t.fullInvocation) => ~(t.specInvocation) -> String) - , def "showImpl" [ `(showImpl x) .= `(show $ ~mToPImpl x) ] - , public' "showPrecImpl" $ - forallMTArgs - `(Show ~(t.fullInvocation) => Prec -> ~(t.specInvocation) -> String) + [ def "showImpl" [ `(showImpl x) .= `(show $ ~mToPImpl x) ] , def "showPrecImpl" [ `(showPrecImpl p x) .= `(showPrec p $ ~mToPImpl x) ] - , interfaceHint Public "show'" $ forallMTArgs $ - `(Show ~(t.fullInvocation) => Show ~(t.specInvocation)) , def "show'" [ `(show') .= `(MkShow showImpl showPrecImpl) ] ] @@ -908,17 +981,8 @@ parameters (t : SpecTask) List Decl mkEqDecls _ ti = do let mToPImpl = var $ inGenNS t "mToPImpl" - let tInv = t.specInvocation - [ public' "eqImpl" $ - forallMTArgs - `(Eq ~(t.fullInvocation) => ~tInv -> ~tInv -> Bool) - , def "eqImpl" [ `(eqImpl x y) .= `((~mToPImpl x) == (~mToPImpl y)) ] - , public' "neqImpl" $ - forallMTArgs - `(Eq ~(t.fullInvocation) => ~tInv -> ~tInv -> Bool) + [ def "eqImpl" [ `(eqImpl x y) .= `((~mToPImpl x) == (~mToPImpl y)) ] , def "neqImpl" [ `(neqImpl x y) .= `((~mToPImpl x) /= (~mToPImpl y)) ] - , interfaceHint Public "eq'" $ forallMTArgs $ - `(Eq ~(t.fullInvocation) => Eq ~tInv) , def "eq'" [ `(eq') .= `(MkEq eqImpl neqImpl) ] ] @@ -960,10 +1024,8 @@ parameters (t : SpecTask) (0 _ : AllTyArgsNamed mt) => List Decl mkPToMImplDecls urs mt = do - let sig = mkPToMImplSig urs mt let clauses = map2UConsN mkPToMImplClause urs mt - [ public' "pToMImpl" sig - , def "pToMImpl" clauses + [ def "pToMImpl" clauses ] ||| Generate specialised to polymorphic cast signature @@ -974,8 +1036,7 @@ parameters (t : SpecTask) ||| Generate specialised to polymorphic cast declarations mkPToMDecls : (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => List Decl mkPToMDecls mt = - [ interfaceHint Public "pToM" $ mkPToMSig mt - , def "pToM" [ (var "pToM") .= `(MkCast pToMImpl)] + [ def "pToM" [ (var "pToM") .= `(MkCast pToMImpl)] ] ----------------------------- @@ -988,14 +1049,8 @@ parameters (t : SpecTask) List Decl mkFromStringDecls ti = do let pToMImpl = var $ inGenNS t "pToMImpl" - let tInv = t.specInvocation - [ public' "fromStringImpl" $ - forallMTArgs - `(FromString ~(t.fullInvocation) => String -> ~tInv) - , def "fromStringImpl" + [ def "fromStringImpl" [ `(fromStringImpl @{fs} s) .= `(~pToMImpl $ fromString @{fs} s) ] - , interfaceHint Public "fromString'" $ - forallMTArgs `(FromString ~(t.fullInvocation) => FromString ~tInv) , def "fromString'" [ `(fromString' @{fs}) .= `(MkFromString $ ~(var $ inGenNS t "fromStringImpl") @{fs}) ] ] @@ -1011,24 +1066,12 @@ parameters (t : SpecTask) mkNumDecls ti = do let pToMImpl = var $ inGenNS t "pToMImpl" let mToPImpl = var $ inGenNS t "mToPImpl" - let tInv = t.specInvocation - [ public' "numImpl" $ - forallMTArgs - `(Num ~(t.fullInvocation) => Integer -> ~tInv) - , def "numImpl" + [ def "numImpl" [ `(numImpl @{fs} s) .= `(~pToMImpl $ Num.fromInteger @{fs} s) ] - , public' "plusImpl" $ - forallMTArgs - `(Num ~(t.fullInvocation) => ~tInv -> ~tInv -> ~tInv) , def "plusImpl" [ `(plusImpl @{fs} a b ) .= `(~pToMImpl $ (+) @{fs} (~mToPImpl a) (~mToPImpl b)) ] - , public' "starImpl" $ - forallMTArgs - `(Num ~(t.fullInvocation) => ~tInv -> ~tInv -> ~tInv) , def "starImpl" [ `(starImpl @{fs} a b ) .= `(~pToMImpl $ (*) @{fs} (~mToPImpl a) (~mToPImpl b)) ] - , interfaceHint Public "num'" $ - forallMTArgs `(Num ~(t.fullInvocation) => Num ~tInv) , def "num'" [ `(num' @{fs}) .= `(MkNum @@ -1045,7 +1088,6 @@ parameters (t : SpecTask) ||| Generate declarations for given task, unification results, and specialised type specDecls : MonadLog m => UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => m $ List Decl specDecls uniResults specTy = do - let specTySig = mkSpecTySig let specTyDecl = specTy.decl logPoint DetailedDebug "specialiseData.specDecls" [specTy] "specTyDecl : \{show specTyDecl}" @@ -1085,18 +1127,25 @@ parameters (t : SpecTask) let numDecls = mkNumDecls specTy logPoint DetailedDebug "specialiseData.specDecls" [specTy] "num : \{show numDecls}" + let anyUndecided = any isUndecided uniResults + let claims = standardClaims ++ if anyUndecided then [] else decidedClaims + let decidedDecls = + [ pToMImplDecls + , pToMDecls + , fromStringDecls + , numDecls + ] let onFull : List Decl = - if any isUndecided uniResults + if anyUndecided then [] - else join - [ pToMImplDecls - , pToMDecls - , fromStringDecls - , numDecls - ] + else join decidedDecls + pure $ singleton $ INamespace EmptyFC (MkNS [ show t.resultName ]) $ - specTySig :: specTyDecl :: join - [ mToPImplDecls + join + [ [ mkSpecTySig ] + , claims + , [ specTyDecl ] + , mToPImplDecls , mToPDecls , multiInjDecls , multiCongDecls @@ -1104,7 +1153,8 @@ parameters (t : SpecTask) , decEqDecls , showDecls , eqDecls - ] ++ onFull + , onFull + ] ------------------------------------- --- SPECIALISATION TASK INTERFACE --- diff --git a/elab-util-extra/tests/specialise-data/_shared/test.ipkg b/elab-util-extra/tests/specialise-data/_shared/test.ipkg new file mode 100644 index 000000000..abef6abfd --- /dev/null +++ b/elab-util-extra/tests/specialise-data/_shared/test.ipkg @@ -0,0 +1,6 @@ +package test + +opts = "--no-color --console-width 0" + +depends = elab-util-extra + From 25d0b07ff43d0dd91f439257f7e84dfeac4492cf Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 29 Jan 2026 13:19:51 +0300 Subject: [PATCH 58/81] [ new ] Implement recursive argument checking - breaks function derivation in recursive spec types --- .../src/Deriving/SpecialiseData.idr | 94 ++++++++++++------- 1 file changed, 62 insertions(+), 32 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index e51a8fe6c..c6451a30c 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -11,6 +11,7 @@ import Data.List.Quantifiers import Data.List1 import Data.Maybe import Data.SnocList +import Data.SnocList.Quantifiers import Data.SortedMap import Data.SortedMap.Dependent import Data.SortedSet @@ -420,6 +421,13 @@ allL2V (x :: xs) @{p :: ps} = do let Element xs' ps' = allL2V xs @{ps} Element (x :: xs') (p :: ps') +record RecursionSearchState where + constructor MkRSS + castRenames : SortedMap Name TTImp + areArgsRecursive : SnocList Bool + argsForUnifier : Subset (Vect (length areArgsRecursive) Arg) (All IsNamedArg) + argsOutput : Subset (SnocList Arg) (All IsNamedArg) + parameters (t : SpecTask) --------------------------- --- CONSTRUCTOR MAPPING --- @@ -529,66 +537,88 @@ parameters (t : SpecTask) snocAll [] new y = [y] snocAll (y :: ys) new z = y :: snocAll ys new z + 0 snocAllL : {0 prev : List _} -> All IsNamedArg prev -> (new : Arg) -> IsNamedArg new -> All IsNamedArg (snoc prev new) + snocAllL [] new y = [y] + snocAllL (y :: ys) new z = y :: snocAllL ys new z + findRecursiveApps : Monad m => - (unifier : CanUnify m) => - (SortedMap Name TTImp, (p : List Bool ** Subset (Vect (length p) Arg) (All IsNamedArg))) -> - (Subset Arg IsNamedArg) -> - m (SortedMap Name TTImp, (p : List Bool ** Subset (Vect (length p) Arg) (All IsNamedArg))) - findRecursiveApps (substCast, (prev ** Element prevArgs prevNamed)) (Element thisArg thisArgNamed) = do + CanUnify m => + RecursionSearchState -> Subset Arg IsNamedArg -> m RecursionSearchState + findRecursiveApps rss (Element thisArg thisArgNamed) = do + let (MkRSS cRenames areArgsRec (Element argsForUni _) (Element argsOut _)) = rss let Element ta _ = allL2V t.tqArgs @{t.tqArgsNamed} - let uniTask = MkUniTask {lfv=_} prevArgs thisArg.type {rfv=_} ta t.fullInvocation + let uniTask = MkUniTask {lfv=_} argsForUni thisArg.type {rfv=_} ta t.fullInvocation ur <- unify uniTask case ur of Success ur => do let typeArgs = t.ttArgs.appsWith @{t.ttArgsNamed} var ur.fullResult let tyRet = reAppAny (var t.resultName) typeArgs let mToP = var $ inGenNS t "mToP" - pure - ( substCast - , ( snoc prev True ** - rewrite snocLengthEqS prev True - in Element (snoc prevArgs ?newArg) ?snocAllRhs - ) - ) + let outPiInfo = (\x => `(cast ~x)) . substituteVariables cRenames <$> thisArg.piInfo + let outType = substituteVariables cRenames tyRet + let Element outArg outArgNamed = + Element (MkArg thisArg.count outPiInfo (Just $ argName thisArg) outType) ItIsNamed + pure $ + MkRSS + (insert (argName thisArg) `(~mToP ~(var $ argName thisArg)) cRenames) + (areArgsRec :< True) + (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) + (Element (argsOut :< outArg) (%search :< outArgNamed)) _ => do + let outPiInfo = substituteVariables cRenames <$> thisArg.piInfo + let outType = substituteVariables cRenames thisArg.type + let Element outArg outArgNamed = + Element (MkArg thisArg.count outPiInfo (Just $ argName thisArg) outType) ItIsNamed pure $ - (substCast - , ( snoc prev False ** - rewrite snocLengthEqS prev False - in Element (snoc prevArgs thisArg) - (snocAll prevNamed thisArg thisArgNamed) - ) - ) + MkRSS + cRenames + (areArgsRec :< False) + (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) + (Element (argsOut :< outArg) (%search :< outArgNamed)) + + snocAll2L : (sl : SnocList Arg) -> (0 _ : All IsNamedArg sl) -> Subset (List Arg) (All IsNamedArg) + snocAll2L [<] [<] = Element [] [] + snocAll2L (sx :< x) (sy :< y) = do + let Element xs ys = snocAll2L sx sy + Element (snoc xs x) (snocAllL ys x y) ||| Generate a specialised constructor mkSpecCon : + Monad m => + CanUnify m => (params : SpecialisationParams) => - (newArgs : _) -> + (newArgs : List Arg) -> (0 _ : All IsNamedArg newArgs) => UnificationResult -> (con : Con) -> (0 _ : ConArgsNamed con) => Nat -> - Subset Con ConArgsNamed + m $ Subset Con ConArgsNamed mkSpecCon newArgs ur pCon cIdx = do + let specArgs = mkSpecArg ur <$> ur.order let Element args allArgs = - pullOut $ mkSpecArg ur <$> ur.order + pullOut specArgs let typeArgs = newArgs.appsWith var ur.fullResult let tyRet = reAppAny (var t.resultName) typeArgs let n = if params.eraseConNames then fromString "\{t.resultName}^Con^\{show cIdx}" else dropNS pCon.name - MkCon + rssRhs <- foldlM findRecursiveApps (MkRSS empty [<] (Element [] []) (Element [<] [<])) specArgs + let (MkRSS cRename argsAreRecursive' _ (Element outArgs' outArgsNamed')) = rssRhs + let Element outArgs outArgsNamed = snocAll2L outArgs' outArgsNamed' + pure $ MkCon { name = inGenNS t $ n - , args - , type = tyRet - } `Element` TheyAreNamed allArgs + , args = outArgs + , type = substituteVariables cRename tyRet + } `Element` TheyAreNamed outArgsNamed ||| Generate a specialised type - mkSpecTy : SpecialisationParams => UniResults -> Subset TypeInfo AllTyArgsNamed + mkSpecTy : Monad m => CanUnify m => SpecialisationParams => UniResults -> m $ Subset TypeInfo AllTyArgsNamed mkSpecTy ur = do - let Element cons consAreNamed = - pullOut $ mapUCons (mkSpecCon @{%search} t.ttArgs @{t.ttArgsNamed}) ur - MkTypeInfo + let 0 _ = t.ttArgsNamed + let muc = mapUCons (mkSpecCon t.ttArgs) ur + specCons <- traverse id muc + let Element cons consAreNamed = pullOut specCons + pure $ MkTypeInfo { name = inGenNS t t.resultName , args = t.ttArgs , cons @@ -1257,7 +1287,7 @@ specialiseDataRaw resultName resultKind resultContent = do task <- getTask resultName resultKind resultContent logPoint DetailedDebug "specialiseData" [task.polyTy] "Specialisation task: \{show task}" uniResults <- sequence $ mapCons task $ unifyCon task - let Element specTy specTyNamed = mkSpecTy task uniResults + Element specTy specTyNamed <- mkSpecTy task uniResults decls <- specDecls task uniResults specTy pure (specTy, decls) From 02e21fa98f8aa8946b80b569faafd31616948a2f Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 29 Jan 2026 15:22:55 +0300 Subject: [PATCH 59/81] [ refactor ] Add type metadata records, update packdb --- .../src/Deriving/SpecialiseData.idr | 153 ++++++++++-------- 1 file changed, 83 insertions(+), 70 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index c6451a30c..c4a11a33e 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -421,6 +421,24 @@ allL2V (x :: xs) @{p :: ps} = do let Element xs' ps' = allL2V xs @{ps} Element (x :: xs') (p :: ps') +0 snocLengthEqS : (prev : List a) -> (new : a) -> length (snoc prev new) = S (length prev) +snocLengthEqS [] _ = Refl +snocLengthEqS (x :: xs) y = rewrite snocLengthEqS xs y in Refl + +0 snocAll : {0 prev : Vect _ _} -> All IsNamedArg prev -> (new : Arg) -> IsNamedArg new -> All IsNamedArg (snoc prev new) +snocAll [] new y = [y] +snocAll (y :: ys) new z = y :: snocAll ys new z + +0 snocAllL : {0 prev : List _} -> All IsNamedArg prev -> (new : Arg) -> IsNamedArg new -> All IsNamedArg (snoc prev new) +snocAllL [] new y = [y] +snocAllL (y :: ys) new z = y :: snocAllL ys new z + +snocAll2L : (sl : SnocList Arg) -> (0 _ : All IsNamedArg sl) -> Subset (List Arg) (All IsNamedArg) +snocAll2L [<] [<] = Element [] [] +snocAll2L (sx :< x) (sy :< y) = do + let Element xs ys = snocAll2L sx sy + Element (snoc xs x) (snocAllL ys x y) + record RecursionSearchState where constructor MkRSS castRenames : SortedMap Name TTImp @@ -428,6 +446,18 @@ record RecursionSearchState where argsForUnifier : Subset (Vect (length areArgsRecursive) Arg) (All IsNamedArg) argsOutput : Subset (SnocList Arg) (All IsNamedArg) +record ArgMeta where + constructor MkAMeta + isResursive : Bool + +record ConMeta where + constructor MkCMeta + argMeta : List ArgMeta + +record TypeMeta where + constructor MkTyMeta + conMeta : List ConMeta + parameters (t : SpecTask) --------------------------- --- CONSTRUCTOR MAPPING --- @@ -468,28 +498,31 @@ parameters (t : SpecTask) (0 _ : ConArgsNamed con) => (mcon : Con) -> (0 _ : ConArgsNamed mcon) => + ConMeta -> Nat -> r) -> UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => + TypeMeta -> List r - map2UConsN f rs mt @{mtp} = do + map2UConsN f rs mt @{mtp} meta = do let p1 = pushIn t.polyTy.cons t.polyTyNamed.tyConArgsNamed let p2 = pushIn mt.cons mtp.tyConArgsNamed - f' 0 p1 p2 rs + f' 0 p1 p2 rs meta.conMeta where f' : Nat -> List (Subset Con ConArgsNamed) -> List (Subset Con ConArgsNamed) -> UniResults -> + List ConMeta -> List r - f' n (Element con _ :: xs) (Element mcon _ :: ys) (Success res :: zs) = - f res mt con mcon n :: f' (S n) xs ys zs - f' n (_ :: xs) ys (_:: zs) = - f' n xs ys zs - f' _ _ _ _ = [] + f' n (Element con _ :: xs) (Element mcon _ :: ys) (Success res :: zs) (meta' :: metas) = + f res mt con mcon meta' n :: f' (S n) xs ys zs metas + f' n (_ :: xs) ys (_:: zs) ms = + f' n xs ys zs ms + f' _ _ _ _ _ = [] ------------------------------- --- CONSTRUCTOR UNIFICATION --- @@ -529,18 +562,6 @@ parameters (t : SpecTask) let piInfo = if fromLambda && (fvData.piInfo == ExplicitArg) then ImplicitArg else fvData.piInfo Element (MkArg rig piInfo (Just fvData.name) fvData.type) ItIsNamed - 0 snocLengthEqS : (prev : List a) -> (new : a) -> length (snoc prev new) = S (length prev) - snocLengthEqS [] _ = Refl - snocLengthEqS (x :: xs) y = rewrite snocLengthEqS xs y in Refl - - 0 snocAll : {0 prev : Vect _ _} -> All IsNamedArg prev -> (new : Arg) -> IsNamedArg new -> All IsNamedArg (snoc prev new) - snocAll [] new y = [y] - snocAll (y :: ys) new z = y :: snocAll ys new z - - 0 snocAllL : {0 prev : List _} -> All IsNamedArg prev -> (new : Arg) -> IsNamedArg new -> All IsNamedArg (snoc prev new) - snocAllL [] new y = [y] - snocAllL (y :: ys) new z = y :: snocAllL ys new z - findRecursiveApps : Monad m => CanUnify m => @@ -577,12 +598,6 @@ parameters (t : SpecTask) (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) (Element (argsOut :< outArg) (%search :< outArgNamed)) - snocAll2L : (sl : SnocList Arg) -> (0 _ : All IsNamedArg sl) -> Subset (List Arg) (All IsNamedArg) - snocAll2L [<] [<] = Element [] [] - snocAll2L (sx :< x) (sy :< y) = do - let Element xs ys = snocAll2L sx sy - Element (snoc xs x) (snocAllL ys x y) - ||| Generate a specialised constructor mkSpecCon : Monad m => @@ -594,7 +609,7 @@ parameters (t : SpecTask) (con : Con) -> (0 _ : ConArgsNamed con) => Nat -> - m $ Subset Con ConArgsNamed + m $ (Subset Con ConArgsNamed, ConMeta) mkSpecCon newArgs ur pCon cIdx = do let specArgs = mkSpecArg ur <$> ur.order let Element args allArgs = @@ -605,36 +620,26 @@ parameters (t : SpecTask) rssRhs <- foldlM findRecursiveApps (MkRSS empty [<] (Element [] []) (Element [<] [<])) specArgs let (MkRSS cRename argsAreRecursive' _ (Element outArgs' outArgsNamed')) = rssRhs let Element outArgs outArgsNamed = snocAll2L outArgs' outArgsNamed' - pure $ MkCon + let conMeta = MkCMeta (MkAMeta <$> toList argsAreRecursive') + pure $ (MkCon { name = inGenNS t $ n , args = outArgs , type = substituteVariables cRename tyRet - } `Element` TheyAreNamed outArgsNamed + } `Element` TheyAreNamed outArgsNamed, conMeta) ||| Generate a specialised type - mkSpecTy : Monad m => CanUnify m => SpecialisationParams => UniResults -> m $ Subset TypeInfo AllTyArgsNamed + mkSpecTy : Monad m => CanUnify m => SpecialisationParams => UniResults -> m $ (Subset TypeInfo AllTyArgsNamed, TypeMeta) mkSpecTy ur = do let 0 _ = t.ttArgsNamed let muc = mapUCons (mkSpecCon t.ttArgs) ur - specCons <- traverse id muc + specConsMeta <- traverse id muc + let (specCons, specMeta) = unzip specConsMeta let Element cons consAreNamed = pullOut specCons - pure $ MkTypeInfo + pure $ (MkTypeInfo { name = inGenNS t t.resultName , args = t.ttArgs , cons - } `Element` TheyAllAreNamed t.ttArgsNamed consAreNamed - - ||| Data claim. - ||| - ||| This merges constructors `IData` and `MkLater`. - public export - iDataLater : - (vis : Visibility) - -> (name : Name) - -> (tycon : TTImp) - -> Decl - iDataLater v n tycon = - IData EmptyFC (specified v) Nothing (MkLater EmptyFC n tycon) + } `Element` TheyAllAreNamed t.ttArgsNamed consAreNamed, MkTyMeta specMeta) mkSpecTySig : Decl mkSpecTySig = iDataLater Public t.resultName (piAll type t.ttArgs) @@ -763,9 +768,10 @@ parameters (t : SpecTask) (0 _ : ConArgsNamed pCon) => (mCon : Con) -> (0 _ : ConArgsNamed mCon) => + ConMeta -> Nat -> Clause - mkMToPImplClause ur _ con mcon _ = + mkMToPImplClause ur _ con mcon meta _ = var "mToPImpl" .$ mcon.apply bindVar (substituteVariables @@ -777,9 +783,10 @@ parameters (t : SpecTask) UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => + TypeMeta -> List Decl - mkMToPImplDecls urs mt = do - let clauses = map2UConsN mkMToPImplClause urs mt + mkMToPImplDecls urs mt meta = do + let clauses = map2UConsN mkMToPImplClause urs mt meta [ def "mToPImpl" clauses ] @@ -808,9 +815,10 @@ parameters (t : SpecTask) (0 _ : ConArgsNamed pCon) => (mCon : Con) -> (0 mn : ConArgsNamed mCon) => + ConMeta -> Nat -> List Decl - mkMultiInjDecl ur mt con mcon i = do + mkMultiInjDecl ur mt con mcon meta i = do let S _ = length mcon.args | _ => [] let n = fromString "mInj\{show i}" @@ -835,9 +843,9 @@ parameters (t : SpecTask) ||| Derive multiinjectivity for all polymorphic constructors that have ||| a specialised equivalent mkMultiInjDecls : - UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => List Decl - mkMultiInjDecls ur specTy = do - join $ map2UConsN mkMultiInjDecl ur specTy + UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TypeMeta -> List Decl + mkMultiInjDecls ur specTy meta = do + join $ map2UConsN mkMultiInjDecl ur specTy meta ---------------------------------- --- MULTICONGRUENCY DERIVATION --- @@ -854,9 +862,10 @@ parameters (t : SpecTask) (0 _ : ConArgsNamed pCon) => (mCon : Con) -> (0 mn : ConArgsNamed mCon) => + ConMeta -> Nat -> List Decl - mkMultiCongDecl ur mt _ mcon i = do + mkMultiCongDecl ur mt _ mcon meta i = do let S _ = length mcon.args | _ => [] let n = fromString "mCong\{show i}" @@ -876,9 +885,9 @@ parameters (t : SpecTask) ||| Derive multicongruency for all specialised constructors mkMultiCongDecls : - UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => List Decl - mkMultiCongDecls ur specTy = do - join $ map2UConsN mkMultiCongDecl ur specTy + UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TypeMeta -> List Decl + mkMultiCongDecls ur specTy meta = do + join $ map2UConsN mkMultiCongDecl ur specTy meta ----------------------------------- --- CAST INJECTIVITY DERIVATION --- @@ -895,9 +904,10 @@ parameters (t : SpecTask) (0 cn : ConArgsNamed con) => (mcon : Con) -> (0 mcn : ConArgsNamed mcon) => + ConMeta -> Nat -> Clause - mkCastInjClause (ta1, tam1) (ta2, tam2) n1 n2 ur mt _ con n = do + mkCastInjClause (ta1, tam1) (ta2, tam2) n1 n2 ur mt _ con meta n = do let 0 _ = conArgsNamed @{mcn} let (Element a1 _, am1) = transformArgNames (prependS "lhs^") con.args let (Element a2 _, am2) = transformArgNames (prependS "rhs^") con.args @@ -921,8 +931,9 @@ parameters (t : SpecTask) UniResults -> (mt : TypeInfo) -> (0 mtp : AllTyArgsNamed mt) => + TypeMeta -> List Decl - mkCastInjDecls ur ti = do + mkCastInjDecls ur ti meta = do let Element prepArgs prf = hideExplicitArgs ti.args @{mtp.tyArgsNamed} let ta1@(Element a1 _, am1) = transformArgNames (prependS "lhs^") prepArgs let ta2@(Element a2 _, am2) = transformArgNames (prependS "rhs^") prepArgs @@ -939,7 +950,7 @@ parameters (t : SpecTask) ~=~ ~(aliasedApp (cast am2) $ mToPImplVar .$ var yVar)) -> ~(var xVar) ~=~ ~(var yVar)) - let castInjImplClauses = map2UConsN (mkCastInjClause (a1, am1) (a2, am2) xVar yVar) ur ti + let castInjImplClauses = map2UConsN (mkCastInjClause (a1, am1) (a2, am2) xVar yVar) ur ti meta let tyArgPairs = cast $ zip ti.argNames ti.argNames [ public' "castInjImpl" $ flip piAll (makeTypeArgM0 <$> a1) $ @@ -1039,9 +1050,10 @@ parameters (t : SpecTask) (0 _ : ConArgsNamed pCon) => (mCon : Con) -> (0 _ : ConArgsNamed mCon) => + ConMeta -> Nat -> Clause - mkPToMImplClause ur _ con mcon _ = + mkPToMImplClause ur _ con mcon meta _ = var "pToMImpl" .$ con.apply bindVar (substituteVariables (fromList $ argsToBindMap $ con.args) <$> ur.fullResult) @@ -1052,9 +1064,10 @@ parameters (t : SpecTask) UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => + TypeMeta -> List Decl - mkPToMImplDecls urs mt = do - let clauses = map2UConsN mkPToMImplClause urs mt + mkPToMImplDecls urs mt meta = do + let clauses = map2UConsN mkPToMImplClause urs mt meta [ def "pToMImpl" clauses ] @@ -1116,24 +1129,24 @@ parameters (t : SpecTask) ------------------------------------ ||| Generate declarations for given task, unification results, and specialised type - specDecls : MonadLog m => UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => m $ List Decl - specDecls uniResults specTy = do + specDecls : MonadLog m => UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TypeMeta -> m $ List Decl + specDecls uniResults specTy specMeta = do let specTyDecl = specTy.decl logPoint DetailedDebug "specialiseData.specDecls" [specTy] "specTyDecl : \{show specTyDecl}" - let mToPImplDecls = mkMToPImplDecls uniResults specTy + let mToPImplDecls = mkMToPImplDecls uniResults specTy specMeta logPoint DetailedDebug "specialiseData.specDecls" [specTy] "mToPImplDecls : \{show mToPImplDecls}" let mToPDecls = mkMToPDecls specTy logPoint DetailedDebug "specialiseData.specDecls" [specTy] "mToP : \{show mToPDecls}" - let multiInjDecls = mkMultiInjDecls uniResults specTy + let multiInjDecls = mkMultiInjDecls uniResults specTy specMeta logPoint DetailedDebug "specialiseData.specDecls" [specTy] "multiInj : \{show multiInjDecls}" - let multiCongDecls = mkMultiCongDecls uniResults specTy + let multiCongDecls = mkMultiCongDecls uniResults specTy specMeta logPoint DetailedDebug "specialiseData.specDecls" [specTy] "multiCong : \{show multiCongDecls}" - let castInjDecls = mkCastInjDecls uniResults specTy + let castInjDecls = mkCastInjDecls uniResults specTy specMeta logPoint DetailedDebug "specialiseData.specDecls" [specTy] "castInj : \{show castInjDecls}" let decEqDecls = mkDecEqDecls uniResults specTy @@ -1145,7 +1158,7 @@ parameters (t : SpecTask) let eqDecls = mkEqDecls uniResults specTy logPoint DetailedDebug "specialiseData.specDecls" [specTy] "Eq : \{show eqDecls}" - let pToMImplDecls = mkPToMImplDecls uniResults specTy + let pToMImplDecls = mkPToMImplDecls uniResults specTy specMeta logPoint DetailedDebug "specialiseData.specDecls" [specTy] "pToMImplDecls : \{show pToMImplDecls}" let pToMDecls = mkPToMDecls specTy @@ -1287,8 +1300,8 @@ specialiseDataRaw resultName resultKind resultContent = do task <- getTask resultName resultKind resultContent logPoint DetailedDebug "specialiseData" [task.polyTy] "Specialisation task: \{show task}" uniResults <- sequence $ mapCons task $ unifyCon task - Element specTy specTyNamed <- mkSpecTy task uniResults - decls <- specDecls task uniResults specTy + (Element specTy specTyNamed, specMeta) <- mkSpecTy task uniResults + decls <- specDecls task uniResults specTy specMeta pure (specTy, decls) export From 3f22c84ffdfaff547ec9f4458766f9409bcaa669 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 3 Feb 2026 13:39:11 +0300 Subject: [PATCH 60/81] [ new ] Implement new cast injectivity prover (WIP) --- .../src/Deriving/SpecialiseData.idr | 290 +++++++++--------- 1 file changed, 152 insertions(+), 138 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index c4a11a33e..a8144aed9 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -442,22 +442,46 @@ snocAll2L (sx :< x) (sy :< y) = do record RecursionSearchState where constructor MkRSS castRenames : SortedMap Name TTImp + pToMRenames : SortedMap Name TTImp areArgsRecursive : SnocList Bool argsForUnifier : Subset (Vect (length areArgsRecursive) Arg) (All IsNamedArg) argsOutput : Subset (SnocList Arg) (All IsNamedArg) record ArgMeta where constructor MkAMeta - isResursive : Bool + isResursiveArg : Bool + +-- Workaround for possible compiler bug +isRA : ArgMeta -> Bool +isRA (MkAMeta True) = True +isRA (MkAMeta False) = False record ConMeta where constructor MkCMeta argMeta : List ArgMeta + mToPRenames : SortedMap Name TTImp + pToMRenames : SortedMap Name TTImp + +hasRecursiveArgs : ConMeta -> Bool +hasRecursiveArgs = any isRA . argMeta + +countRecursiveArgs : ConMeta -> Nat +countRecursiveArgs = count isRA . argMeta + +recursiveArgNames : Con -> ConMeta -> List Name +recursiveArgNames con meta = do + let recursiveArgPairs = List.filter (isRA . snd) $ zip con.args meta.argMeta + fromMaybe "" . name . fst <$> recursiveArgPairs record TypeMeta where constructor MkTyMeta conMeta : List ConMeta +tupleOf : List TTImp -> TTImp +tupleOf [] = `(()) +tupleOf [x] = x +tupleOf (x :: xs) = `(MkPair ~x ~(tupleOf xs)) + parameters (t : SpecTask) --------------------------- --- CONSTRUCTOR MAPPING --- @@ -562,27 +586,51 @@ parameters (t : SpecTask) let piInfo = if fromLambda && (fvData.piInfo == ExplicitArg) then ImplicitArg else fvData.piInfo Element (MkArg rig piInfo (Just fvData.name) fvData.type) ItIsNamed + getVar : TTImp -> Maybe Name + getVar (IVar _ n) = Just n + getVar _ = Nothing + findRecursiveApps : Monad m => CanUnify m => + MonadLog m => + NamesInfoInTypes => RecursionSearchState -> Subset Arg IsNamedArg -> m RecursionSearchState findRecursiveApps rss (Element thisArg thisArgNamed) = do - let (MkRSS cRenames areArgsRec (Element argsForUni _) (Element argsOut _)) = rss + let (MkRSS cRenames pToMRenames areArgsRec (Element argsForUni _) (Element argsOut _)) = rss + let (aLhs, aa) = unAppAny thisArg.type + let True = (length aa /= 0) || (isJust $ lookupType =<< getVar aLhs) + | False => do + let outPiInfo = substituteVariables cRenames <$> thisArg.piInfo + let outType = substituteVariables cRenames thisArg.type + let Element outArg outArgNamed = + Element (MkArg thisArg.count outPiInfo (Just $ argName thisArg) outType) ItIsNamed + pure $ + MkRSS + cRenames + pToMRenames + (areArgsRec :< False) + (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) + (Element (argsOut :< outArg) (%search :< outArgNamed)) let Element ta _ = allL2V t.tqArgs @{t.tqArgsNamed} let uniTask = MkUniTask {lfv=_} argsForUni thisArg.type {rfv=_} ta t.fullInvocation ur <- unify uniTask case ur of Success ur => do let typeArgs = t.ttArgs.appsWith @{t.ttArgsNamed} var ur.fullResult + logPoint DetailedDebug "specialiseData.fra" [] $ show ur.fullResult let tyRet = reAppAny (var t.resultName) typeArgs - let mToP = var $ inGenNS t "mToP" + logPoint DetailedDebug "specialiseData.fra" [] $ show tyRet + let mToPImpl = var $ inGenNS t "mToPImpl" + let pToMImpl = var $ inGenNS t "pToMImpl" let outPiInfo = (\x => `(cast ~x)) . substituteVariables cRenames <$> thisArg.piInfo let outType = substituteVariables cRenames tyRet let Element outArg outArgNamed = Element (MkArg thisArg.count outPiInfo (Just $ argName thisArg) outType) ItIsNamed pure $ MkRSS - (insert (argName thisArg) `(~mToP ~(var $ argName thisArg)) cRenames) + (insert (argName thisArg) `(~mToPImpl ~(var $ argName thisArg)) cRenames) + (insert (argName thisArg) `(~pToMImpl ~(var $ argName thisArg)) pToMRenames) (areArgsRec :< True) (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) (Element (argsOut :< outArg) (%search :< outArgNamed)) @@ -594,6 +642,7 @@ parameters (t : SpecTask) pure $ MkRSS cRenames + pToMRenames (areArgsRec :< False) (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) (Element (argsOut :< outArg) (%search :< outArgNamed)) @@ -602,6 +651,8 @@ parameters (t : SpecTask) mkSpecCon : Monad m => CanUnify m => + MonadLog m => + NamesInfoInTypes => (params : SpecialisationParams) => (newArgs : List Arg) -> (0 _ : All IsNamedArg newArgs) => @@ -617,10 +668,10 @@ parameters (t : SpecTask) let typeArgs = newArgs.appsWith var ur.fullResult let tyRet = reAppAny (var t.resultName) typeArgs let n = if params.eraseConNames then fromString "\{t.resultName}^Con^\{show cIdx}" else dropNS pCon.name - rssRhs <- foldlM findRecursiveApps (MkRSS empty [<] (Element [] []) (Element [<] [<])) specArgs - let (MkRSS cRename argsAreRecursive' _ (Element outArgs' outArgsNamed')) = rssRhs + rssRhs <- foldlM findRecursiveApps (MkRSS empty empty [<] (Element [] []) (Element [<] [<])) specArgs + let (MkRSS cRename pToMRenames argsAreRecursive' _ (Element outArgs' outArgsNamed')) = rssRhs let Element outArgs outArgsNamed = snocAll2L outArgs' outArgsNamed' - let conMeta = MkCMeta (MkAMeta <$> toList argsAreRecursive') + let conMeta = MkCMeta (MkAMeta <$> toList argsAreRecursive') cRename pToMRenames pure $ (MkCon { name = inGenNS t $ n , args = outArgs @@ -628,7 +679,10 @@ parameters (t : SpecTask) } `Element` TheyAreNamed outArgsNamed, conMeta) ||| Generate a specialised type - mkSpecTy : Monad m => CanUnify m => SpecialisationParams => UniResults -> m $ (Subset TypeInfo AllTyArgsNamed, TypeMeta) + mkSpecTy : + Monad m => CanUnify m => MonadLog m => + SpecialisationParams => NamesInfoInTypes => + UniResults -> m $ (Subset TypeInfo AllTyArgsNamed, TypeMeta) mkSpecTy ur = do let 0 _ = t.ttArgsNamed let muc = mapUCons (mkSpecCon t.ttArgs) ur @@ -776,7 +830,7 @@ parameters (t : SpecTask) mcon.apply bindVar (substituteVariables (fromList $ argsToBindMap mcon.args) <$> ur.fullResult) - .= con.apply var ur.fullResult + .= (substituteVariables meta.mToPRenames $ con.apply var ur.fullResult) ||| Generate specialised to polymorphic type conversion function declarations mkMToPImplDecls : @@ -802,96 +856,84 @@ parameters (t : SpecTask) ] ----------------------------------- - --- MULTIINJECTIVITY DERIVATION --- + --- CAST INJECTIVITY DERIVATION --- ----------------------------------- - ||| Derive multiinjectivity for a polymorphic constructor that has a - ||| specialised equivalent - mkMultiInjDecl : - UnificationResult -> - (mt : TypeInfo) -> - (0 _ : AllTyArgsNamed mt) => - (pCon : Con) -> - (0 _ : ConArgsNamed pCon) => - (mCon : Con) -> - (0 mn : ConArgsNamed mCon) => - ConMeta -> - Nat -> - List Decl - mkMultiInjDecl ur mt con mcon meta i = do - let S _ = length mcon.args - | _ => [] - let n = fromString "mInj\{show i}" - let 0 _ = conArgsNamed @{mn} - let Element ourArgs _ = makeArgsImplicit mcon.args - let (Element a1 _, am1) = transformArgNames (prependS "lhs^") ourArgs - let (Element a2 _, am2) = transformArgNames (prependS "rhs^") ourArgs - let lhsCon = substituteVariables (fromList $ mapSnd var <$> am1) $ - con.apply var $ mergeAliases ur.fullResult am1 - let rhsCon = substituteVariables (fromList $ mapSnd var <$> am2) $ - con.apply var $ mergeAliases ur.fullResult am2 - - let eqs = mkEqualsTuple $ zip (pushIn a1 %search) (pushIn a2 %search) - let sig = - flip piAll a1 $ - flip piAll a2 $ `((~(lhsCon) ~=~ ~(rhsCon)) -> ~(eqs)) - let lhs = mkDoubleBinds (cast $ zip a1 a2) (var n) .$ `(Refl) - [ public' n sig - , def n $ singleton $ patClause lhs $ tupleOfN (length mcon.args) `(Refl) + recCastInj : Name -> Name -> TTImp + recCastInj p1 p2 = `(~(var $ inGenNS t $ "castInjImpl") $ trans ~(var p1) $ sym ~(var p2)) + + amrContent : Arg -> ArgMeta -> (Name -> Name) -> TTImp + amrContent a (MkAMeta False) _ = `(_) + amrContent a (MkAMeta True) alias = bindVar $ alias $ fromMaybe "" a.name + + argMaybeRecursive : (Name -> Name) -> (Arg, ArgMeta) -> AnyApp + argMaybeRecursive alias (a@(MkArg count ImplicitArg name type), am) = NamedApp (fromMaybe "" name) $ amrContent a am alias + argMaybeRecursive alias (a@(MkArg count ExplicitArg name type), am) = PosApp $ amrContent a am alias + argMaybeRecursive alias (a@(MkArg count AutoImplicit name type), am) = NamedApp (fromMaybe "" name) $ amrContent a am alias + argMaybeRecursive alias (a@(MkArg count (DefImplicit x) name type), am) = NamedApp (fromMaybe "" name) $ amrContent a am alias + + conOnlyRecursivesAliased : Con -> ConMeta -> (Name -> Name) -> TTImp + conOnlyRecursivesAliased con meta alias = + reAppAny (var con.name) $ argMaybeRecursive alias <$> zip con.args meta.argMeta + + mkArgWithClause : Name -> TTImp -> Clause -> Clause + mkArgWithClause argName existingLhs inner = do + let mToPImpl = var $ inGenNS t "mToPImpl" + let lhsArg = var $ fromString "lhs^\{argName}" + let rhsArg = var $ fromString "rhs^\{argName}" + let p1 = Just (MW, fromString "\{argName}^p1") + let p2 = Just (MW, fromString "\{argName}^p2") + withClause existingLhs MW `(~mToPImpl ~lhsArg) p1 [] [ + withClause `(~existingLhs | _) MW `(~mToPImpl ~rhsArg) p2 [] [inner] ] - ||| Derive multiinjectivity for all polymorphic constructors that have - ||| a specialised equivalent - mkMultiInjDecls : - UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TypeMeta -> List Decl - mkMultiInjDecls ur specTy meta = do - join $ map2UConsN mkMultiInjDecl ur specTy meta + withManyUnders : Nat -> TTImp -> TTImp + withManyUnders 0 x = x + withManyUnders (S n) x = withManyUnders n `(~x | _) + + mkFinalClause : (con : Con) -> (0 _ : ConArgsNamed con) => ConMeta -> Clause + mkFinalClause con meta = do + let emptyCon = con.apply (\_ => `(_)) empty + let recArgAmount = countRecursiveArgs meta + let initialLhs = withManyUnders (2 * recArgAmount) $ + var "castInjImpl" .! ("castInj^x", emptyCon) .! ("castInj^y", emptyCon) .$ var "Refl" + let recNames = recursiveArgNames con meta + let recFns = (\n => recCastInj (fromString "\{n}^p1") (fromString "\{n}^p2")) <$> recNames + withClause initialLhs MW (tupleOf recFns) Nothing [] [ + `(~initialLhs | ~(tupleOfN recArgAmount `(Refl))) .= `(Refl) + ] - ---------------------------------- - --- MULTICONGRUENCY DERIVATION --- - ---------------------------------- + mkInitialLhs : Con -> ConMeta -> TTImp + mkInitialLhs con meta = do + let lhsCon = conOnlyRecursivesAliased con meta $ prependS "lhs^" + let rhsCon = conOnlyRecursivesAliased con meta $ prependS "rhs^" + var "castInjImpl" .! ("castInj^x", lhsCon) .! ("castInj^y", rhsCon) .$ bindVar "prf" - ||| Derive multicongruency for a specialised constructor - ||| - ||| mCongN : forall argsN, argsN'; conN argsN === conN argsN' - mkMultiCongDecl : + mkRecArgClauses : List Name -> TTImp -> Clause -> Clause + mkRecArgClauses [] exLhs inner = inner + mkRecArgClauses (x :: xs) exLhs inner = mkArgWithClause x exLhs $ mkRecArgClauses xs `(~exLhs | _ | _) inner + + mkCastInjClause' : UnificationResult -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => - (pCon : Con) -> - (0 _ : ConArgsNamed pCon) => - (mCon : Con) -> - (0 mn : ConArgsNamed mCon) => + (con : Con) -> + (0 cn : ConArgsNamed con) => + (mcon : Con) -> + (0 mcn : ConArgsNamed mcon) => ConMeta -> Nat -> - List Decl - mkMultiCongDecl ur mt _ mcon meta i = do - let S _ = length mcon.args - | _ => [] - let n = fromString "mCong\{show i}" - let 0 _ = conArgsNamed @{mn} - let Element ourArgs _ = makeArgsImplicit mcon.args - let (Element a1 _, am1) = transformArgNames (prependS "lhs^") ourArgs - let (Element a2 _, am2) = transformArgNames (prependS "rhs^") ourArgs - let lhsCon = mcon.apply var $ mergeAliases ur.fullResult am1 - let rhsCon = mcon.apply var $ mergeAliases ur.fullResult am2 - let eqs = mkEqualsTuple $ zip (pushIn a1 %search) (pushIn a2 %search) - let sig = - flip piAll a1 $ flip piAll a2 $ `(~(eqs) -> (~(lhsCon) ~=~ ~(rhsCon))) - let lhs = mkDoubleBinds (cast $ zip a1 a2) (var n) .$ tupleOfN (length mcon.args) `(Refl) - [ public' n sig - , def n $ singleton $ patClause lhs $ `(Refl) - ] - - ||| Derive multicongruency for all specialised constructors - mkMultiCongDecls : - UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TypeMeta -> List Decl - mkMultiCongDecls ur specTy meta = do - join $ map2UConsN mkMultiCongDecl ur specTy meta - - ----------------------------------- - --- CAST INJECTIVITY DERIVATION --- - ----------------------------------- + Clause + mkCastInjClause' ur mt _ con meta n = do + if not (hasRecursiveArgs meta) + then do + let emptyCon = con.apply (\_ => `(_)) empty + (var "castInjImpl") .! ("castInj^x", emptyCon) .! ("castInj^y", emptyCon) .$ `(Refl) .= `(Refl) + else do + let finalClause = mkFinalClause con meta + let recNames = recursiveArgNames con meta + let initLhs = mkInitialLhs con meta + mkRecArgClauses recNames initLhs finalClause ||| Make a clause for the cast injectivity proof mkCastInjClause : @@ -934,33 +976,26 @@ parameters (t : SpecTask) TypeMeta -> List Decl mkCastInjDecls ur ti meta = do - let Element prepArgs prf = hideExplicitArgs ti.args @{mtp.tyArgsNamed} - let ta1@(Element a1 _, am1) = transformArgNames (prependS "lhs^") prepArgs - let ta2@(Element a2 _, am2) = transformArgNames (prependS "rhs^") prepArgs let xVar = "castInj^x" let yVar = "castInj^y" let mToPVar = var $ inGenNS t "mToP" let mToPImplVar = var $ inGenNS t "mToPImpl" let arg1 = MkArg MW ImplicitArg (Just xVar) $ - ti.apply var $ fromList $ mapSnd var <$> am1 + ti.apply var empty let arg2 = MkArg MW ImplicitArg (Just yVar) $ - ti.apply var $ fromList $ mapSnd var <$> am2 + ti.apply var empty let eqs = - `((~(aliasedApp (cast am1) mToPImplVar .$ var xVar) + `((~(mToPImplVar .$ var xVar) ~=~ - ~(aliasedApp (cast am2) $ mToPImplVar .$ var yVar)) -> + ~(mToPImplVar .$ var yVar)) -> ~(var xVar) ~=~ ~(var yVar)) - let castInjImplClauses = map2UConsN (mkCastInjClause (a1, am1) (a2, am2) xVar yVar) ur ti meta - let tyArgPairs = cast $ zip ti.argNames ti.argNames - [ public' "castInjImpl" $ - flip piAll (makeTypeArgM0 <$> a1) $ - flip piAll (makeTypeArgM0 <$> a2) $ - pi arg1 $ pi arg2 $ eqs + let castInjImplClauses = map2UConsN (mkCastInjClause') ur ti meta + [ claim M0 Public [] "castInjImpl" $ forallMTArgs $ pi arg1 $ pi arg2 $ eqs , def "castInjImpl" castInjImplClauses - , interfaceHint Public "castInj" $ forallMTArgs $ - `(Injective ~(aliasedApp tyArgPairs mToPImplVar)) + , claim M0 Public [Hint False] "castInj" $ forallMTArgs $ + `(Injective ~(mToPImplVar)) , def "castInj" $ singleton $ - aliasedAppBind tyArgPairs `(castInj) .= `(MkInjective castInjImpl) + `(castInj) .= `(MkInjective castInjImpl) ] ------------------------------------- @@ -1057,7 +1092,7 @@ parameters (t : SpecTask) var "pToMImpl" .$ con.apply bindVar (substituteVariables (fromList $ argsToBindMap $ con.args) <$> ur.fullResult) - .= mcon.apply var ur.fullResult + .= (substituteVariables meta.pToMRenames $ mcon.apply var ur.fullResult) ||| Generate specialised to polymorphic type conversion function declarations mkPToMImplDecls : @@ -1132,46 +1167,30 @@ parameters (t : SpecTask) specDecls : MonadLog m => UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TypeMeta -> m $ List Decl specDecls uniResults specTy specMeta = do let specTyDecl = specTy.decl - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "specTyDecl : \{show specTyDecl}" + logPoint DetailedDebug "specialiseData.specDecls.specTy" [specTy] $ show specTyDecl let mToPImplDecls = mkMToPImplDecls uniResults specTy specMeta - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "mToPImplDecls : \{show mToPImplDecls}" + logPoint DetailedDebug "specialiseData.specDecls.mToPImpl" [specTy] $ show mToPImplDecls let mToPDecls = mkMToPDecls specTy - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "mToP : \{show mToPDecls}" - let multiInjDecls = mkMultiInjDecls uniResults specTy specMeta - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "multiInj : \{show multiInjDecls}" - let multiCongDecls = mkMultiCongDecls uniResults specTy specMeta - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "multiCong : \{show multiCongDecls}" + logPoint DetailedDebug "specialiseData.specDecls.mToP" [specTy] $ show mToPDecls let castInjDecls = mkCastInjDecls uniResults specTy specMeta - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "castInj : \{show castInjDecls}" + logPoint DetailedDebug "specialiseData.specDecls.castInj" [specTy] $ show castInjDecls let decEqDecls = mkDecEqDecls uniResults specTy - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "decEq : \{show decEqDecls}" + logPoint DetailedDebug "specialiseData.specDecls.decEq" [specTy] $ show decEqDecls let showDecls = mkShowDecls uniResults specTy - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "Show : \{show showDecls}" + logPoint DetailedDebug "specialiseData.specDecls.show" [specTy] $ show showDecls let eqDecls = mkEqDecls uniResults specTy - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "Eq : \{show eqDecls}" + logPoint DetailedDebug "specialiseData.specDecls.eq" [specTy] $ show eqDecls let pToMImplDecls = mkPToMImplDecls uniResults specTy specMeta - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "pToMImplDecls : \{show pToMImplDecls}" + logPoint DetailedDebug "specialiseData.specDecls.pToMImpl" [specTy] $ show pToMImplDecls let pToMDecls = mkPToMDecls specTy - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "pToM : \{show pToMDecls}" + logPoint DetailedDebug "specialiseData.specDecls.pToM" [specTy] $ show pToMDecls let fromStringDecls = mkFromStringDecls specTy - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "fromString : \{show fromStringDecls}" + logPoint DetailedDebug "specialiseData.specDecls.fromString" [specTy] $ show fromStringDecls let numDecls = mkNumDecls specTy - logPoint DetailedDebug "specialiseData.specDecls" [specTy] - "num : \{show numDecls}" + logPoint DetailedDebug "specialiseData.specDecls.num" [specTy] $ show numDecls let anyUndecided = any isUndecided uniResults let claims = standardClaims ++ if anyUndecided then [] else decidedClaims + logPoint DetailedDebug "specialiseData.specDecls.claims" [specTy] $ show claims let decidedDecls = [ pToMImplDecls , pToMDecls @@ -1190,8 +1209,6 @@ parameters (t : SpecTask) , [ specTyDecl ] , mToPImplDecls , mToPDecls - , multiInjDecls - , multiCongDecls , castInjDecls , decEqDecls , showDecls @@ -1415,6 +1432,3 @@ specialiseDataLam' : m () specialiseDataLam' resultName task = specialiseDataLam'' resultName task >>= declare - -il : TTImp -il = local [ iData Public "X.Y" `(Type) [] [], claim MW Public [] "X.z" `(Nat), def "X.z" [ var "X.z" .= `(10) ] ] `(X.z) From 7b786343d1c86495e52849f7283daa9d95784120 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 4 Feb 2026 15:12:01 +0300 Subject: [PATCH 61/81] [ new ] Give mToPImpl implicit arguments in cast injectivity prover --- elab-util-extra/src/Deriving/SpecialiseData.idr | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index a8144aed9..fe638a169 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -705,6 +705,11 @@ parameters (t : SpecTask) forallMTArgs : TTImp -> TTImp forallMTArgs = flip (foldr pi) $ makeTypeArgM0 . hideExplicitArg <$> t.ttArgs + applyMTArgs : TTImp -> TTImp + applyMTArgs = + flip (foldl (\x,arg => x .! (fromMaybe "" arg.name, var $ fromMaybe "" arg.name))) $ + makeTypeArgM0 . hideExplicitArg <$> t.ttArgs + ||| Generate specialised to polimorphic type conversion function signature mkMToPImplClaim : Decl mkMToPImplClaim = public' "mToPImpl" $ forallMTArgs $ arg t.specInvocation .-> t.fullInvocation @@ -979,7 +984,7 @@ parameters (t : SpecTask) let xVar = "castInj^x" let yVar = "castInj^y" let mToPVar = var $ inGenNS t "mToP" - let mToPImplVar = var $ inGenNS t "mToPImpl" + let mToPImplVar = applyMTArgs $ var $ inGenNS t "mToPImpl" let arg1 = MkArg MW ImplicitArg (Just xVar) $ ti.apply var empty let arg2 = MkArg MW ImplicitArg (Just yVar) $ From e9be7727809bb7d4f8774b050c26b0dd86900973 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 4 Feb 2026 16:55:17 +0300 Subject: [PATCH 62/81] [ new ] Make all specialisation tests pass --- .../src/Deriving/SpecialiseData.idr | 2 +- .../DepTyCheck/Util/Specialisation.idr | 1 + .../print/specialise/00-1 simple/expected | 272 +++++++ .../print/specialise/00-2 simple/expected | 181 +++++ .../specialise/00-3 two-same shallow/expected | 277 +++++++ .../specialise/00-4 two-same deep/expected | 330 ++++++++ .../DerivedGen.idr | 0 .../derive.ipkg | 0 .../specialise/00-5 two-similar/expected | 394 ++++++++++ .../run | 0 .../specialise/01-1 non-ty imm givn/expected | 88 ++- .../specialise/01-2 non-ty imm gend/expected | 247 ++++++ .../specialise/01-3 non-ty imm exist/expected | 235 ++++++ .../02-0 non-ty deep exist/expected | 401 ++++++++++ .../specialise/02-1 non-ty deep gend/expected | 412 ++++++++++ .../specialise/02-2 non-ty deep givn/expected | 308 ++++++++ .../specialise/02-3 two-similar/expected | 521 +++++++++++++ .../03-0 non-ty imm-deep-same exist/expected | 145 ++-- .../03-1 non-ty imm-deep-same gend/expected | 148 ++-- .../03-2 non-ty imm-deep-same givn/expected | 141 ++-- .../expected | 446 +++++++++++ .../expected | 353 +++++++++ .../expected | 149 ++-- .../expected | 460 ++++++++++++ .../expected | 460 ++++++++++++ .../expected | 469 ++++++++++++ .../expected | 137 ++-- .../expected | 150 ++-- .../expected | 363 +++++++++ .../05-0 non-ty complex exist-both/expected | 703 ++++++++++++++++++ .../print/specialise/06-1 ty deeper/expected | 205 ++--- .../run/specialise/00-1 simple/expected | 25 + .../run/specialise/00-2 simple/expected | 25 + .../specialise/00-3 two-same shallow/expected | 25 + .../specialise/00-4 two-same deep/expected | 25 + .../run/specialise/00-5 two-similar/expected | 26 + .../specialise/01-1 non-ty imm givn/expected | 22 +- .../specialise/01-2 non-ty imm gend/expected | 25 + .../specialise/01-3 non-ty imm exist/expected | 25 + .../02-0 non-ty deep exist/expected | 25 + .../specialise/02-1 non-ty deep gend/expected | 25 + .../specialise/02-2 non-ty deep givn/expected | 67 ++ .../run/specialise/02-3 two-similar/expected | 26 + .../03-0 non-ty imm-deep-same exist/expected | 20 +- .../03-1 non-ty imm-deep-same gend/expected | 20 +- .../03-2 non-ty imm-deep-same givn/expected | 18 +- .../expected | 25 + .../expected | 67 ++ .../expected | 18 +- .../expected | 25 + .../expected | 25 + .../expected | 25 + .../expected | 18 +- .../expected | 18 +- .../expected | 67 ++ .../05-0 non-ty complex exist-both/expected | 18 +- .../spec-if-needed-005/expected | 2 +- 57 files changed, 8072 insertions(+), 633 deletions(-) create mode 100644 tests/derivation/least-effort/print/specialise/00-1 simple/expected create mode 100644 tests/derivation/least-effort/print/specialise/00-2 simple/expected create mode 100644 tests/derivation/least-effort/print/specialise/00-3 two-same shallow/expected create mode 100644 tests/derivation/least-effort/print/specialise/00-4 two-same deep/expected rename tests/derivation/least-effort/print/specialise/{00-3 two-similar => 00-5 two-similar}/DerivedGen.idr (100%) rename tests/derivation/least-effort/print/specialise/{00-3 two-similar => 00-5 two-similar}/derive.ipkg (100%) create mode 100644 tests/derivation/least-effort/print/specialise/00-5 two-similar/expected rename tests/derivation/least-effort/print/specialise/{00-3 two-similar => 00-5 two-similar}/run (100%) create mode 100644 tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected create mode 100644 tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected create mode 100644 tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected create mode 100644 tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected create mode 100644 tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/expected create mode 100644 tests/derivation/least-effort/print/specialise/02-3 two-similar/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected create mode 100644 tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected create mode 100644 tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected create mode 100644 tests/derivation/least-effort/run/specialise/00-1 simple/expected create mode 100644 tests/derivation/least-effort/run/specialise/00-2 simple/expected create mode 100644 tests/derivation/least-effort/run/specialise/00-3 two-same shallow/expected create mode 100644 tests/derivation/least-effort/run/specialise/00-4 two-same deep/expected create mode 100644 tests/derivation/least-effort/run/specialise/00-5 two-similar/expected create mode 100644 tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/expected create mode 100644 tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/expected create mode 100644 tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/expected create mode 100644 tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/expected create mode 100644 tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/expected create mode 100644 tests/derivation/least-effort/run/specialise/02-3 two-similar/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/expected create mode 100644 tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/expected diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index fe638a169..2f7581db6 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -373,7 +373,7 @@ getTask resultName resultKind resultContent = do -- Prove all its arguments/constructors/constructor arguments are named let Yes polyTyNamed = areAllTyArgsNamed polyTy | No _ => throwError $ UnnamedArgInPolyTyError polyTy.name - let specInvocation = reAppAny (var (inGenNSImpl currentNs resultName resultName)) $ ttArgs.appsWith @{ttArgsNamed} var empty + let specInvocation = reAppAny (var (inGenNSImpl currentNs (snd $ unNS $ resultName) (snd $ unNS $ resultName))) $ ttArgs.appsWith @{ttArgsNamed} var empty pure $ MkSpecTask { tqArgs , tqRet diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 1b7e044ac..a42a37a13 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -318,6 +318,7 @@ specialiseIfNeeded sig fuel givenParamValues = do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Derived \{show specTy.name}" -- Declare derived type declare specDecls + specTy <- getInfo' specName logPoint Trace "deptycheck.util.specialisation" [sig] "Declared specialised type \{show specTy.name}: \{show lambdaRet}" pure (specTy, []) Just specTy => do diff --git a/tests/derivation/least-effort/print/specialise/00-1 simple/expected b/tests/derivation/least-effort/print/specialise/00-1 simple/expected new file mode 100644 index 000000000..c690758cf --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-1 simple/expected @@ -0,0 +1,272 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.List^4779069909474151191.List^4779069909474151191[] List^4779069909474151191^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^4779069909474151191.List^4779069909474151191[] List^4779069909474151191^Con^1 - used final order: [#0, #1] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^0") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1" + .$ var "{arg:2}" + .$ var "{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 "DerivedGen.List^4779069909474151191.List^4779069909474151191[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.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/specialise/00-2 simple/expected b/tests/derivation/least-effort/print/specialise/00-2 simple/expected new file mode 100644 index 000000000..098bb6814 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-2 simple/expected @@ -0,0 +1,181 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^8984676908526435328.List^8984676908526435328: Prelude.Basics.List String +LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8984676908526435328[] List^8984676908526435328^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8984676908526435328[] List^8984676908526435328^Con^1 - used final order: [#0, #1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg + MW + AutoImplicit + (Just "external^<^prim^.String>[]") + ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ primVal (PrT StringType)) +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^0") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1" + .$ var "{arg:3}" + .$ var "{arg:4}")))) + ] + ] + , 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.List^8984676908526435328.List^8984676908526435328[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328[] (non-dry 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.Gen.ConsRecs.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/specialise/00-3 two-same shallow/expected b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/expected new file mode 100644 index 000000000..67b10240a --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/expected @@ -0,0 +1,277 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0, #1] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.List^4779069909474151191.List^4779069909474151191[] List^4779069909474151191^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^4779069909474151191.List^4779069909474151191[] List^4779069909474151191^Con^1 - used final order: [#0, #1] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}" .$ var "{arg:2}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^0") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1" + .$ var "{arg:3}" + .$ var "{arg:4}")))) + ] + ] + , 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.List^4779069909474151191.List^4779069909474151191[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:5}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.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/specialise/00-4 two-same deep/expected b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/expected new file mode 100644 index 000000000..c3e0854f6 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/expected @@ -0,0 +1,330 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0, #1] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.Y[] MkY - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^4779069909474151191.List^4779069909474151191[] List^4779069909474151191^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^4779069909474151191.List^4779069909474151191[] List^4779069909474151191^Con^1 - used final order: [#0, #1] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.Y" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}" .$ var "{arg:2}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.Y" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkY (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkY" .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^0") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1" + .$ var "{arg:4}" + .$ var "{arg:5}")))) + ] + ] + , 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.List^4779069909474151191.List^4779069909474151191[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:6}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:6}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.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/specialise/00-3 two-similar/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/00-5 two-similar/DerivedGen.idr similarity index 100% rename from tests/derivation/least-effort/print/specialise/00-3 two-similar/DerivedGen.idr rename to tests/derivation/least-effort/print/specialise/00-5 two-similar/DerivedGen.idr diff --git a/tests/derivation/least-effort/print/specialise/00-3 two-similar/derive.ipkg b/tests/derivation/least-effort/print/specialise/00-5 two-similar/derive.ipkg similarity index 100% rename from tests/derivation/least-effort/print/specialise/00-3 two-similar/derive.ipkg rename to tests/derivation/least-effort/print/specialise/00-5 two-similar/derive.ipkg diff --git a/tests/derivation/least-effort/print/specialise/00-5 two-similar/expected b/tests/derivation/least-effort/print/specialise/00-5 two-similar/expected new file mode 100644 index 000000000..856930423 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/00-5 two-similar/expected @@ -0,0 +1,394 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0, #1] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^8984676908526435328.List^8984676908526435328: Prelude.Basics.List String +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +LOG deptycheck.derive.least-effort:7: DerivedGen.List^4779069909474151191.List^4779069909474151191[] List^4779069909474151191^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^4779069909474151191.List^4779069909474151191[] List^4779069909474151191^Con^1 - used final order: [#0, #1] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8984676908526435328[] List^8984676908526435328^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8984676908526435328[] List^8984676908526435328^Con^1 - used final order: [#0, #1] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg + MW + AutoImplicit + (Just "external^<^prim^.String>[]") + ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ primVal (PrT StringType)) +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:2}" .$ var "{arg:3}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^0") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1" + .$ var "{arg:4}" + .$ var "{arg:5}")))) + ] + ] + , 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.List^4779069909474151191.List^4779069909474151191[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^0") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1" + .$ var "{arg:4}" + .$ var "{arg:5}")))) + ] + ] + , 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.List^8984676908526435328.List^8984676908526435328[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:6}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:6}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.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/specialise/00-3 two-similar/run b/tests/derivation/least-effort/print/specialise/00-5 two-similar/run similarity index 100% rename from tests/derivation/least-effort/print/specialise/00-3 two-similar/run rename to tests/derivation/least-effort/print/specialise/00-5 two-similar/run diff --git a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected index 9508f0f07..d0ccca8cd 100644 --- a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected +++ b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected @@ -2,8 +2,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> (n : Nat) -> Gen MaybeEmpty (X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#1] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^120651999565177027.Vect^120651999565177027: Data.Vect.Vect lam^0 String -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] Vect^120651999565177027^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] Vect^120651999565177027^Con^1 - used final order: [#2 (xs), #1 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^Vect^120651999565177027.Vect^120651999565177027^lam^0)] Vect^120651999565177027^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^Vect^120651999565177027.Vect^120651999565177027^lam^0)] Vect^120651999565177027^Con^1 - used final order: [#2 (xs), #1 (x)] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") .=> MkArg MW @@ -25,9 +25,7 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:2}") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:2}") } }) , IClaim @@ -40,10 +38,11 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") } }) , IDef @@ -77,9 +76,7 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 .$ ( var ">>=" .$ ( var "map" .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP") - .$ ( var "[0]" - .$ var "^outmost-fuel^" - .$ var "n")) + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n")) .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) @@ -95,7 +92,9 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 , IDef emptyFC "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -108,10 +107,11 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") } }) , IClaim @@ -124,18 +124,17 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") } }) , IDef emptyFC "<>" - [ var "<>" - .$ bindVar "^cons_fuel^" - .$ var "Prelude.Types.Z" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^0 (orders)")) .$ ( var "Prelude.pure" @@ -152,11 +151,7 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^1 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP") - .$ ( var "[0]" - .$ var "^outmost-fuel^" - .$ var "len")) + .$ (var "[0]" .$ var "^cons_fuel^" .$ var "len") .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse .=> var ">>=" .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") @@ -171,19 +166,40 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^lam^0)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^") - .$ var "Nil"))) + 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.Vect^120651999565177027.Vect^120651999565177027[0(fv^Vect^120651999565177027.Vect^120651999565177027^lam^0)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^120651999565177027.Vect^120651999565177027[0(fv^Vect^120651999565177027.Vect^120651999565177027^lam^0)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } } ] ] diff --git a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected new file mode 100644 index 000000000..32454e353 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected @@ -0,0 +1,247 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty (n : Nat ** X n) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#1] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^120651999565177027.Vect^120651999565177027: Data.Vect.Vect lam^0 String +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[] Vect^120651999565177027^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[] Vect^120651999565177027^Con^1 - used final order: [#2 (xs), #1 (x)] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg + MW + AutoImplicit + (Just "external^<^prim^.String>[]") + ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ primVal (PrT StringType)) +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:2}")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") + (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) + } + }) + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:2}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP" .$ var "inv") + ] + }) + .$ (var "[]" .$ var "^outmost-fuel^"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:3}")) + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") + (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") + (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^0")) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "len" .$ bindVar "xs" + .= var ">>=" + .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^1" + .! ("len", implicitTrue) + .$ var "x" + .$ var "xs"))) + ] + })) + ] + ] + , 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.Vect^120651999565177027.Vect^120651999565177027[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027[] (non-dry 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.Gen.ConsRecs.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/specialise/01-3 non-ty imm exist/expected b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected new file mode 100644 index 000000000..be729bebe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected @@ -0,0 +1,235 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#1] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^120651999565177027.Vect^120651999565177027: Data.Vect.Vect lam^0 String +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[] Vect^120651999565177027^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^120651999565177027[] Vect^120651999565177027^Con^1 - used final order: [#2 (xs), #1 (x)] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg + MW + AutoImplicit + (Just "external^<^prim^.String>[]") + ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ primVal (PrT StringType)) +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") + (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) + } + }) + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP" .$ var "inv") + ] + }) + .$ (var "[]" .$ var "^outmost-fuel^"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}") + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") + (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") + (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^0")) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "len" .$ bindVar "xs" + .= var ">>=" + .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027^Con^1" + .! ("len", implicitTrue) + .$ var "x" + .$ var "xs"))) + ] + })) + ] + ] + , 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.Vect^120651999565177027.Vect^120651999565177027[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^120651999565177027.Vect^120651999565177027[] (non-dry 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.Gen.ConsRecs.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/specialise/02-0 non-ty deep exist/expected b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected new file mode 100644 index 000000000..418c9df86 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected @@ -0,0 +1,401 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:1}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^0" + .! ( "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + , var "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + ))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var ">>=" + .$ ( var "[0]" + .$ var "^cons_fuel^" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" + .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) + .$ var "{arg:2}" + .$ var "{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 + "DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected new file mode 100644 index 000000000..31eca6995 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected @@ -0,0 +1,412 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}"))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^0" + .! ( "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + , var "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + ))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var ">>=" + .$ ( var "[0]" + .$ var "^cons_fuel^" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" + .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) + .$ var "{arg:3}" + .$ var "{arg:4}")))) + ] + ] + , 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.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:5}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:6}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:6}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/expected b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/expected new file mode 100644 index 000000000..d2da6226f --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/expected @@ -0,0 +1,308 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#1] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^0" + .! ( "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + , var "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + ))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var ">>=" + .$ ( var "[0]" + .$ var "^cons_fuel^" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" + .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) + .$ var "{arg:3}" + .$ var "{arg:4}")))) + ] + ] + , 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.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected b/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected new file mode 100644 index 000000000..27979620e --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected @@ -0,0 +1,521 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#1, #0 (n), #2] +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^8984676908526435328.List^8984676908526435328: Prelude.Basics.List String +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8984676908526435328[] List^8984676908526435328^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8984676908526435328[] List^8984676908526435328^Con^1 - used final order: [#0, #1] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg + MW + AutoImplicit + (Just "external^<^prim^.String>[]") + ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ primVal (PrT StringType)) +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}" .$ var "{arg:3}"))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^0" + .! ( "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + , var "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + ))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^List^12757670414100080037.List^12757670414100080037^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var ">>=" + .$ ( var "[0]" + .$ var "^cons_fuel^" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" + .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) + .$ var "{arg:4}" + .$ var "{arg:5}")))) + ] + ] + , 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.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:6}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:6}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^0") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1" + .$ var "{arg:4}" + .$ var "{arg:5}")))) + ] + ] + , 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.List^8984676908526435328.List^8984676908526435328[] (dry fuel)")) + .$ (var "<>" .$ var "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:7}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:7}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected index 026b6a0af..19a52a33d 100644 --- a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected +++ b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected @@ -2,8 +2,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -34,11 +34,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -59,8 +61,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = - mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) , IClaim (MkIClaimData @@ -128,8 +129,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "[0, 1]" [ var "[0, 1]" .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" - .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -142,13 +143,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -161,13 +162,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IDef @@ -176,17 +177,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef emptyFC @@ -194,51 +192,67 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "len" - .$ var "fv^lam^1")) + .$ ( var "[0, 1]" + .$ var "^cons_fuel^" + .$ var "len" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse .=> var ">>=" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) - .! ("fv^lam^1", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ var "Nil"))) + 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.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } } ] , IDef @@ -257,9 +271,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -272,9 +284,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef @@ -327,8 +337,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: emptyFC "weight^Prelude.Types.Nat" [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") - .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") ] , IDef emptyFC @@ -347,9 +356,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IClaim @@ -363,9 +370,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IDef @@ -374,9 +379,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ 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 "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ (var "Data.Fin.FZ" .! ("k", var "k"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef diff --git a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected index a277d05e4..aa00df555 100644 --- a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected +++ b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected @@ -2,8 +2,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -25,8 +25,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "Builtin.DPair.DPair" .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}")) + .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) } }) , IClaim @@ -39,11 +38,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -64,8 +65,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = - mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) , IClaim (MkIClaimData @@ -140,8 +140,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "[0, 1]" [ var "[0, 1]" .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" - .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -154,13 +154,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -173,13 +173,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IDef @@ -188,17 +188,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef emptyFC @@ -206,51 +203,67 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "len" - .$ var "fv^lam^1")) + .$ ( var "[0, 1]" + .$ var "^cons_fuel^" + .$ var "len" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse .=> var ">>=" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) - .! ("fv^lam^1", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ var "Nil"))) + 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.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } } ] , IDef @@ -269,9 +282,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -284,9 +295,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef @@ -339,8 +348,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: emptyFC "weight^Prelude.Types.Nat" [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") - .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") ] , IDef emptyFC @@ -359,9 +367,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IClaim @@ -375,9 +381,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IDef @@ -386,9 +390,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ 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 "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ (var "Data.Fin.FZ" .! ("k", var "k"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef diff --git a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected index 8dd6cad22..be08392aa 100644 --- a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected +++ b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected @@ -2,8 +2,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#1] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -21,9 +21,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:1}") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") } }) , IClaim @@ -36,11 +34,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -48,8 +48,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = - mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) , IClaim (MkIClaimData @@ -117,8 +116,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "[0, 1]" [ var "[0, 1]" .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" - .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -131,13 +130,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -150,13 +149,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IDef @@ -165,17 +164,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef emptyFC @@ -183,59 +179,74 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "len" - .$ var "fv^lam^1")) + .$ ( var "[0, 1]" + .$ var "^cons_fuel^" + .$ var "len" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse .=> var ">>=" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) - .! ("fv^lam^1", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ var "Nil"))) + 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.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } } ] , IDef emptyFC "weight^Prelude.Types.Nat" [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") - .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") ] , IDef emptyFC @@ -254,9 +265,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IClaim @@ -270,9 +279,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IDef @@ -281,9 +288,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ 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 "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ (var "Data.Fin.FZ" .! ("k", var "k"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef diff --git a/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected new file mode 100644 index 000000000..7b88ce223 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected @@ -0,0 +1,446 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (m), #2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "the" + .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ ( var "[1]" + .$ var "^outmost-fuel^" + .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:1}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:1}") + ] + }))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[1]" + [ var "[1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ( "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + , var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + )))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "[1]" + .$ var "^cons_fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "len" .$ bindVar "xs" + .= var ">>=" + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) + .$ var "x" + .$ var "xs"))) + ] + })) + ] + ] + , 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.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected new file mode 100644 index 000000000..b70912029 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected @@ -0,0 +1,353 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (m : Nat) -> Gen MaybeEmpty (X m) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "m" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ (var "[1]" .$ var "^outmost-fuel^" .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:2}") + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[1]" + [ var "[1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ( "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + , var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + )))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "[1]" + .$ var "^cons_fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "len" .$ bindVar "xs" + .= var ">>=" + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) + .$ var "x" + .$ var "xs"))) + ] + })) + ] + ] + , 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.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected index 8b39026e7..44384286a 100644 --- a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected +++ b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected @@ -2,8 +2,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#0 (m), #2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -23,9 +23,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:1}") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") } }) , IClaim @@ -38,11 +36,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -63,8 +63,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = - mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) , IClaim (MkIClaimData @@ -135,8 +134,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "[0, 1]" [ var "[0, 1]" .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" - .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -149,13 +148,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -168,13 +167,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IDef @@ -183,17 +182,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef emptyFC @@ -201,51 +197,67 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "len" - .$ var "fv^lam^1")) + .$ ( var "[0, 1]" + .$ var "^cons_fuel^" + .$ var "len" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse .=> var ">>=" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) - .! ("fv^lam^1", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ var "Nil"))) + 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.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } } ] , IDef @@ -264,9 +276,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -279,9 +289,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef @@ -334,8 +342,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: emptyFC "weight^Prelude.Types.Nat" [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") - .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") ] , IDef emptyFC @@ -354,9 +361,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IClaim @@ -370,9 +375,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IDef @@ -381,9 +384,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ 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 "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ (var "Data.Fin.FZ" .! ("k", var "k"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef diff --git a/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected new file mode 100644 index 000000000..d4e68b4e0 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected @@ -0,0 +1,460 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (m : Nat ** X m) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (m), #2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "the" + .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ ( var "[1]" + .$ var "^outmost-fuel^" + .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:2}")) + ] + }))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[1]" + [ var "[1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ( "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + , var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + )))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "[1]" + .$ var "^cons_fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "len" .$ bindVar "xs" + .= var ">>=" + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) + .$ var "x" + .$ var "xs"))) + ] + })) + ] + ] + , 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.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected new file mode 100644 index 000000000..baffa76a0 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected @@ -0,0 +1,460 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (m), #2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "the" + .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ ( var "[1]" + .$ var "^outmost-fuel^" + .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:2}")) + ] + }))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[1]" + [ var "[1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ( "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + , var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + )))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "[1]" + .$ var "^cons_fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "len" .$ bindVar "xs" + .= var ">>=" + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) + .$ var "x" + .$ var "xs"))) + ] + })) + ] + ] + , 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.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected new file mode 100644 index 000000000..c8e52412f --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected @@ -0,0 +1,469 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (m : Nat ** X n m)) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (m), #2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}"))) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}"))) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "the" + .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ ( var "[1]" + .$ var "^outmost-fuel^" + .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:3}"))) + ] + }))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[1]" + [ var "[1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ( "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + , var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + )))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "[1]" + .$ var "^cons_fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "len" .$ bindVar "xs" + .= var ">>=" + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) + .$ var "x" + .$ var "xs"))) + ] + })) + ] + ] + , 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.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected index 0811cb639..a43c04c78 100644 --- a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected +++ b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected @@ -2,8 +2,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> (m : Nat) -> Gen MaybeEmpty (X n m) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0, 1] MkX - used final order: [#2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -38,11 +38,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -50,8 +52,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = - mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) , IClaim (MkIClaimData @@ -120,8 +121,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "[0, 1]" [ var "[0, 1]" .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" - .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -134,13 +135,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -153,13 +154,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IDef @@ -168,17 +169,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef emptyFC @@ -186,59 +184,74 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "len" - .$ var "fv^lam^1")) + .$ ( var "[0, 1]" + .$ var "^cons_fuel^" + .$ var "len" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse .=> var ">>=" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) - .! ("fv^lam^1", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ var "Nil"))) + 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.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } } ] , IDef emptyFC "weight^Prelude.Types.Nat" [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") - .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") ] , IDef emptyFC @@ -257,9 +270,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IClaim @@ -273,9 +284,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IDef @@ -284,9 +293,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ 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 "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ (var "Data.Fin.FZ" .! ("k", var "k"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef diff --git a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected index acf2a9b38..15e08a120 100644 --- a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected @@ -2,8 +2,8 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (m : Nat ** X n m) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#0 (m), #2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -41,11 +41,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" .$ var "fv^lam^0" .$ var "fv^lam^1") + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -66,8 +68,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = - mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) , IClaim (MkIClaimData @@ -129,10 +130,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "Builtin.DPair.MkDPair" .$ implicitTrue - .$ ( var "DerivedGen.MkX" - .! ("m", implicitTrue) - .! ("n", implicitTrue) - .$ var "{arg:3}"))))) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:3}"))))) ] ] , scope = @@ -146,8 +144,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "[0, 1]" [ var "[0, 1]" .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" - .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -160,13 +158,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -179,13 +177,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^lam^0" - .$ var "fv^lam^1") + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IDef @@ -194,17 +192,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) .$ ( var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" .! ("fv^lam^1", var "fv^lam^1"))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef emptyFC @@ -212,51 +207,67 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "len") - .$ bindVar "fv^lam^1" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "len" - .$ var "fv^lam^1")) + .$ ( var "[0, 1]" + .$ var "^cons_fuel^" + .$ var "len" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse .=> var ">>=" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^1") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" .! ("len", implicitTrue) - .! ("fv^lam^1", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) .$ var "x" .$ var "xs")))) - , var "<>" - .$ implicitTrue - .$ implicitTrue - .$ implicitTrue - .= var "empty" + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^lam^0), 1(fv^lam^1)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^") - .$ var "Nil"))) + 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.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } } ] , IDef @@ -275,9 +286,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -290,9 +299,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef @@ -345,8 +352,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: emptyFC "weight^Prelude.Types.Nat" [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") - .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") ] , IDef emptyFC @@ -365,9 +371,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IClaim @@ -381,9 +385,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IDef @@ -392,9 +394,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ 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 "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ (var "Data.Fin.FZ" .! ("k", var "k"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef diff --git a/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected new file mode 100644 index 000000000..7cc2b58d6 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected @@ -0,0 +1,363 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (m : Nat) -> Gen MaybeEmpty (n : Nat ** X n m) +LOG deptycheck.derive.least-effort:7: DerivedGen.X[1] MkX - used final order: [#2] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> MkArg MW ExplicitArg (Just "outer^") implicitTrue +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:2}" .$ var "{arg:1}")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[1]" + [ var "[1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:2}" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "m" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ (var "[1]" .$ var "^outmost-fuel^" .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:3}")) + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[1] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[1]" + [ var "[1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ( "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + , var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + )))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "[1]" + .$ var "^cons_fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "len" .$ bindVar "xs" + .= var ">>=" + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) + .$ var "x" + .$ var "xs"))) + ] + })) + ] + ] + , 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.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[1]" .$ var "^outmost-fuel^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected new file mode 100644 index 000000000..bfb082374 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected @@ -0,0 +1,703 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X +LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#1 (n), #0 (m), #3, #2] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^6814960928365568963.Either^6814960928365568963: Prelude.Types.Either (Data.Nat.LTE lam^0 lam^1) (Data.Nat.LTE lam^2 lam^3) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^6814960928365568963.Either^6814960928365568963[0(fv^Either^6814960928365568963.Either^6814960928365568963^lam^0), 1(fv^Either^6814960928365568963.Either^6814960928365568963^lam^1), 2(fv^Either^6814960928365568963.Either^6814960928365568963^lam^2), 3(fv^Either^6814960928365568963.Either^6814960928365568963^lam^3)] Either^6814960928365568963^Con^0 - used final order: [#4 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^6814960928365568963.Either^6814960928365568963[0(fv^Either^6814960928365568963.Either^6814960928365568963^lam^0), 1(fv^Either^6814960928365568963.Either^6814960928365568963^lam^1), 2(fv^Either^6814960928365568963.Either^6814960928365568963^lam^2), 3(fv^Either^6814960928365568963.Either^6814960928365568963^lam^3)] Either^6814960928365568963^Con^1 - used final order: [#4 (x)] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: Data.Nat.LTE[0(n), 1(m)] LTEZero - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Nat.LTE[0(n), 1(m)] LTESucc - used final order: [#2] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] +LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1, 2, 3]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "m") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Nat.LTE" .$ var "n" .$ var "m") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^6814960928365568963.mToP") + .$ ( var "[0, 1, 2, 3]" + .$ var "^outmost-fuel^" + .$ (var "Prelude.Types.S" .$ var "n") + .$ var "m" + .$ (var "Prelude.Types.S" .$ var "m") + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{conArg:1}") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:1}" + .@ var "{conArg:1}")))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ var "Prelude.Types.Z" + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^0" + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .$ bindVar "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "[0, 1]" + .$ var "^cons_fuel^" + .$ var "len" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var ">>=" + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550^Con^1" + .! ("len", implicitTrue) + .! ("fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1", implicitTrue) + .$ var "x" + .$ var "xs")))) + , 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.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[0, 1, 2, 3]" + [ var "[0, 1, 2, 3]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^0" + .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^0", implicitTrue) + .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^1", implicitTrue) + .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + ) + .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" + , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" + ) + .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^1" + .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + ) + .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + ) + .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^2", implicitTrue) + .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^3", implicitTrue) + .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Either^6814960928365568963.Either^6814960928365568963[0(fv^Either^6814960928365568963.Either^6814960928365568963^lam^0), 1(fv^Either^6814960928365568963.Either^6814960928365568963^lam^1), 2(fv^Either^6814960928365568963.Either^6814960928365568963^lam^2), 3(fv^Either^6814960928365568963.Either^6814960928365568963^lam^3)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^" + .$ var "inter^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^" + .$ var "inter^" + .$ var "inter^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "m") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.Nat.LTE" .$ var "n" .$ var "m") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "m") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "Data.Nat.LTE" .$ var "n" .$ var "m") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" .$ bindVar "right" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Nat.LTEZero (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Nat.LTEZero" .! ("right", var "right"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "left") + .$ (var "Prelude.Types.S" .$ bindVar "right") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Nat.LTESucc (orders)")) + .$ ( var ">>=" + .$ (var "[0, 1]" .$ var "^cons_fuel^" .$ var "left" .$ var "right") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Nat.LTESucc" .! ("right", implicitTrue) .! ("left", implicitTrue) .$ var "{arg:3}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Nat.LTE[0(n), 1(m)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected index 9b618b793..9426831c7 100644 --- a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected @@ -2,18 +2,18 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel) -> Gen MaybeEmpty String)} -> Gen MaybeEmpty X LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0] LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^17089122808763292221.Either^17089122808763292221: Prelude.Types.Either Prelude.Types.Nat (DerivedGen.Y (Prelude.Types.Either (Data.Fin.Fin lam^0) String)) -LOG deptycheck.derive.least-effort:7: DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^lam^0)] Either^17089122808763292221^Con^0 - used final order: [#0 (x)] -LOG deptycheck.derive.least-effort:7: DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^lam^0)] Either^17089122808763292221^Con^1 - used final order: [#1 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^Either^17089122808763292221.Either^17089122808763292221^lam^0)] Either^17089122808763292221^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^Either^17089122808763292221.Either^17089122808763292221^lam^0)] Either^17089122808763292221^Con^1 - used final order: [#1 (x)] LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^7167106520753982886.Y^7167106520753982886: DerivedGen.Y (Prelude.Types.Either (Data.Fin.Fin lam^0) String) -LOG deptycheck.derive.least-effort:7: DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^lam^0)] Y^7167106520753982886^Con^0 - used final order: [#1] +LOG deptycheck.derive.least-effort:7: DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^Y^7167106520753982886.Y^7167106520753982886^lam^0)] Y^7167106520753982886^Con^0 - used final order: [#1] LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^5595291053177582713.Either^5595291053177582713: Prelude.Types.Either Prelude.Types.Nat (Prelude.Types.Either (Data.Fin.Fin lam^0) String) LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] -LOG deptycheck.derive.least-effort:7: DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^lam^0)] Either^5595291053177582713^Con^0 - used final order: [#0 (x)] -LOG deptycheck.derive.least-effort:7: DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^lam^0)] Either^5595291053177582713^Con^1 - used final order: [#1 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^Either^5595291053177582713.Either^5595291053177582713^lam^0)] Either^5595291053177582713^Con^0 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^Either^5595291053177582713.Either^5595291053177582713^lam^0)] Either^5595291053177582713^Con^1 - used final order: [#1 (x)] LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13748098436294604892.Either^13748098436294604892: Prelude.Types.Either (Data.Fin.Fin lam^0) String -LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^lam^0)] Either^13748098436294604892^Con^0 - used final order: [#1 (x)] -LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^lam^0)] Either^13748098436294604892^Con^1 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^Either^13748098436294604892.Either^13748098436294604892^lam^0)] Either^13748098436294604892^Con^0 - used final order: [#1 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^Either^13748098436294604892.Either^13748098436294604892^lam^0)] Either^13748098436294604892^Con^1 - used final order: [#0 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -48,10 +48,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" + .$ var "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0") } }) , IClaim @@ -64,10 +65,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" .$ var "fv^lam^0") + .$ (var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") } }) , IClaim @@ -93,10 +94,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" + .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") } }) , IClaim @@ -109,10 +111,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" + .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") } }) , IClaim @@ -120,8 +123,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = - mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) , IClaim (MkIClaimData @@ -186,7 +188,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , IDef emptyFC "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -199,10 +203,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" + .$ var "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0") } }) , IClaim @@ -215,10 +220,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221" + .$ var "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0") } }) , IDef @@ -226,10 +232,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "<>" [ var "<>" .$ bindVar "^cons_fuel^" - .$ bindVar "fv^lam^0" + .$ bindVar "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^0 (orders)")) .$ ( var ">>=" .$ (var "[]" .$ var "^outmost-fuel^") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse @@ -237,52 +242,57 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^0" .$ var "x" - .! ("fv^lam^0", var "fv^lam^0")))) + .! ( "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0" + , var "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0" + )))) ] , IDef emptyFC "<>" [ var "<>" .$ bindVar "^cons_fuel^" - .$ bindVar "fv^lam^0" + .$ bindVar "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" .$ (var "cast" .@ var "DerivedGen.Y^7167106520753982886.mToP") .$ ( var "[0]" .$ var "^outmost-fuel^" - .$ var "fv^lam^0")) + .$ var "fv^Either^17089122808763292221.Either^17089122808763292221^lam^0")) .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Either^17089122808763292221.Either^17089122808763292221^Con^1" - .! ("fv^lam^0", implicitTrue) + .! ("fv^Either^17089122808763292221.Either^17089122808763292221^lam^0", implicitTrue) .$ var "x"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^lam^0)] (non-spending)")) + .$ primVal + (Str + "DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^Either^17089122808763292221.Either^17089122808763292221^lam^0)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" .$ ( var "<>" .$ var "^fuel_arg^" - .$ var "inter^") + .$ var "inter^") .$ ( var "::" .$ ( var "<>" .$ var "^fuel_arg^" - .$ var "inter^") + .$ var "inter^") .$ var "Nil"))) } ] , IDef emptyFC "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -295,16 +305,19 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" + .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") } }) , IDef emptyFC "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "fv^lam^0" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0" .= var "Test.DepTyCheck.Gen.label" .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0 (orders)")) .$ ( var ">>=" @@ -312,19 +325,24 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "cast" .@ var "DerivedGen.Either^5595291053177582713.mToP") .$ ( var "[0]" .$ var "^outmost-fuel^" - .$ var "fv^lam^0")) + .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0")) .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0" - .! ("fv^lam^0", implicitTrue) + .! ("fv^Y^7167106520753982886.Y^7167106520753982886^lam^0", implicitTrue) .$ var "{arg:3}"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^lam^0)] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^") + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^Y^7167106520753982886.Y^7167106520753982886^lam^0)] (non-spending)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") } ] , IDef @@ -343,9 +361,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -358,9 +374,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef @@ -412,7 +426,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , IDef emptyFC "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -425,10 +441,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" + .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") } }) , IClaim @@ -441,10 +458,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" + .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") } }) , IDef @@ -452,10 +470,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "<>" [ var "<>" .$ bindVar "^cons_fuel^" - .$ bindVar "fv^lam^0" + .$ bindVar "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0 (orders)")) .$ ( var ">>=" .$ (var "[]" .$ var "^outmost-fuel^") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse @@ -463,52 +480,57 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0" .$ var "x" - .! ("fv^lam^0", var "fv^lam^0")))) + .! ( "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" + , var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" + )))) ] , IDef emptyFC "<>" [ var "<>" .$ bindVar "^cons_fuel^" - .$ bindVar "fv^lam^0" + .$ bindVar "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" .$ (var "cast" .@ var "DerivedGen.Either^13748098436294604892.mToP") .$ ( var "[0]" .$ var "^outmost-fuel^" - .$ var "fv^lam^0")) + .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0")) .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1" - .! ("fv^lam^0", implicitTrue) + .! ("fv^Either^5595291053177582713.Either^5595291053177582713^lam^0", implicitTrue) .$ var "x"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^lam^0)] (non-spending)")) + .$ primVal + (Str + "DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^Either^5595291053177582713.Either^5595291053177582713^lam^0)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" .$ ( var "<>" .$ var "^fuel_arg^" - .$ var "inter^") + .$ var "inter^") .$ ( var "::" .$ ( var "<>" .$ var "^fuel_arg^" - .$ var "inter^") + .$ var "inter^") .$ var "Nil"))) } ] , IDef emptyFC "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -521,10 +543,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" + .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") } }) , IClaim @@ -537,10 +560,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" .$ var "fv^lam^0") + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" + .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") } }) , IDef @@ -548,17 +572,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "<>" [ var "<>" .$ bindVar "^cons_fuel^" - .$ bindVar "fv^lam^0" + .$ bindVar "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0 (orders)")) .$ ( var ">>=" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^lam^0") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0" - .! ("fv^lam^0", implicitTrue) + .! ("fv^Either^13748098436294604892.Either^13748098436294604892^lam^0", implicitTrue) .$ var "x"))) ] , IDef @@ -566,10 +589,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: "<>" [ var "<>" .$ bindVar "^cons_fuel^" - .$ bindVar "fv^lam^0" + .$ bindVar "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1 (orders)")) .$ ( var ">>=" .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse @@ -577,23 +599,27 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1" .$ var "x" - .! ("fv^lam^0", var "fv^lam^0")))) + .! ( "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" + , var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" + )))) ] ] , scope = var "Test.DepTyCheck.Gen.label" .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^lam^0)] (non-spending)")) + .$ primVal + (Str + "DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^Either^13748098436294604892.Either^13748098436294604892^lam^0)] (non-spending)")) .$ ( var "Test.DepTyCheck.Gen.oneOf" .! ("em", var "MaybeEmpty") .$ ( var "::" .$ ( var "<>" .$ var "^fuel_arg^" - .$ var "inter^") + .$ var "inter^") .$ ( var "::" .$ ( var "<>" .$ var "^fuel_arg^" - .$ var "inter^") + .$ var "inter^") .$ var "Nil"))) } ] @@ -601,8 +627,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: emptyFC "weight^Prelude.Types.Nat" [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") - .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") ] , IDef emptyFC @@ -621,9 +646,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IClaim @@ -637,9 +660,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Fin.Fin" .$ var "n") } }) , IDef @@ -648,9 +669,7 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [ 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 "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ (var "Data.Fin.FZ" .! ("k", var "k"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] , IDef diff --git a/tests/derivation/least-effort/run/specialise/00-1 simple/expected b/tests/derivation/least-effort/run/specialise/00-1 simple/expected new file mode 100644 index 000000000..6beee5ec3 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-1 simple/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +Generated values: +----- +----- +MkX [16, 4, 17, 10, 8, 17, 12, 11, 10, 4] +----- +MkX [14, 4, 14, 7, 1, 6, 0, 15, 17, 17, 20, 14, 20, 5, 19, 12, 9, 14, 16] +----- +MkX [16, 8, 0, 2, 2, 6, 12, 17, 19, 7, 3, 16, 6, 12, 15, 1] +----- +MkX [5, 0, 17, 15] +----- +MkX [6] +----- +MkX [19, 1, 20, 1, 18, 14, 3] +----- +MkX [2, 13, 15, 20, 3, 1, 13, 8, 4] +----- +MkX [7, 3, 6, 5, 16, 2, 4, 2, 5] +----- +MkX [4, 10, 1, 10, 11, 13, 19, 15] +----- +MkX [12, 8, 17, 1, 13, 8, 6, 20, 13, 2, 17, 13, 6, 19] diff --git a/tests/derivation/least-effort/run/specialise/00-2 simple/expected b/tests/derivation/least-effort/run/specialise/00-2 simple/expected new file mode 100644 index 000000000..eaf84492b --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-2 simple/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^8984676908526435328.List^8984676908526435328: Prelude.Basics.List String +Generated values: +----- +----- +MkX ["a", "a", "b", "cc", "b", "c", "cc", "c", "b", "b"] +----- +MkX ["a", "b", "a", "b", "cc", "b", "cc", "b", "cc", "cc", "c", "b", "a", "cc", "c", "c", "a", "c", "a", "a"] +----- +MkX ["a", "c", "b", "a", "b", "cc", "a", "b", "cc", "a", "cc", "a", "cc", "b", "cc", "b", "a", "c", "b", "b"] +----- +MkX ["c", "cc", "b", "cc"] +----- +MkX ["a", "b", "c", "b", "b", "a"] +----- +MkX ["cc", "a", "c", "b", "a", "c", "c", "c", "a"] +----- +MkX ["cc", "cc", "cc", "a", "a", "cc", "cc", "cc", "a", "b", "cc", "b", "b", "b", "a", "b"] +----- +MkX ["cc", "cc", "b", "c", "c", "b", "a", "b", "c", "a", "b", "b"] +----- +MkX ["a", "b"] +----- +MkX ["c", "a", "cc", "b", "b"] diff --git a/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/expected b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/expected new file mode 100644 index 000000000..aabbe0423 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-3 two-same shallow/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +Generated values: +----- +----- +MkX [16, 4, 17, 10, 8, 17, 12, 11, 10, 4] [14, 4, 14, 7, 1, 6, 0, 15, 17, 17, 20, 14, 20, 5, 19, 12, 9, 14, 16] +----- +MkX [16, 8, 0, 2, 2, 6, 12, 17, 19, 7, 3, 16, 6, 12, 15, 1] [5, 0, 17, 15] +----- +MkX [6] [19, 1, 20, 1, 18, 14, 3] +----- +MkX [2, 13, 15, 20, 3, 1, 13, 8, 4] [7, 3, 6, 5, 16, 2, 4, 2, 5] +----- +MkX [4, 10, 1, 10, 11, 13, 19, 15] [12, 8, 17, 1, 13, 8, 6, 20, 13, 2, 17, 13, 6, 19] +----- +MkX [19, 12, 8, 20, 12, 19, 17, 1, 11, 20, 14, 0, 0, 2, 16] [18, 12, 3, 4, 15, 12] +----- +MkX [17, 7, 15, 4, 6, 4, 15, 14, 10, 10, 0, 4, 17, 16, 1, 6, 0, 0, 13] [4, 13, 6, 8, 7] +----- +MkX [17, 13, 8, 10, 5, 8, 1] [13, 3, 14, 12, 16, 5, 17, 14, 0, 5, 7, 19, 16] +----- +MkX [6, 5, 6, 20, 3, 1, 1, 10, 11, 1, 0, 14, 2, 6, 15, 18] [1, 13, 15, 9, 9, 19, 17, 3, 17, 1, 12, 7, 14, 17, 14] +----- +MkX [10, 12, 13, 15, 6, 18, 4, 17, 4, 14, 8, 15, 13, 0, 16, 15, 13, 18] [13, 4, 15, 3] diff --git a/tests/derivation/least-effort/run/specialise/00-4 two-same deep/expected b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/expected new file mode 100644 index 000000000..a03a8cd38 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-4 two-same deep/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +Generated values: +----- +----- +MkX [16, 4, 17, 10, 8, 17, 12, 11, 10, 4] (MkY [14, 4, 14, 7, 1, 6, 0, 15, 17, 17, 20, 14, 20, 5, 19, 12, 9, 14, 16]) +----- +MkX [16, 8, 0, 2, 2, 6, 12, 17, 19, 7, 3, 16, 6, 12, 15, 1] (MkY [5, 0, 17, 15]) +----- +MkX [6] (MkY [19, 1, 20, 1, 18, 14, 3]) +----- +MkX [2, 13, 15, 20, 3, 1, 13, 8, 4] (MkY [7, 3, 6, 5, 16, 2, 4, 2, 5]) +----- +MkX [4, 10, 1, 10, 11, 13, 19, 15] (MkY [12, 8, 17, 1, 13, 8, 6, 20, 13, 2, 17, 13, 6, 19]) +----- +MkX [19, 12, 8, 20, 12, 19, 17, 1, 11, 20, 14, 0, 0, 2, 16] (MkY [18, 12, 3, 4, 15, 12]) +----- +MkX [17, 7, 15, 4, 6, 4, 15, 14, 10, 10, 0, 4, 17, 16, 1, 6, 0, 0, 13] (MkY [4, 13, 6, 8, 7]) +----- +MkX [17, 13, 8, 10, 5, 8, 1] (MkY [13, 3, 14, 12, 16, 5, 17, 14, 0, 5, 7, 19, 16]) +----- +MkX [6, 5, 6, 20, 3, 1, 1, 10, 11, 1, 0, 14, 2, 6, 15, 18] (MkY [1, 13, 15, 9, 9, 19, 17, 3, 17, 1, 12, 7, 14, 17, 14]) +----- +MkX [10, 12, 13, 15, 6, 18, 4, 17, 4, 14, 8, 15, 13, 0, 16, 15, 13, 18] (MkY [13, 4, 15, 3]) diff --git a/tests/derivation/least-effort/run/specialise/00-5 two-similar/expected b/tests/derivation/least-effort/run/specialise/00-5 two-similar/expected new file mode 100644 index 000000000..727de6bfa --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/00-5 two-similar/expected @@ -0,0 +1,26 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^8984676908526435328.List^8984676908526435328: Prelude.Basics.List String +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat +Generated values: +----- +----- +MkX ["a", "a", "b", "cc", "b", "c", "cc", "c", "b", "b"] [4, 17, 10, 8, 17, 12, 11, 10, 4] +----- +MkX ["cc", "cc", "cc", "a", "a", "cc", "cc", "cc", "a", "b", "cc", "b", "b", "b", "a", "b"] [14, 7, 1, 6, 0, 15, 17, 17, 13, 17, 19, 12] +----- +MkX ["a", "c", "c", "a", "c", "cc", "c", "c", "b", "b", "c", "c", "cc", "a", "b", "b", "c", "b"] [3, 10, 14, 16, 16, 11, 1, 2, 2, 6, 12, 17, 20, 7, 3, 15, 6, 12, 15] +----- +MkX ["a", "b", "c", "a", "a", "c", "a", "b", "a", "a", "a", "b", "c", "a", "c", "c", "b"] [15, 0, 6] +----- +MkX ["c", "b", "a", "c", "b", "b", "a", "a", "c", "a", "a", "a", "a", "cc", "cc", "c", "b", "cc", "cc"] [6, 18, 12, 3] +----- +MkX ["b", "b"] [13, 16, 20, 3, 0, 13, 8, 4] +----- +MkX ["a", "b", "c", "b"] [3, 6, 5, 16, 2, 4, 2, 5, 10, 10, 1, 10, 8, 13, 19, 15] +----- +MkX ["c", "a", "cc", "a", "cc", "c", "a", "a", "cc", "c", "cc", "cc", "c", "b", "b", "cc"] [17, 1, 13, 8, 6, 20, 13, 2, 17, 13, 6, 19, 19, 13, 8] +----- +MkX ["c", "cc", "c", "b", "c", "c", "a", "b", "c", "cc", "c", "cc", "c", "a", "b", "cc", "a", "a"] [8, 19, 17, 0, 11, 20, 14, 1, 0, 2, 18] +----- +MkX ["c", "b", "cc", "a", "cc", "c", "c", "cc", "cc", "c", "cc"] [12, 3, 4, 15, 5] diff --git a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected index 0c4051831..4ded567ff 100644 --- a/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected +++ b/tests/derivation/least-effort/run/specialise/01-1 non-ty imm givn/expected @@ -31,11 +31,9 @@ MkX ["a"] ----- MkX [""] ----- -MkX ["bc"] ------ MkX [""] ----- -MkX ["a"] +MkX ["bc"] ----- MkX ["a"] ----- @@ -45,23 +43,25 @@ MkX ["a"] ----- MkX ["bc"] ----- +MkX ["a"] ----- -MkX ["a", "a", ""] ------ -MkX ["bc", "a", "a"] ----- MkX ["a", "a", "a"] ----- -MkX ["", "a", "a"] +MkX ["", "bc", "a"] ----- -MkX ["", "a", "a"] +MkX ["", "", "a"] ----- -MkX ["bc", "a", "a"] +MkX ["bc", "", ""] ----- -MkX ["bc", "", "a"] +MkX ["a", "a", "bc"] +----- +MkX ["a", "a", "bc"] ----- MkX ["bc", "bc", "bc"] ----- -MkX ["bc", "", "bc"] +MkX ["", "bc", "bc"] ----- MkX ["", "bc", ""] +----- +MkX ["a", "", "a"] diff --git a/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/expected b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/expected new file mode 100644 index 000000000..b88cb9db5 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-2 non-ty imm gend/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^120651999565177027.Vect^120651999565177027: Data.Vect.Vect lam^0 String +Generated values: +----- +----- +(16 ** MkX ["a", "a", "a", "bc", "", "a", "a", "bc", "a", "bc", "", "", "a", "a", "", ""]) +----- +(12 ** MkX ["a", "a", "", "bc", "a", "", "bc", "", "", "a", "bc", "bc"]) +----- +(0 ** MkX []) +----- +(17 ** MkX ["a", "a", "a", "", "", "bc", "a", "a", "bc", "", "bc", "", "a", "a", "a", "bc", "a"]) +----- +(8 ** MkX ["a", "bc", "bc", "a", "bc", "", "", "bc"]) +----- +(8 ** MkX ["", "bc", "", "bc", "a", "", "bc", ""]) +----- +(10 ** MkX ["", "bc", "", "a", "bc", "", "a", "", "a", ""]) +----- +(5 ** MkX ["", "bc", "a", "a", "a"]) +----- +(4 ** MkX ["a", "", "bc", "bc"]) +----- +(7 ** MkX ["a", "a", "", "a", "", "", ""]) diff --git a/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/expected b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/expected new file mode 100644 index 000000000..f5d628864 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/01-3 non-ty imm exist/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^120651999565177027.Vect^120651999565177027: Data.Vect.Vect lam^0 String +Generated values: +----- +----- +MkX ["a", "a", "a", "bc", "", "a", "a", "bc", "a", "bc", "", "", "a", "a", "", ""] +----- +MkX ["a", "a", "", "bc", "a", "", "bc", "", "", "a", "bc", "bc"] +----- +MkX [] +----- +MkX ["a", "a", "a", "", "", "bc", "a", "a", "bc", "", "bc", "", "a", "a", "a", "bc", "a"] +----- +MkX ["a", "bc", "bc", "a", "bc", "", "", "bc"] +----- +MkX ["", "bc", "", "bc", "a", "", "bc", ""] +----- +MkX ["", "bc", "", "a", "bc", "", "a", "", "a", ""] +----- +MkX ["", "bc", "a", "a", "a"] +----- +MkX ["a", "", "bc", "bc"] +----- +MkX ["a", "a", "", "a", "", "", ""] diff --git a/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/expected b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/expected new file mode 100644 index 000000000..de95d61ac --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-0 non-ty deep exist/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) +Generated values: +----- +----- +MkX [4, 14, 7, 9, 15, 1, 5, 7, 12] +----- +MkX [5, 10, 10, 3, 1, 6, 6, 3, 0, 2, 7, 1, 9, 6, 10, 6] +----- +MkX [11, 15, 15, 14, 1, 16, 12, 2, 8, 13, 14, 12, 12, 4, 1, 1, 2, 9, 15, 16] +----- +MkX [16, 2, 11, 6, 12, 15, 1] +----- +MkX [0, 2, 0, 4, 4, 1, 4, 3, 1, 0, 3] +----- +MkX [] +----- +MkX [1, 18, 1, 18, 12, 3] +----- +MkX [0, 2, 2, 2, 0, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [] diff --git a/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/expected b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/expected new file mode 100644 index 000000000..ae6a8c506 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-1 non-ty deep gend/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) +Generated values: +----- +----- +(16 ** MkX [4, 14, 7, 9, 15, 1, 5, 7, 12]) +----- +(11 ** MkX [5, 10, 10, 3, 1, 6, 6, 3, 0, 2, 7, 1, 9, 6, 10, 6]) +----- +(17 ** MkX [11, 15, 15, 14, 1, 16, 12, 2, 8, 13, 14, 12, 12, 4, 1, 1, 2, 9, 15, 16]) +----- +(19 ** MkX [16, 2, 11, 6, 12, 15, 1]) +----- +(5 ** MkX [0, 2, 0, 4, 4, 1, 4, 3, 1, 0, 3]) +----- +(0 ** MkX []) +----- +(19 ** MkX [1, 18, 1, 18, 12, 3]) +----- +(3 ** MkX [0, 2, 2, 2, 0, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 0]) +----- +(1 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +----- +(5 ** MkX []) diff --git a/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/expected b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/expected new file mode 100644 index 000000000..7faae5372 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-2 non-ty deep givn/expected @@ -0,0 +1,67 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) +Generated values: +----- +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0] +----- +MkX [0, 0, 0, 0, 0] +----- +----- +MkX [0, 0, 2, 0, 2, 2, 0, 2, 0, 2, 1, 2, 2, 1, 2, 2, 0, 2] +----- +MkX [0, 2, 2, 1, 2, 2, 1, 2, 2, 0, 2, 0, 0, 2, 0, 2, 2, 2] +----- +MkX [] +----- +MkX [1, 2, 2, 2] +----- +MkX [2, 0, 2, 2, 1, 1, 2, 2, 0, 0, 2, 2, 0, 2, 0, 2, 1, 1, 2, 2] +----- +MkX [2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0] +----- +MkX [2, 2, 2, 2, 1, 2, 2, 1, 2, 1, 2, 2, 2, 1, 0, 2, 1, 1, 1] +----- +MkX [2, 2, 2, 2, 0, 0, 2, 1, 2, 2, 2, 2, 2, 1] +----- +MkX [0, 2, 1, 2, 2, 2, 2, 0, 2, 0, 1, 2, 2, 2] +----- +MkX [2, 2, 2, 1, 2, 2, 0, 1, 2, 2, 1, 2, 0, 0, 2, 0, 2] diff --git a/tests/derivation/least-effort/run/specialise/02-3 two-similar/expected b/tests/derivation/least-effort/run/specialise/02-3 two-similar/expected new file mode 100644 index 000000000..e30868e61 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/02-3 two-similar/expected @@ -0,0 +1,26 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^8984676908526435328.List^8984676908526435328: Prelude.Basics.List String +LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) +Generated values: +----- +----- +MkX ["", "", "a", "", "bc", "", "a", "a", "", "", "a"] [8, 10, 15, 5, 4, 11] +----- +MkX ["", "bc", "bc", "bc", "", "bc", "bc", "bc", ""] [6, 12, 4, 5, 5, 9, 0, 14, 2, 14, 1, 13, 10, 13, 14, 14, 1] +----- +MkX [] [12, 9, 13, 15, 15, 11, 1, 2, 2, 9, 11, 17, 17, 16, 4, 15, 5, 11, 14] +----- +MkX ["", "a", "bc", "", "", "bc", "", "a", "", "", "", "a", "bc", "", "bc", "bc", "a"] [0, 6] +----- +MkX ["bc", "a", "", "bc", "a", "a", "", "", "bc", "", "", "", "", "bc", "bc", "bc", "a", "bc", "a", "bc"] [5, 5, 5, 2, 4, 4, 3, 0] +----- +MkX ["a", ""] [0, 2, 2, 2, 0, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 0] +----- +MkX ["", "bc", "", "bc", "a", "", "a", "a", "", "", "", "", "a", "a"] [] +----- +MkX ["a", "bc", "a"] [1, 1, 3, 0, 3, 0, 3, 3, 1, 0, 3] +----- +MkX ["", "a"] [4, 3, 0] +----- +MkX ["a", "", "a", "", "a", "", ""] [9, 10, 5, 10, 10, 7] diff --git a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected index f89739b1e..5cd1d4ac3 100644 --- a/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected +++ b/tests/derivation/least-effort/run/specialise/03-0 non-ty imm-deep-same exist/expected @@ -4,22 +4,22 @@ LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared Generated values: ----- ----- -MkX [6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 6, 15] +MkX [6, 6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 14] ----- -MkX [0, 1, 1, 3] +MkX [9, 8, 9, 9, 8, 8, 8, 9, 0, 9] ----- -MkX [14, 11, 1, 14, 3, 13, 14, 2, 6, 14, 14, 13, 14, 13, 7] +MkX [16, 13, 7, 16, 3, 8, 19, 18, 13, 7, 3, 3, 1, 9, 17, 17, 15, 11, 3, 15] ----- -MkX [3, 3, 11, 12, 13, 13, 8, 9, 10, 7, 6, 4, 10, 2] +MkX [0, 1] ----- -MkX [4, 1, 7, 0, 1, 2, 9, 5, 9, 0] +MkX [2, 0, 2] ----- -MkX [11, 1, 0, 11, 11, 6, 10, 0, 6, 0, 5, 6] +MkX [9, 9, 6, 8, 0, 4, 0, 3, 1, 6] ----- -MkX [3, 3, 5, 11, 5, 9, 11, 11, 2, 0, 2, 1] +MkX [1, 1] ----- -MkX [8, 3, 8, 5, 6, 3, 2, 0, 0, 3, 7] +MkX [6, 8, 3, 3, 7, 13, 7, 8, 13, 13, 3, 0, 4, 1] ----- -MkX [3, 1, 0, 3] +MkX [0, 0, 1, 2, 0] ----- -MkX [0, 3, 3, 3] +MkX [2, 4, 0, 5, 0, 4] diff --git a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected index 22f214fc7..2f5f4faf0 100644 --- a/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected +++ b/tests/derivation/least-effort/run/specialise/03-1 non-ty imm-deep-same gend/expected @@ -4,22 +4,22 @@ LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared Generated values: ----- ----- -(16 ** MkX [6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 6, 15]) +(16 ** MkX [6, 6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 14]) ----- -(4 ** MkX [0, 1, 1, 3]) +(10 ** MkX [9, 8, 9, 9, 8, 8, 8, 9, 0, 9]) ----- -(15 ** MkX [14, 11, 1, 14, 3, 13, 14, 2, 6, 14, 14, 13, 14, 13, 7]) +(20 ** MkX [16, 13, 7, 16, 3, 8, 19, 18, 13, 7, 3, 3, 1, 9, 17, 17, 15, 11, 3, 15]) ----- -(14 ** MkX [3, 3, 11, 12, 13, 13, 8, 9, 10, 7, 6, 4, 10, 2]) +(2 ** MkX [0, 1]) ----- -(10 ** MkX [4, 1, 7, 0, 1, 2, 9, 5, 9, 0]) +(3 ** MkX [2, 0, 2]) ----- -(12 ** MkX [11, 1, 0, 11, 11, 6, 10, 0, 6, 0, 5, 6]) +(10 ** MkX [9, 9, 6, 8, 0, 4, 0, 3, 1, 6]) ----- -(12 ** MkX [3, 3, 5, 11, 5, 9, 11, 11, 2, 0, 2, 1]) +(2 ** MkX [1, 1]) ----- -(11 ** MkX [8, 3, 8, 5, 6, 3, 2, 0, 0, 3, 7]) +(14 ** MkX [6, 8, 3, 3, 7, 13, 7, 8, 13, 13, 3, 0, 4, 1]) ----- -(4 ** MkX [3, 1, 0, 3]) +(5 ** MkX [0, 0, 1, 2, 0]) ----- -(4 ** MkX [0, 3, 3, 3]) +(6 ** MkX [2, 4, 0, 5, 0, 4]) diff --git a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected index 0272c4095..593d4d098 100644 --- a/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected +++ b/tests/derivation/least-effort/run/specialise/03-2 non-ty imm-deep-same givn/expected @@ -46,22 +46,22 @@ MkX [0] MkX [0] ----- ----- -MkX [0, 2, 0] +MkX [2, 0, 2] ----- -MkX [2, 2, 0] ------ -MkX [2, 2, 1] ------ -MkX [1, 2, 2] +MkX [2, 1, 0] ----- MkX [2, 1, 2] ----- -MkX [2, 2, 1] +MkX [2, 2, 2] +----- +MkX [1, 2, 1] ----- -MkX [2, 0, 1] +MkX [2, 2, 2] ----- MkX [2, 2, 2] ----- -MkX [2, 2, 1] +MkX [0, 2, 1] +----- +MkX [2, 0, 2] ----- MkX [2, 2, 2] diff --git a/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/expected b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/expected new file mode 100644 index 000000000..df25aa7ad --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-0 non-ty imm-deep-diff exist-both/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +MkX [3, 11, 8, 15] +----- +MkX [6, 10, 0, 13, 7] +----- +MkX [6, 5, 12, 2] +----- +MkX [3, 3, 0, 3, 3, 3, 3, 3, 0, 1] +----- +MkX [5, 4, 6, 6, 7, 6, 1, 0, 5, 7, 7, 7, 7, 6, 7, 4, 7] +----- +MkX [4, 1, 4, 2, 0, 6, 2, 4, 6, 6, 6, 4, 6, 3] +----- +MkX [0, 9, 6, 5, 3, 3, 7, 9, 9, 8, 9, 9] +----- +MkX [0, 11, 11, 6, 10, 0, 6, 0, 5, 3, 11, 6, 6, 5, 2, 5, 0, 2] +----- +MkX [3, 18, 5, 18, 13, 3, 0, 4, 6] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] diff --git a/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/expected new file mode 100644 index 000000000..bb47f5b28 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-1 non-ty imm-deep-diff exist-givn/expected @@ -0,0 +1,67 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +MkX [] +----- +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0] +----- +MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +----- +----- +MkX [1, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 0, 2, 1] +----- +MkX [2, 2, 0, 1, 2] +----- +MkX [2, 2, 2, 2, 2, 0, 0, 2, 2] +----- +MkX [2, 0, 2, 2, 0, 2] +----- +MkX [1, 2, 0] +----- +MkX [2, 2, 2, 2, 2, 1, 0, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2] +----- +MkX [2, 0] +----- +MkX [1, 2, 2, 2, 2, 1, 2, 0, 1, 1, 2, 2, 2, 2, 2] +----- +MkX [2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 1] +----- +MkX [1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 0, 0, 0, 0, 1, 1] diff --git a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected index 9571e8b69..994625a20 100644 --- a/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected +++ b/tests/derivation/least-effort/run/specialise/04-2 non-ty imm-deep-diff exist-givn/expected @@ -41,27 +41,27 @@ MkX [2] ----- MkX [13] ----- -MkX [0] +MkX [4] ----- -MkX [1] +MkX [0] ----- ----- MkX [8, 15, 1] ----- -MkX [2, 9, 1] +MkX [4, 2, 9] ----- -MkX [4, 4, 4] +MkX [0, 2, 3] ----- -MkX [3, 0, 3] +MkX [10, 0, 2] ----- -MkX [2, 2, 1] ------ -MkX [6, 5, 7] +MkX [6, 3, 7] ----- MkX [1, 1, 3] ----- -MkX [13, 4, 14] +MkX [13, 1, 14] ----- MkX [11, 12, 11] ----- MkX [4, 8, 8] +----- +MkX [9, 1, 9] diff --git a/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/expected b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/expected new file mode 100644 index 000000000..af6ffcb99 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-3 non-ty imm-deep-diff exist-gend/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +(16 ** MkX [3, 11, 8, 15]) +----- +(17 ** MkX [6, 10, 0, 13, 7]) +----- +(15 ** MkX [6, 5, 12, 2]) +----- +(4 ** MkX [3, 3, 0, 3, 3, 3, 3, 3, 0, 1]) +----- +(8 ** MkX [5, 4, 6, 6, 7, 6, 1, 0, 5, 7, 7, 7, 7, 6, 7, 4, 7]) +----- +(7 ** MkX [4, 1, 4, 2, 0, 6, 2, 4, 6, 6, 6, 4, 6, 3]) +----- +(10 ** MkX [0, 9, 6, 5, 3, 3, 7, 9, 9, 8, 9, 9]) +----- +(12 ** MkX [0, 11, 11, 6, 10, 0, 6, 0, 5, 3, 11, 6, 6, 5, 2, 5, 0, 2]) +----- +(19 ** MkX [3, 18, 5, 18, 13, 3, 0, 4, 6]) +----- +(1 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) diff --git a/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/expected b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/expected new file mode 100644 index 000000000..7d4350a1d --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-4 non-ty imm-deep-diff exist-gend/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +(4 ** MkX [3, 11, 8, 15]) +----- +(5 ** MkX [6, 10, 0, 13, 7]) +----- +(4 ** MkX [6, 5, 12, 2]) +----- +(10 ** MkX [3, 3, 0, 3, 3, 3, 3, 3, 0, 1]) +----- +(17 ** MkX [5, 4, 6, 6, 7, 6, 1, 0, 5, 7, 7, 7, 7, 6, 7, 4, 7]) +----- +(14 ** MkX [4, 1, 4, 2, 0, 6, 2, 4, 6, 6, 6, 4, 6, 3]) +----- +(12 ** MkX [0, 9, 6, 5, 3, 3, 7, 9, 9, 8, 9, 9]) +----- +(18 ** MkX [0, 11, 11, 6, 10, 0, 6, 0, 5, 3, 11, 6, 6, 5, 2, 5, 0, 2]) +----- +(9 ** MkX [3, 18, 5, 18, 13, 3, 0, 4, 6]) +----- +(13 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) diff --git a/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/expected b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/expected new file mode 100644 index 000000000..be59fcd1e --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-5 non-ty imm-deep-diff gend-both/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +(4 ** (16 ** MkX [3, 11, 8, 15])) +----- +(5 ** (17 ** MkX [6, 10, 0, 13, 7])) +----- +(4 ** (15 ** MkX [6, 5, 12, 2])) +----- +(10 ** (4 ** MkX [3, 3, 0, 3, 3, 3, 3, 3, 0, 1])) +----- +(17 ** (8 ** MkX [5, 4, 6, 6, 7, 6, 1, 0, 5, 7, 7, 7, 7, 6, 7, 4, 7])) +----- +(14 ** (7 ** MkX [4, 1, 4, 2, 0, 6, 2, 4, 6, 6, 6, 4, 6, 3])) +----- +(12 ** (10 ** MkX [0, 9, 6, 5, 3, 3, 7, 9, 9, 8, 9, 9])) +----- +(18 ** (12 ** MkX [0, 11, 11, 6, 10, 0, 6, 0, 5, 3, 11, 6, 6, 5, 2, 5, 0, 2])) +----- +(9 ** (19 ** MkX [3, 18, 5, 18, 13, 3, 0, 4, 6])) +----- +(13 ** (1 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])) diff --git a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected index 068d8c7c4..cdd411198 100644 --- a/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected +++ b/tests/derivation/least-effort/run/specialise/04-6 non-ty imm-deep-diff givn-both/expected @@ -110,22 +110,22 @@ MkX [0, 0, 0] MkX [0, 0, 0] ----- ----- -MkX [0, 2, 0] +MkX [2, 0, 2] ----- -MkX [2, 2, 0] ------ -MkX [2, 2, 1] ------ -MkX [1, 2, 2] +MkX [2, 1, 0] ----- MkX [2, 1, 2] ----- -MkX [2, 2, 1] +MkX [2, 2, 2] +----- +MkX [1, 2, 1] ----- -MkX [2, 0, 1] +MkX [2, 2, 2] ----- MkX [2, 2, 2] ----- -MkX [2, 2, 1] +MkX [0, 2, 1] +----- +MkX [2, 0, 2] ----- MkX [2, 2, 2] diff --git a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected index 0f905df79..49ad508b2 100644 --- a/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected +++ b/tests/derivation/least-effort/run/specialise/04-7 non-ty imm-deep-diff givn-gend/expected @@ -41,27 +41,27 @@ Generated values: ----- (18 ** MkX [13]) ----- -(7 ** MkX [0]) +(7 ** MkX [4]) ----- -(2 ** MkX [1]) +(10 ** MkX [0]) ----- ----- (16 ** MkX [8, 15, 1]) ----- -(10 ** MkX [2, 9, 1]) +(10 ** MkX [4, 2, 9]) ----- -(5 ** MkX [4, 4, 4]) +(4 ** MkX [0, 2, 3]) ----- -(4 ** MkX [3, 0, 3]) +(11 ** MkX [10, 0, 2]) ----- -(3 ** MkX [2, 2, 1]) ------ -(10 ** MkX [6, 5, 7]) +(10 ** MkX [6, 3, 7]) ----- (4 ** MkX [1, 1, 3]) ----- -(15 ** MkX [13, 4, 14]) +(15 ** MkX [13, 1, 14]) ----- (13 ** MkX [11, 12, 11]) ----- (9 ** MkX [4, 8, 8]) +----- +(10 ** MkX [9, 1, 9]) diff --git a/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/expected new file mode 100644 index 000000000..5360cfd7d --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/04-8 non-ty imm-deep-diff givn-gend/expected @@ -0,0 +1,67 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +Generated values: +----- +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +(0 ** MkX []) +----- +----- +(16 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +----- +(17 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +----- +(17 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +----- +(12 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +----- +(8 ** MkX [0, 0, 0, 0, 0, 0, 0, 0]) +----- +(16 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +----- +(5 ** MkX [0, 0, 0, 0, 0]) +----- +(4 ** MkX [0, 0, 0, 0]) +----- +(6 ** MkX [0, 0, 0, 0, 0, 0]) +----- +(15 ** MkX [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) +----- +----- +(16 ** MkX [1, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 0, 2, 1]) +----- +(5 ** MkX [2, 2, 0, 1, 2]) +----- +(9 ** MkX [2, 2, 2, 2, 2, 0, 0, 2, 2]) +----- +(6 ** MkX [2, 0, 2, 2, 0, 2]) +----- +(3 ** MkX [1, 2, 0]) +----- +(18 ** MkX [2, 2, 2, 2, 2, 1, 0, 2, 2, 2, 2, 0, 2, 2, 0, 2, 2, 2]) +----- +(2 ** MkX [2, 0]) +----- +(15 ** MkX [1, 2, 2, 2, 2, 1, 2, 0, 1, 1, 2, 2, 2, 2, 2]) +----- +(13 ** MkX [2, 2, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 1]) +----- +(18 ** MkX [1, 2, 2, 2, 1, 2, 2, 2, 2, 1, 2, 2, 0, 0, 0, 0, 1, 1]) diff --git a/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/expected b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/expected index e67ad2e6f..4d7106cf1 100644 --- a/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/expected +++ b/tests/derivation/least-effort/run/specialise/05-0 non-ty complex exist-both/expected @@ -5,22 +5,22 @@ LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared Generated values: ----- ----- -MkX [6, 6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 8] +MkX [6, 6, 5, 13, 7, 14, 6, 10, 0, 12, 7, 6, 14, 3, 11, 7] ----- -MkX [8, 9, 8, 9, 9, 8, 8, 8, 9, 6] +MkX [8, 9, 8, 9, 9, 8, 8, 8, 9, 2] ----- -MkX [10, 7, 11, 11, 11, 7, 11, 1, 11, 2, 7, 10] +MkX [3, 10, 7, 11, 11, 11, 7, 11, 1, 11, 5, 11] ----- -MkX [0] +MkX [1, 2, 1] ----- -MkX [] +MkX [16, 2, 15, 3, 0, 6, 1, 14, 12, 6, 0, 7, 2, 1, 16, 15, 3] ----- -MkX [5, 0, 2, 1, 11, 4, 11, 5, 10, 3, 3, 9] +MkX [0, 4, 0, 0, 1, 3] ----- -MkX [0] +MkX [2, 1, 2] ----- -MkX [3, 3, 3, 3] +MkX [2, 0, 0, 3, 1, 4, 0, 7, 1] ----- MkX [1, 0] ----- -MkX [4, 4, 8, 3, 16, 5, 7, 4, 7, 0, 5, 8, 12, 1, 3, 17, 4, 12] +MkX [10, 10, 10, 4, 5, 9, 2, 2, 10, 0, 5] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected index b91a0d84f..ebc7eb350 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/expected @@ -11,7 +11,7 @@ LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Specialised type n LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Derived Test.List^4779069909474151191.List^4779069909474151191 LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type Test.List^4779069909474151191.List^4779069909474151191: Prelude.Basics.List Prelude.Types.Nat LOG 0: Test.List^4779069909474151191.List^4779069909474151191 -LOG 0: [Prelude.Types.Nat, Prelude.Basics.List, Test.List^4779069909474151191.List^4779069909474151191] +LOG 0: [Prelude.Types.Nat, Test.List^4779069909474151191.List^4779069909474151191] LOG deptycheck.test.utils.specialise:0: Expanded e: Prelude.Basics.List Prelude.Types.Nat LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] Checking specialisation need for [Prelude.Types.Nat]... LOG deptycheck.util.specialisation:20: Prelude.Basics.List[0] ({arg:1} := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising From 8eea0d4c07196a13481a2db27485ceae4c760391 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 4 Feb 2026 18:20:45 +0300 Subject: [PATCH 63/81] [ new ] Fix long line lint --- elab-util-extra/src/Deriving/SpecialiseData.idr | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 2f7581db6..e14c03198 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -373,7 +373,9 @@ getTask resultName resultKind resultContent = do -- Prove all its arguments/constructors/constructor arguments are named let Yes polyTyNamed = areAllTyArgsNamed polyTy | No _ => throwError $ UnnamedArgInPolyTyError polyTy.name - let specInvocation = reAppAny (var (inGenNSImpl currentNs (snd $ unNS $ resultName) (snd $ unNS $ resultName))) $ ttArgs.appsWith @{ttArgsNamed} var empty + let specInvocation = reAppAny + (var (inGenNSImpl currentNs (snd $ unNS $ resultName) (snd $ unNS $ resultName))) $ + ttArgs.appsWith @{ttArgsNamed} var empty pure $ MkSpecTask { tqArgs , tqRet From dba286ccaad09771cd4ea9cabb10fbdc23c73977 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 4 Feb 2026 19:12:28 +0300 Subject: [PATCH 64/81] [ refactor ] Clean up specialiser code - Remove obsolete implementations and unneeded functions - Document some new functions --- .../src/Deriving/SpecialiseData.idr | 169 +++--------------- 1 file changed, 26 insertions(+), 143 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index e14c03198..84e2d89cb 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -101,6 +101,7 @@ Show SpecTask where , showArg t.currentNs , showArg t.resultName , showArg t.fullInvocation + , showArg t.specInvocation , showArg "" ] @@ -204,25 +205,6 @@ transformArgNames f as = do let aliases = transformArgNames' f as (applyArgAliases as aliases empty, aliases) -||| Given a list of aliased argument pairs, generate a list of equality type -||| for each pair -mkEqualsTuple : List (Subset Arg IsNamedArg, Subset Arg IsNamedArg) -> TTImp -mkEqualsTuple [] = `(MkUnit) -mkEqualsTuple [(Element a1 _, Element a2 _)] = - `(~(var $ argName a1) ~=~ ~(var $ argName a2)) -mkEqualsTuple ((Element a1 _, Element a2 _) :: as) = - `(Pair (~(var $ argName a1) ~=~ ~(var $ argName a2)) ~(mkEqualsTuple as)) - -||| Given a list of aliased argument pairs [(a, b), ...], generate a series of -||| named applications: (... {a=a} {b=a}) -mkDoubleBinds : SnocList (Arg, Arg) -> TTImp -> TTImp -mkDoubleBinds [<] t = t -mkDoubleBinds (as :< (a1, a2)) t = - case (a1.name, a2.name) of - (Just a1n, Just a2n) => - mkDoubleBinds as t .! (a1n, bindVar a1n) .! (a2n, bindVar a1n) - _ => mkDoubleBinds as t - ||| Make an argument omega implicit if it is explicit hideExplicitArg : Arg -> Arg hideExplicitArg a = { piInfo := if a.piInfo == ExplicitArg then ImplicitArg else a.piInfo } a @@ -241,9 +223,10 @@ tupleOfN 0 _ = `(Unit) tupleOfN 1 t = t tupleOfN (S n) t = `(MkPair ~(t) ~(tupleOfN n t)) -||| Map all unmapped variables from the list to their aliases -mergeAliases : SortedMap Name TTImp -> List (Name, Name) -> SortedMap Name TTImp -mergeAliases m = mergeWith (Prelude.curry fst) m . fromList . map (mapSnd var) +tupleOf : List TTImp -> TTImp +tupleOf [] = `(()) +tupleOf [x] = x +tupleOf (x :: xs) = `(MkPair ~x ~(tupleOf xs)) ||| Proof that hideExplicitArg doesn't affect namedness of arguments hideExplicitArgPreservesNames : @@ -479,10 +462,17 @@ record TypeMeta where constructor MkTyMeta conMeta : List ConMeta -tupleOf : List TTImp -> TTImp -tupleOf [] = `(()) -tupleOf [x] = x -tupleOf (x :: xs) = `(MkPair ~x ~(tupleOf xs)) +amrContent : Arg -> ArgMeta -> (Name -> Name) -> TTImp +amrContent a (MkAMeta False) _ = `(_) +amrContent a (MkAMeta True) alias = bindVar $ alias $ fromMaybe "" a.name + +argMaybeRecursive : (Name -> Name) -> (Arg, ArgMeta) -> AnyApp +argMaybeRecursive alias (a@(MkArg count ExplicitArg name type), am) = PosApp $ amrContent a am alias +argMaybeRecursive alias (a@(MkArg count _ name type), am) = NamedApp (fromMaybe "" name) $ amrContent a am alias + +conOnlyRecursivesAliased : Con -> ConMeta -> (Name -> Name) -> TTImp +conOnlyRecursivesAliased con meta alias = + reAppAny (var con.name) $ argMaybeRecursive alias <$> zip con.args meta.argMeta parameters (t : SpecTask) --------------------------- @@ -866,23 +856,11 @@ parameters (t : SpecTask) --- CAST INJECTIVITY DERIVATION --- ----------------------------------- + ||| Emit a recursive call to castInjImpl constructing the proof from given names recCastInj : Name -> Name -> TTImp recCastInj p1 p2 = `(~(var $ inGenNS t $ "castInjImpl") $ trans ~(var p1) $ sym ~(var p2)) - amrContent : Arg -> ArgMeta -> (Name -> Name) -> TTImp - amrContent a (MkAMeta False) _ = `(_) - amrContent a (MkAMeta True) alias = bindVar $ alias $ fromMaybe "" a.name - - argMaybeRecursive : (Name -> Name) -> (Arg, ArgMeta) -> AnyApp - argMaybeRecursive alias (a@(MkArg count ImplicitArg name type), am) = NamedApp (fromMaybe "" name) $ amrContent a am alias - argMaybeRecursive alias (a@(MkArg count ExplicitArg name type), am) = PosApp $ amrContent a am alias - argMaybeRecursive alias (a@(MkArg count AutoImplicit name type), am) = NamedApp (fromMaybe "" name) $ amrContent a am alias - argMaybeRecursive alias (a@(MkArg count (DefImplicit x) name type), am) = NamedApp (fromMaybe "" name) $ amrContent a am alias - - conOnlyRecursivesAliased : Con -> ConMeta -> (Name -> Name) -> TTImp - conOnlyRecursivesAliased con meta alias = - reAppAny (var con.name) $ argMaybeRecursive alias <$> zip con.args meta.argMeta - + ||| Generate a with-clause corresponding to a single recursive argument mkArgWithClause : Name -> TTImp -> Clause -> Clause mkArgWithClause argName existingLhs inner = do let mToPImpl = var $ inGenNS t "mToPImpl" @@ -894,10 +872,12 @@ parameters (t : SpecTask) withClause `(~existingLhs | _) MW `(~mToPImpl ~rhsArg) p2 [] [inner] ] + ||| Wrap a term into a number of `IAppWith`s with underscores withManyUnders : Nat -> TTImp -> TTImp withManyUnders 0 x = x withManyUnders (S n) x = withManyUnders n `(~x | _) + ||| Generate a final with-clause that matches all equality proofs to `Refl`s mkFinalClause : (con : Con) -> (0 _ : ConArgsNamed con) => ConMeta -> Clause mkFinalClause con meta = do let emptyCon = con.apply (\_ => `(_)) empty @@ -910,17 +890,20 @@ parameters (t : SpecTask) `(~initialLhs | ~(tupleOfN recArgAmount `(Refl))) .= `(Refl) ] + ||| Generate a left-hand-side for recursive argument with-clauses mkInitialLhs : Con -> ConMeta -> TTImp mkInitialLhs con meta = do let lhsCon = conOnlyRecursivesAliased con meta $ prependS "lhs^" let rhsCon = conOnlyRecursivesAliased con meta $ prependS "rhs^" var "castInjImpl" .! ("castInj^x", lhsCon) .! ("castInj^y", rhsCon) .$ bindVar "prf" + ||| Wrap a clause in with-clauses for all given names mkRecArgClauses : List Name -> TTImp -> Clause -> Clause mkRecArgClauses [] exLhs inner = inner mkRecArgClauses (x :: xs) exLhs inner = mkArgWithClause x exLhs $ mkRecArgClauses xs `(~exLhs | _ | _) inner - mkCastInjClause' : + ||| Derive a single cast injectivity clause + mkCastInjClause : UnificationResult -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => @@ -931,7 +914,7 @@ parameters (t : SpecTask) ConMeta -> Nat -> Clause - mkCastInjClause' ur mt _ con meta n = do + mkCastInjClause ur mt _ con meta n = do if not (hasRecursiveArgs meta) then do let emptyCon = con.apply (\_ => `(_)) empty @@ -942,39 +925,6 @@ parameters (t : SpecTask) let initLhs = mkInitialLhs con meta mkRecArgClauses recNames initLhs finalClause - ||| Make a clause for the cast injectivity proof - mkCastInjClause : - (tal1, tal2 : (List Arg, List (Name, Name))) -> - (n1, n2 : Name) -> - UnificationResult -> - (mt : TypeInfo) -> - (0 _ : AllTyArgsNamed mt) => - (con : Con) -> - (0 cn : ConArgsNamed con) => - (mcon : Con) -> - (0 mcn : ConArgsNamed mcon) => - ConMeta -> - Nat -> - Clause - mkCastInjClause (ta1, tam1) (ta2, tam2) n1 n2 ur mt _ con meta n = do - let 0 _ = conArgsNamed @{mcn} - let (Element a1 _, am1) = transformArgNames (prependS "lhs^") con.args - let (Element a2 _, am2) = transformArgNames (prependS "rhs^") con.args - let am1' = fromList $ mapSnd (const `(_)) <$> am1 - let am2' = fromList $ mapSnd (const `(_)) <$> am2 - let ures1 = substituteVariables am1' <$> ur.fullResult - let ures2 = substituteVariables am2' <$> ur.fullResult - let bta1 = aliasedAppBind (cast tam1) `(castInjImpl) - let bta2 = aliasedAppBind (cast tam2) bta1 - let lhsCon = con.apply bindVar $ am1' - let rhsCon = con.apply bindVar $ am1' - let patRhs : TTImp - patRhs = case (length a1) of - 0 => `(Refl) - _ => (var $ inGenNS t $ fromString $ "mCong\{show n}") .$ - ((var $ inGenNS t $ fromString $ "mInj\{show n}") .$ var "r") - bta2 .! (n1, lhsCon) .! (n2, rhsCon) .$ bindVar "r" .= patRhs - ||| Derive cast injectivity proof mkCastInjDecls : UniResults -> @@ -996,7 +946,7 @@ parameters (t : SpecTask) ~=~ ~(mToPImplVar .$ var yVar)) -> ~(var xVar) ~=~ ~(var yVar)) - let castInjImplClauses = map2UConsN (mkCastInjClause') ur ti meta + let castInjImplClauses = map2UConsN mkCastInjClause ur ti meta [ claim M0 Public [] "castInjImpl" $ forallMTArgs $ pi arg1 $ pi arg2 $ eqs , def "castInjImpl" castInjImplClauses , claim M0 Public [Hint False] "castInj" $ forallMTArgs $ @@ -1223,73 +1173,6 @@ parameters (t : SpecTask) , onFull ] -------------------------------------- ---- SPECIALISATION TASK INTERFACE --- -------------------------------------- - -||| Valid task lambda interface -||| -||| Auto-implemented by any Type or any function that returns Type. --- export --- interface TaskLambda (t : Type) where --- --- export --- TaskLambda Type --- --- %hint --- export --- tlImplTy : (a : Type) -> TaskLambda a --- --- export --- TaskLambda b => TaskLambda (a -> b) --- --- export --- TaskLambda b => TaskLambda (a => b) --- --- export --- TaskLambda b => TaskLambda ({_ : a} -> b) --- --- export --- {x : _} -> TaskLambda b => TaskLambda ({default x _ : a} -> b) --- --- export --- TaskLambda b => TaskLambda ((0 _ : a) -> b) --- --- export --- TaskLambda b => TaskLambda ((0 _ : a) => b) --- --- export --- TaskLambda b => TaskLambda ({0 _ : a} -> b) --- --- export --- {0 x : _} -> TaskLambda b => TaskLambda ({default x 0 _ : a} -> b) --- --- %hint --- export --- tlImpl0 : {a : Type} -> {0 f : a -> Type} -> (x : a) => TaskLambda (f x) => TaskLambda ((x : a) -> f x) --- --- export --- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda (a => f a) --- --- export --- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ({_: a} -> f a) --- --- export --- {x : _} -> {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ({default x _: a} -> f a) --- --- export --- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ((0 _ : a) -> f a) --- --- export --- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ((0 _ : a) => f a) --- --- export --- {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ({0 _: a} -> f a) --- --- export --- {0 x : _} -> {0 f : _ -> _} -> TaskLambda (f a) => TaskLambda ({default x 0 _: a} -> f a) - - --------------------------- --- DATA SPECIALISATION --- --------------------------- From 7d9f794d03d63ad92b231f95e87821b424176219 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 9 Feb 2026 12:48:31 +0300 Subject: [PATCH 65/81] [ new ] Add test for failing specialisation in pil-reg It fails for now --- .../specdata-027-reproPilReg/Shared.idr | 1 + .../specdata-027-reproPilReg/Test.idr | 25 +++++++++++++++++++ .../specdata-027-reproPilReg/expected | 4 +++ .../specdata-027-reproPilReg/run | 1 + .../specdata-027-reproPilReg/test.ipkg | 1 + 5 files changed, 32 insertions(+) create mode 120000 elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Shared.idr create mode 100644 elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Test.idr create mode 100644 elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/expected create mode 120000 elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/run create mode 120000 elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/test.ipkg diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Test.idr b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Test.idr new file mode 100644 index 000000000..fbb9c90bc --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Test.idr @@ -0,0 +1,25 @@ +module Test + +import Shared + +%default total + +%language ElabReflection + +public export +data Lookup : a -> List (a, b) -> Type where + Here : (y : b) -> Lookup x $ (x, y)::xys + There : Lookup z xys -> Lookup z $ (x, y)::xys + +public export +data Type' = Bool' | Int' | String' + + +%runElab specialiseDataLam' "Y" $ + \ x => + \ y => + Lookup + {b = Builtin.Pair String (Type', Type')} + {a = Type'} + x + y diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/expected b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/expected new file mode 100644 index 000000000..f0a6c1ab6 --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/expected @@ -0,0 +1,4 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) +Error: Error during reflection: Mismatch between: Type' -> List (Type', (String, (Type', Type'))) -> Type and (fv^Y^x : Type') -> ?_ -> Type. + diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/run b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/run new file mode 120000 index 000000000..64c976f45 --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/run @@ -0,0 +1 @@ +../_shared/run \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/test.ipkg b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/test.ipkg new file mode 120000 index 000000000..f5e58508a --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/test.ipkg @@ -0,0 +1 @@ +../_shared/test/test.ipkg \ No newline at end of file From e9b77de2400f7d9680d93243269566744d1458f9 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 9 Feb 2026 14:46:02 +0300 Subject: [PATCH 66/81] [ new ] Improve normaliseTask type resolution --- .../src/Deriving/SpecialiseData.idr | 53 +++++++++++++++++-- .../{run => dont-run} | 0 2 files changed, 48 insertions(+), 5 deletions(-) rename elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/{run => dont-run} (100%) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 84e2d89cb..d856eaae4 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -1211,13 +1211,56 @@ specialiseDataRaw resultName resultKind resultContent = do decls <- specDecls task uniResults specTy specMeta pure (specTy, decls) +-- export +-- normaliseTask : Elaboration m => List Arg -> TTImp -> m (TTImp, TTImp) +-- normaliseTask fvs ret = do +-- lamTy : Type <- check $ piAll `(Type) fvs +-- lam <- normaliseAs lamTy $ foldr lam ret fvs +-- lamTy' <- quote lamTy +-- pure (lamTy', lam) + +typeDPair : List Arg -> TTImp +typeDPair [] = `(Type) +typeDPair (x :: xs) = do + let aName = fromMaybe "" x.name + let aTyName = fromString "\{aName}^ty" + let tyArg = MkArg MW ExplicitArg (Just aTyName) `(Type) + let tyVar = var aTyName + let valArg = MkArg MW ExplicitArg (Just aName) tyVar + `(DPair Type ~(lam tyArg `(DPair ~tyVar ~(lam valArg $ typeDPair xs)))) + -- lam tyArg $ lam valArg $ typeDPair xs + +valDPair : List Arg -> TTImp -> TTImp +valDPair [] x = x +valDPair (x :: xs) y = do + let aName = fromMaybe "" x.name + let aTyName = fromString "\{aName}^ty" + let tyVar = var aTyName + let valVar = var aName + `(MkDPair ? ~(iLet MW aName `(?) `(?) `(MkDPair ~valVar ~(valDPair xs y)))) + + + +unMkDPair : TTImp -> List TTImp +unMkDPair (IApp _ (IApp _ (INamedApp _ (INamedApp _ (IVar _ "Builtin.DPair.MkDPair") _ _) _ _) dl) dr) = + dl :: unMkDPair dr +unMkDPair _ = [] + +decodeDPair : Elaboration m => List Arg -> List TTImp -> m (List Arg) +decodeDPair [] _ = pure [] +decodeDPair (a :: as) (aT :: _ :: ts) = pure $ ({type := aT} a) :: !(decodeDPair as ts) +decodeDPair _ _ = fail "INTERNAL ERROR: Failed during lambda normalisation" + export normaliseTask : Elaboration m => List Arg -> TTImp -> m (TTImp, TTImp) -normaliseTask fvs ret = do - lamTy : Type <- check $ piAll `(Type) fvs - lam <- normaliseAs lamTy $ foldr lam ret fvs - lamTy' <- quote lamTy - pure (lamTy', lam) +normaliseTask lamArgs lamRhs = do + nT : Type <- check $ typeDPair lamArgs + nV : nT <- check $ valDPair lamArgs lamRhs + nVQ <- quote nV + newArgs <- decodeDPair lamArgs $ unMkDPair nVQ + let newLamTy = piAll `(Type) newArgs + let newLam = foldr lam lamRhs newArgs + pure (newLamTy, newLam) export specialiseDataArgs : diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/run b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/dont-run similarity index 100% rename from elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/run rename to elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/dont-run From fadb0a9ea25bded14dbb204fcfdf2ac3dc785895 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 9 Feb 2026 14:55:05 +0300 Subject: [PATCH 67/81] [ refactor ] Adjust specdata-027 to be abour normalisation --- .../specdata-027-reproPilReg/Test.idr | 23 +++++++++++++------ .../specdata-027-reproPilReg/expected | 2 -- .../{dont-run => run} | 0 3 files changed, 16 insertions(+), 9 deletions(-) rename elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/{dont-run => run} (100%) diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Test.idr b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Test.idr index fbb9c90bc..8c082c676 100644 --- a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/Test.idr @@ -15,11 +15,20 @@ public export data Type' = Bool' | Int' | String' -%runElab specialiseDataLam' "Y" $ + +%runElab do + let task = \ x => - \ y => - Lookup - {b = Builtin.Pair String (Type', Type')} - {a = Type'} - x - y + \ y => + Lookup + {b = Builtin.Pair String (Type', Type')} + {a = Type'} + x + y + qtask <- quote task + let (lArgs, lRhs) = unLambda qtask + (nlt', nl') <- normaliseTask lArgs lRhs + nlt : Type <- check nlt' + nl : nlt <- check nl' + specialiseDataLam' "Y" nl + diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/expected b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/expected index f0a6c1ab6..4a77231de 100644 --- a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/expected +++ b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/expected @@ -1,4 +1,2 @@ 1/2: Building Shared (Shared.idr) 2/2: Building Test (Test.idr) -Error: Error during reflection: Mismatch between: Type' -> List (Type', (String, (Type', Type'))) -> Type and (fv^Y^x : Type') -> ?_ -> Type. - diff --git a/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/dont-run b/elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/run similarity index 100% rename from elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/dont-run rename to elab-util-extra/tests/specialise-data/specdata-027-reproPilReg/run From f05521d05e06f2134bad42f973c710aaddda3cbc Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 9 Feb 2026 16:14:40 +0300 Subject: [PATCH 68/81] [ fix ] Arg name <-> hole conversion in task normalisation --- .../src/Deriving/SpecialiseData.idr | 53 +++++++++++++------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index d856eaae4..4d014822d 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -1211,14 +1211,6 @@ specialiseDataRaw resultName resultKind resultContent = do decls <- specDecls task uniResults specTy specMeta pure (specTy, decls) --- export --- normaliseTask : Elaboration m => List Arg -> TTImp -> m (TTImp, TTImp) --- normaliseTask fvs ret = do --- lamTy : Type <- check $ piAll `(Type) fvs --- lam <- normaliseAs lamTy $ foldr lam ret fvs --- lamTy' <- quote lamTy --- pure (lamTy', lam) - typeDPair : List Arg -> TTImp typeDPair [] = `(Type) typeDPair (x :: xs) = do @@ -1228,18 +1220,33 @@ typeDPair (x :: xs) = do let tyVar = var aTyName let valArg = MkArg MW ExplicitArg (Just aName) tyVar `(DPair Type ~(lam tyArg `(DPair ~tyVar ~(lam valArg $ typeDPair xs)))) - -- lam tyArg $ lam valArg $ typeDPair xs -valDPair : List Arg -> TTImp -> TTImp -valDPair [] x = x -valDPair (x :: xs) y = do +valDPair : SortedMap Name String -> List Arg -> TTImp -> TTImp +valDPair n2s [] x = x +valDPair n2s (x :: xs) y = do let aName = fromMaybe "" x.name let aTyName = fromString "\{aName}^ty" let tyVar = var aTyName let valVar = var aName - `(MkDPair ? ~(iLet MW aName `(?) `(?) `(MkDPair ~valVar ~(valDPair xs y)))) + let valHole = fromMaybe `(?) $ hole <$> lookup aName n2s + `(MkDPair ~(x.type) ~(iLet MW aName x.type valHole `(MkDPair ~valVar ~(valDPair n2s xs y)))) + +unholeImpl : SortedMap String Name -> TTImp -> TTImp +unholeImpl s2n (IHole fc holeName) = + case lookup holeName s2n of + Just vn => var vn + Nothing => IHole fc holeName +unholeImpl s2n t = t +unhole : SortedMap String Name -> TTImp -> TTImp +unhole s2n = mapTTImp (unholeImpl s2n) +unBadHoleImpl : TTImp -> TTImp +unBadHoleImpl (IHole fc "_") = Implicit fc False +unBadHoleImpl t = t + +unBadHole : TTImp -> TTImp +unBadHole = mapTTImp unBadHoleImpl unMkDPair : TTImp -> List TTImp unMkDPair (IApp _ (IApp _ (INamedApp _ (INamedApp _ (IVar _ "Builtin.DPair.MkDPair") _ _) _ _) dl) dr) = @@ -1251,13 +1258,27 @@ decodeDPair [] _ = pure [] decodeDPair (a :: as) (aT :: _ :: ts) = pure $ ({type := aT} a) :: !(decodeDPair as ts) decodeDPair _ _ = fail "INTERNAL ERROR: Failed during lambda normalisation" +genAliases : Elaboration m => List Arg -> m (SortedMap Name String, SortedMap String Name) +genAliases = foldlM genAImpl (empty, empty) + where + genAImpl : + (SortedMap Name String, SortedMap String Name) -> + Arg -> + m (SortedMap Name String, SortedMap String Name) + genAImpl (n2s, s2n) a = do + randN <- genSym "lamArg" + let s = show randN + let n = fromMaybe "" a.name + pure (insert n s n2s, insert s n s2n) + export normaliseTask : Elaboration m => List Arg -> TTImp -> m (TTImp, TTImp) normaliseTask lamArgs lamRhs = do - nT : Type <- check $ typeDPair lamArgs - nV : nT <- check $ valDPair lamArgs lamRhs + (n2s, s2n) <- genAliases lamArgs + nT : Type <- check $ unBadHole $ typeDPair lamArgs + nV : nT <- check $ unBadHole $ valDPair n2s lamArgs lamRhs nVQ <- quote nV - newArgs <- decodeDPair lamArgs $ unMkDPair nVQ + newArgs <- decodeDPair lamArgs $ unMkDPair $ unBadHole $ unhole s2n nVQ let newLamTy = piAll `(Type) newArgs let newLam = foldr lam lamRhs newArgs pure (newLamTy, newLam) From d664637a61fee28ef8622c0b1941fdb0976f1897 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Wed, 11 Feb 2026 16:24:19 +0300 Subject: [PATCH 69/81] [ fix ] Give normalizer better types --- .../DepTyCheck/Util/Specialisation.idr | 16 ++++++++--- .../07-0 list-lookup/DerivedGen.idr | 27 +++++++++++++++++++ .../07-0 list-lookup/RunDerivedGen.idr | 1 + .../specialise/07-0 list-lookup/derive.ipkg | 1 + .../run/specialise/07-0 list-lookup/expected | 25 +++++++++++++++++ .../run/specialise/07-0 list-lookup/run | 1 + 6 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 tests/derivation/least-effort/run/specialise/07-0 list-lookup/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/07-0 list-lookup/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/07-0 list-lookup/derive.ipkg create mode 100644 tests/derivation/least-effort/run/specialise/07-0 list-lookup/expected create mode 120000 tests/derivation/least-effort/run/specialise/07-0 list-lookup/run diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index a42a37a13..5cd519268 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -73,14 +73,24 @@ getGivens (x :: xs) aa = do let (mr, aa) = getGiven x aa mr :: getGivens xs aa -allQImpl : Monad m => TTImp -> m TTImp -> m TTImp +allQImpl : Monad m => NamesInfoInTypes => TTImp -> m TTImp -> m TTImp allQImpl pi@(IPi _ _ _ _ _ _) r = r +allQImpl app@(IApp _ _ _) r = do + IApp _ procL _ <- r + | _ => pure `(?) + case procL of + Implicit _ _ => pure `(?) + _ => r +allQImpl v@(IVar _ n) _ = + case lookupType n of + Just _ => pure v + Nothing => pure `(?) allQImpl _ _ = pure `(?) ||| Replace every non-function sub-expression with a question mark ||| ||| (x -> (y -> z) -> q) becomes (? -> (? -> ?) -> ?) -allQuestions : TTImp -> TTImp +allQuestions : NamesInfoInTypes => TTImp -> TTImp allQuestions t = runIdentity $ mapATTImp' allQImpl t ||| An abstract "argument" of a generator @@ -143,7 +153,7 @@ mkArgs sig ((i1, x) :: xs) g@((i2, y) :: ys) = then MkGenArg x (Just y) :: mkArgs sig xs ys else MkGenArg x Nothing :: mkArgs sig xs g -singleArg : Nat -> GenArg -> (TTImp, List GenArg) +singleArg : NamesInfoInTypes => Nat -> GenArg -> (TTImp, List GenArg) singleArg n (MkGenArg a v) = do let n : Name = fromString "lam^\{show n}" (IVar EmptyFC n, [MkGenArg (MkArg a.count a.piInfo (Just n) $ allQuestions a.type) v]) diff --git a/tests/derivation/least-effort/run/specialise/07-0 list-lookup/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/DerivedGen.idr new file mode 100644 index 000000000..dcd4b2529 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/DerivedGen.idr @@ -0,0 +1,27 @@ +module DerivedGen + +import RunDerivedGen + +%default total + + +public export +data Lookup : a -> List (a, b) -> Type where + Here : (y : b) -> Lookup x $ (x, y)::xys + There : Lookup z xys -> Lookup z $ (x, y)::xys + +Show a => Show b => Show (Lookup {a=a} {b=b} x xs) where + showPrec d $ Here y = showCon d "Here" $ showArg y + showPrec d $ There y = showCon d "There" $ showArg y + +data UseLookup : Type where + UL : Lookup True [(True, True, True, True)] -> UseLookup + +Show UseLookup where + showPrec d $ UL y = showCon d "UL" $ showArg y + +checkedGen : Fuel -> Gen MaybeEmpty UseLookup +checkedGen = deriveGen @{MainCoreDerivator @{LeastEffort}} + +main : IO Unit +main = runGs [ G checkedGen ] diff --git a/tests/derivation/least-effort/run/specialise/07-0 list-lookup/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/07-0 list-lookup/derive.ipkg b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/07-0 list-lookup/expected b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/expected new file mode 100644 index 000000000..ed9687930 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/expected @@ -0,0 +1,25 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: DerivedGen.Lookup[0(b), 1(a), 2, 3] Declared specialised type DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048: DerivedGen.Lookup {b = Builtin.Pair Prelude.Basics.Bool (Builtin.Pair Prelude.Basics.Bool Prelude.Basics.Bool)} {a = Prelude.Basics.Bool} lam^0 lam^1 +Generated values: +----- +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) +----- +UL (Here (True, (True, True))) diff --git a/tests/derivation/least-effort/run/specialise/07-0 list-lookup/run b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 1717d9ff57722b2a6712827350adb5ce1c68a359 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 16 Feb 2026 16:11:39 +0300 Subject: [PATCH 70/81] [ new ] Use polymorphic types in PilFun --- examples/pil-fun/src/Language/PilFun.idr | 153 ++++-------------- examples/pil-fun/src/Language/PilFun/DSL.idr | 12 +- .../pil-fun/src/Language/PilFun/Derived.idr | 1 + .../pil-fun/src/Language/PilFun/Pretty.idr | 10 +- .../src/Language/PilFun/Pretty/Idris2.idr | 10 +- .../src/Language/PilFun/Pretty/Scala3.idr | 2 +- examples/pil-fun/tests/lang/usage/UsePil.idr | 4 +- 7 files changed, 49 insertions(+), 143 deletions(-) diff --git a/examples/pil-fun/src/Language/PilFun.idr b/examples/pil-fun/src/Language/PilFun.idr index 140bdedf9..d63cf3967 100644 --- a/examples/pil-fun/src/Language/PilFun.idr +++ b/examples/pil-fun/src/Language/PilFun.idr @@ -2,11 +2,15 @@ module Language.PilFun import public Data.Fuel import public Data.Nat +import public Data.SnocList +import public Data.SnocList.Quantifiers import Decidable.Equality import Test.DepTyCheck.Gen +%default total + -- Types of this primitive imperative language public export data Ty = Int' | Bool' @@ -23,19 +27,6 @@ data Literal : Ty -> Type where I : Nat -> Literal Int' B : Bool -> Literal Bool' -public export -data MaybeTy = Nothing | Just Ty - -export -Injective PilFun.Just where injective Refl = Refl - -export -DecEq MaybeTy where - decEq Nothing Nothing = Yes Refl - decEq (Just t) (Just t') = decEqCong (decEq t t') - decEq Nothing (Just _) = No $ \case Refl impossible - decEq (Just _) Nothing = No $ \case Refl impossible - public export data Mut = Mutable | Immutable @@ -46,96 +37,41 @@ DecEq Mut where decEq Mutable Immutable = No $ \case Refl impossible decEq Immutable Mutable = No $ \case Refl impossible -namespace SnocListTy - - public export - data SnocListTy : Type where - Lin : SnocListTy - (:<) : SnocListTy -> Ty -> SnocListTy - - public export - snocListTyToList : SnocListTy -> List Ty - snocListTyToList Lin = [] - snocListTyToList (xs :< x) = (snocListTyToList xs) ++ [x] - - public export - length : SnocListTy -> Nat - length Lin = Z - length (sx :< _) = S $ length sx - - public export %inline - (.length) : SnocListTy -> Nat - (.length) = length - - export - Biinjective SnocListTy.(:<) where - biinjective Refl = (Refl, Refl) - - export - DecEq SnocListTy where - decEq [<] [<] = Yes Refl - decEq (sx :< x) (sx' :< x') = decEqCong2 (decEq sx sx') (decEq x x') - decEq [<] (_:<_) = No $ \case Refl impossible - decEq (_:<_) [<] = No $ \case Refl impossible - namespace SnocListTyMut public export - data SnocListTyMut : Type where - Lin : SnocListTyMut - (:<) : SnocListTyMut -> Ty -> Mut -> SnocListTyMut + data IndexIn : SnocList t -> Type where + Here : IndexIn $ (:<) sx x + There : IndexIn sx -> IndexIn $ (:<) sx x public export - data IndexIn : SnocListTyMut -> Type where - Here : IndexIn $ (:<) sx x mut - There : IndexIn sx -> IndexIn $ (:<) sx x mut - - public export - index : (sx : SnocListTyMut) -> IndexIn sx -> (Ty, Mut) - index ((:<) _ x m) Here = (x, m) - index ((:<) sx _ _) (There i) = index sx i - - public export - length : SnocListTyMut -> Nat - length Lin = Z - length ((:<) sx _ _) = S $ length sx + index : (sx : SnocList t) -> IndexIn sx -> t + index ((:<) _ x) Here = x + index ((:<) sx _) (There i) = index sx i public export %inline - (.length) : SnocListTyMut -> Nat + (.length) : SnocList _ -> Nat (.length) = length - export - DecEq SnocListTyMut where - decEq [<] [<] = Yes Refl - decEq ((:<) sx x m) ((:<) sx' x' m') with (decEq sx sx') - _ | No nsx = No $ \case Refl => nsx Refl - decEq ((:<) sx x m) ((:<) sx x' m') | Yes Refl with (decEq x x') - _ | No nx = No $ \case Refl => nx Refl - decEq ((:<) sx x m) ((:<) sx x m') | Yes Refl | Yes Refl with (decEq m m') - _ | No mx = No $ \case Refl => mx Refl - decEq ((:<) sx x m) ((:<) sx x m) | Yes Refl | Yes Refl | Yes Refl = Yes Refl - decEq [<] ((:<) _ _ _) = No $ \case Refl impossible - decEq ((:<) _ _ _) [<] = No $ \case Refl impossible - public export - data AtIndex : {sx : SnocListTyMut} -> (idx : IndexIn sx) -> Ty -> Mut -> Type where + data AtIndex : {sx : SnocList t} -> (idx : IndexIn sx) -> t -> Type where [search sx idx] - Here' : AtIndex {sx = (:<) sx ty mut} Here ty mut - There' : AtIndex {sx} i ty mut -> AtIndex {sx = (:<) sx x m} (There i) ty mut + Here' : AtIndex {sx = (:<) sx tm} Here tm + There' : AtIndex {sx} i rm -> AtIndex {sx = (:<) sx x} (There i) rm ||| Add a bunch of immutable variables public export - (++) : SnocListTyMut -> SnocListTy -> SnocListTyMut + (++) : SnocList (Ty, Mut) -> SnocList Ty -> SnocList (Ty, Mut) (++) sx Lin = sx - (++) sx (sy :< y) = (:<) (sx ++ sy) y Immutable + (++) sx (sy :< y) = (:<) (sx ++ sy) (y, Immutable) export infix 1 ==> public export record FunSig where constructor (==>) - From : SnocListTy - To : MaybeTy + From : SnocList Ty + To : Maybe Ty export Biinjective (==>) where @@ -145,56 +81,25 @@ export DecEq FunSig where decEq (f ==> t) (f' ==> t') = decEqCong2 (decEq f f') (decEq t t') -namespace SnocListFunSig - - public export - data SnocListFunSig : Type where - Lin : SnocListFunSig - (:<) : SnocListFunSig -> FunSig -> SnocListFunSig - - public export - data IndexIn : SnocListFunSig -> Type where - Here : IndexIn $ sx :< x - There : IndexIn sx -> IndexIn $ sx :< x - - public export - index : (sx : SnocListFunSig) -> IndexIn sx -> FunSig - index (_ : Nat - length Lin = Z - length (sx :< _) = S $ length sx - - public export %inline - (.length) : SnocListFunSig -> Nat - (.length) = length - - public export - data AtIndex : {sx : SnocListFunSig} -> (idx : IndexIn sx) -> FunSig -> Type where - [search sx idx] - Here' : AtIndex {sx = sx :< sig} Here sig - There' : AtIndex {sx} i sig -> AtIndex {sx = sx :< x} (There i) sig - public export Vars : Type -Vars = SnocListTyMut +Vars = SnocList (Ty, Mut) public export Funs : Type -Funs = SnocListFunSig +Funs = SnocList FunSig public export -data ExprsSnocList : Funs -> Vars -> SnocListTy -> Type +data ExprsSnocList : Funs -> Vars -> SnocList Ty -> Type public export data Expr : Funs -> Vars -> Ty -> Type where C : (x : Literal ty) -> Expr funs vars ty - V : (n : IndexIn vars) -> - AtIndex n ty mut => + V : {mut : Mut} -> + (n : IndexIn vars) -> + AtIndex n (ty, mut) => Expr funs vars ty F : (n : IndexIn funs) -> @@ -204,7 +109,7 @@ data Expr : Funs -> Vars -> Ty -> Type where ExprsSnocList funs vars from -> Expr funs vars to -data ExprsSnocList : Funs -> Vars -> SnocListTy -> Type where +data ExprsSnocList : Funs -> Vars -> SnocList Ty -> Type where Lin : ExprsSnocList funs vars [<] (:<) : ExprsSnocList funs vars sx -> Expr funs vars ty -> ExprsSnocList funs vars (sx :< ty) @@ -213,12 +118,12 @@ export infix 2 #= public export data Stmts : (funs : Funs) -> (vars : Vars) -> - (retTy : MaybeTy) -> Type where + (retTy : Maybe Ty) -> Type where NewV : (ty : Ty) -> (mut : Mut) -> (initial : Expr funs vars ty) -> - (cont : Stmts funs ((:<) vars ty mut) retTy) -> + (cont : Stmts funs ((:<) vars (ty, mut)) retTy) -> Stmts funs vars retTy NewF : (sig : FunSig) -> @@ -227,7 +132,7 @@ data Stmts : (funs : Funs) -> Stmts funs vars retTy (#=) : (n : IndexIn vars) -> - AtIndex n ty Mutable => + AtIndex n (ty, Mutable) => (v : Expr funs vars ty) -> (cont : Stmts funs vars retTy) -> Stmts funs vars retTy @@ -249,4 +154,4 @@ data Stmts : (funs : Funs) -> Nop : Stmts funs vars Nothing export -genStmts : Fuel -> (funs : Funs) -> (vars : Vars) -> (retTy : MaybeTy) -> Gen MaybeEmpty $ Stmts funs vars retTy +genStmts : Fuel -> (funs : Funs) -> (vars : Vars) -> (retTy : Maybe Ty) -> Gen MaybeEmpty $ Stmts funs vars retTy diff --git a/examples/pil-fun/src/Language/PilFun/DSL.idr b/examples/pil-fun/src/Language/PilFun/DSL.idr index 9d0a388ab..e2e91b40f 100644 --- a/examples/pil-fun/src/Language/PilFun/DSL.idr +++ b/examples/pil-fun/src/Language/PilFun/DSL.idr @@ -28,24 +28,24 @@ namespace Utils namespace SnocListTyMut.IndexIn public export - natToIndexIn : (n : Nat) -> {sx : SnocListTyMut} -> n `LT` length sx => IndexIn sx - natToIndexIn 0 {sx=(:<) sx x m} = Here - natToIndexIn (S k) {sx=(:<) sx x m} @{LTESucc l} = There $ natToIndexIn k + natToIndexIn : (n : Nat) -> {sx : SnocList (Ty, Mut)} -> n `LT` length sx => IndexIn sx + natToIndexIn 0 {sx=(:<) sx (x, m)} = Here + natToIndexIn (S k) {sx=(:<) sx (x, m)} @{LTESucc l} = There $ natToIndexIn k public export - fromInteger : {sx : SnocListTyMut} -> (n : Integer) -> (cast n `LT` length sx) => {- (x >= the Integer 0 = True) =>-} IndexIn sx + fromInteger : {sx : SnocList (Ty, Mut)} -> (n : Integer) -> (cast n `LT` length sx) => {- (x >= the Integer 0 = True) =>-} IndexIn sx fromInteger n with (cast {to=Nat} n) _ | n' = natToIndexIn (length sx `minus` S n') @{reverseLTMinus} namespace SnocListFunSig.IndexIn public export - natToIndexIn : (n : Nat) -> {sx : SnocListFunSig} -> n `LT` length sx => IndexIn sx + natToIndexIn : (n : Nat) -> {sx : SnocList FunSig} -> n `LT` length sx => IndexIn sx natToIndexIn 0 {sx=sx: (n : Integer) -> (cast n `LT` length sx) => {- (x >= the Integer 0 = True) =>-} IndexIn sx + fromInteger : {sx : SnocList FunSig} -> (n : Integer) -> (cast n `LT` length sx) => {- (x >= the Integer 0 = True) =>-} IndexIn sx fromInteger n with (cast {to=Nat} n) _ | n' = natToIndexIn (length sx `minus` S n') @{reverseLTMinus} diff --git a/examples/pil-fun/src/Language/PilFun/Derived.idr b/examples/pil-fun/src/Language/PilFun/Derived.idr index 10bc836ba..96add9a89 100644 --- a/examples/pil-fun/src/Language/PilFun/Derived.idr +++ b/examples/pil-fun/src/Language/PilFun/Derived.idr @@ -8,5 +8,6 @@ import Deriving.DepTyCheck.Gen %logging "deptycheck.derive" 5 %logging "deptycheck.derive.least-effort" 7 +%logging "deptycheck.util" 20 Language.PilFun.genStmts = deriveGen diff --git a/examples/pil-fun/src/Language/PilFun/Pretty.idr b/examples/pil-fun/src/Language/PilFun/Pretty.idr index 064825b02..4042366cd 100644 --- a/examples/pil-fun/src/Language/PilFun/Pretty.idr +++ b/examples/pil-fun/src/Language/PilFun/Pretty.idr @@ -26,11 +26,11 @@ data SupportedLanguage = Scala3 public export data ScalaCondition : FunSig -> (isInfix : Bool) -> (isPure : Bool) -> Type where IsNotInfix : ScalaCondition funSig False b - MoreThanOneArg : So (funSig.From.length >= 1) -> ScalaCondition funSig isInfix b + MoreThanOneArg : So ((length funSig.From) >= 1) -> ScalaCondition funSig isInfix b public export data IdrisCondition : FunSig -> (isInfix : Bool) -> (isPure : Bool) -> Type where - IsInfix : (a : Ty ** b : Ty ** to : MaybeTy ** funSig === ([ to)) -> (isPure : Bool) -> IdrisCondition funSig True isPure + IsInfix : (a : Ty ** b : Ty ** to : Maybe Ty ** funSig === ([ to)) -> (isPure : Bool) -> IdrisCondition funSig True isPure NotInfix : (isPure : Bool) -> IdrisCondition funSig False isPure public export @@ -57,13 +57,13 @@ data UniqNames : (l : SupportedLanguage) -> (funs : Funs) -> (vars : Vars) -> Ty {default False isInfix : Bool} -> {default False isPure : Bool} -> (languageCondition : LanguageToCondition l fun isInfix isPure) => UniqNames l (funs: (s : String) -> (0 _ : NameIsNew l funs vars ss s) => UniqNames l funs ((:<) vars var mut) + NewVar : (ss : UniqNames l funs vars) => (s : String) -> (0 _ : NameIsNew l funs vars ss s) => UniqNames l funs ((:<) vars (var, mut)) data NameIsNew : (l : SupportedLanguage) -> (funs : Funs) -> (vars : Vars) -> UniqNames l funs vars -> String -> Type where E : NameIsNew l [<] [<] Empty x J : (0 _ : So $ x /= s) -> NameIsNew l funs vars ss x -> NameIsNew l funs vars (JustNew @{ss} s @{sub}) x F : (0 _ : So $ x /= s) -> NameIsNew l funs vars ss x -> NameIsNew l (funs: NameIsNew l funs vars ss x -> NameIsNew l funs ((:<) vars var mut) (NewVar @{ss} s @{sub}) x + V : (0 _ : So $ x /= s) -> NameIsNew l funs vars ss x -> NameIsNew l funs ((:<) vars (var, mut)) (NewVar @{ss} s @{sub}) x public export interface NamesRestrictions where @@ -116,7 +116,7 @@ newVars : NamesRestrictions => Fuel -> (newNames : Gen0 String) -> (extraVars : _) -> UniqNames l funs vars -> - Gen0 (UniqNames l funs (vars ++ extraVars), Vect extraVars.length (String, Ty)) + Gen0 (UniqNames l funs (SnocListTyMut.(++) vars extraVars), Vect (SnocList.length extraVars) (String, Ty)) newVars _ _ [<] names = pure (names, []) newVars fl newNames (vs: Doc opts printTy Int' = "Int" printTy Bool' = "Bool" -printMaybeTy : MaybeTy -> Doc opts +printMaybeTy : Maybe Ty -> Doc opts printMaybeTy Nothing = "()" printMaybeTy $ Just ty = printTy ty @@ -58,8 +58,8 @@ data ArgStruct : LayoutOpts -> Type where ManyArgs : {opts : _} -> List (Doc opts) -> ArgStruct opts NoArgs : {opts : _} -> ArgStruct opts -getArgs : {from' : SnocListTy} -> - {to' : MaybeTy} -> +getArgs : {from' : SnocList Ty} -> + {to' : Maybe Ty} -> (argFs : Funs ** argVs : Vars ** argNms : UniqNames Idris2 argFs argVs ** ExprsSnocList argFs argVs from') -> {fs : Funs} -> {vs : Vars} -> @@ -166,7 +166,7 @@ printStmts fl $ NewF ([< a, b ] ==> maybeRet) body cont = do (nm ** _) <- genNewName fl nameGen _ _ names rest <- printStmts @{NewFun nm {isInfix} @{names}} fl cont let infixAwareName : Doc opts = if isInfix then "(" <+> line nm <+> ")" else line nm - let processedInputTypes : Doc opts = hsep $ (snocListTyToList [< a, b ]) <&> (\ty => printTy ty <++> "->") + let processedInputTypes : Doc opts = hsep $ (toList [< a, b ]) <&> (\ty => printTy ty <++> "->") let processedOutputType = "IO" <++> printMaybeTy maybeRet let idrisTypeSignature = processedInputTypes <++> processedOutputType (namesInside, funArgs) <- newVars fl alphaNames [< a, b ] (JustNew @{names} nm) @@ -183,7 +183,7 @@ printStmts fl $ NewF (typesFrom ==> maybeRet) body cont = do (nm ** _) <- genNewName fl alphaNames _ _ names rest <- printStmts @{NewFun nm {isInfix} @{names}} fl cont let funName = line nm - let processedInputTypes : Doc opts = hsep $ (snocListTyToList typesFrom) <&> (\ty => printTy ty <++> "->") + let processedInputTypes : Doc opts = hsep $ (toList typesFrom) <&> (\ty => printTy ty <++> "->") let processedOutputType = "IO" <++> printMaybeTy maybeRet let idrisTypeSignature = processedInputTypes <++> processedOutputType (namesInside, funArgs) <- newVars fl alphaNames _ (JustNew @{names} nm) diff --git a/examples/pil-fun/src/Language/PilFun/Pretty/Scala3.idr b/examples/pil-fun/src/Language/PilFun/Pretty/Scala3.idr index d0ccb8afa..0e3d78549 100644 --- a/examples/pil-fun/src/Language/PilFun/Pretty/Scala3.idr +++ b/examples/pil-fun/src/Language/PilFun/Pretty/Scala3.idr @@ -21,7 +21,7 @@ printTy : Ty -> Doc opts printTy Int' = "Int" printTy Bool' = "Boolean" -printMaybeTy : MaybeTy -> Doc opts +printMaybeTy : Maybe Ty -> Doc opts printMaybeTy Nothing = "Unit" printMaybeTy $ Just ty = printTy ty diff --git a/examples/pil-fun/tests/lang/usage/UsePil.idr b/examples/pil-fun/tests/lang/usage/UsePil.idr index aa416077f..5591a4384 100644 --- a/examples/pil-fun/tests/lang/usage/UsePil.idr +++ b/examples/pil-fun/tests/lang/usage/UsePil.idr @@ -67,7 +67,7 @@ failing "Can't find an implementation for AtIndex" 1 #= F Plus [< V 0, V 0] Nop -failing #"Can't find an implementation for LTE 3 (length ([ Date: Mon, 16 Feb 2026 17:08:00 +0300 Subject: [PATCH 71/81] [ fix ] Update pil-fun expected test --- examples/pil-fun/tests/gens/scala3/expected | 654 ++++---------------- 1 file changed, 113 insertions(+), 541 deletions(-) diff --git a/examples/pil-fun/tests/gens/scala3/expected b/examples/pil-fun/tests/gens/scala3/expected index 33d15c8a0..307739ab7 100644 --- a/examples/pil-fun/tests/gens/scala3/expected +++ b/examples/pil-fun/tests/gens/scala3/expected @@ -1,587 +1,159 @@ ------------------- +val ynynxspcyx: Int = + (((((0.*(6)) * (-(2))) * (5.*(6))).*(6 * (-(0)))) * ((((2.*(5)).*(2 * 0)) * (6 * 2)) * 2)) * (-(((5 * 4).+(5.*(0 * 0))).*(4.*(2.*(5))))) @main -def vdpxa(): Unit = { - if (1.*(-(3 * (2 * 2)))).==((-(3)) * ((0.*(3)).*(0))) then { - if 4 == (2.*((((2 * 6).*(0)).*(4 * (5 * 0))).*(((3.*(2)) * (4 * 0)).*(2.*(4.*(0)))))) then { - if ((5.==((6 * (-(1))).*(-(2)))) || (((0 * 6) * (2 * 0)) == (-(-(3))))) || (((4 + (-(1.*(0)))).*((4 * 4) * ((1 * 4).*(4.*(3))))) == (3 * 5)) then - {} - else - Console.println(((-(2.*(6))) * (((4.*(4)).+((2 * 0).*(4.*(6)))).*((-(0.*(2))) * 1))) * (((1 * (3.*(4 * 2))).*((3.*(5)).*(4))).*(4 + (-(0))))) - Console.println(0) - if (!((false.&&((true.&&(true)) && (!(true)))) && (2 == (5 * (-(5)))))) && true then { - - } else { - - } - - - } else { - Console.println((-(3)) * (-((6 * 2) * (((3.*(6)).*(0 * 1)) * 5)))) - val cu = () => { } - val p = (-(5)).==(6) +def jdrbitq(): Unit = { + if (-((ynynxspcyx * (-(-(1)))).+(ynynxspcyx.+((2 * 0) * ynynxspcyx)))) <= ((-(-(3 * 5))).*((-(ynynxspcyx.*(ynynxspcyx * ynynxspcyx))) * (4 + ((-(ynynxspcyx)).*(-(ynynxspcyx)))))) then { + if ynynxspcyx.==((((ynynxspcyx.+(ynynxspcyx.*(5))) * (ynynxspcyx.*(5 + 0))) * 0).*(ynynxspcyx)) then + {} + else + var te = 3 < ((2 * ((ynynxspcyx.+(ynynxspcyx)) * 1)).+(((5.*(ynynxspcyx)) + (ynynxspcyx.+(ynynxspcyx))) + ((ynynxspcyx.*(6)).*(ynynxspcyx)))) + val ewa = (ynynxspcyx * ((ynynxspcyx * (2.+(ynynxspcyx))) * ynynxspcyx)) * (ynynxspcyx * (ynynxspcyx + (2 * (-(ynynxspcyx + ynynxspcyx))))) + val flvpa = true - } - def qsrdonvvh(): Int = { - val r = (ml: Int, giiumorq: Int, yrgkhcqkn: Int, b: Int, mjejiv: Int) => - if ((-(0.*((yrgkhcqkn * mjejiv) * (6.*(mjejiv))))) == (-(ml))).&&((!(((0.*(2)) == 3) && ((2.*(giiumorq)).==(0)))) && (!(((1 * 1).*(5.*(6))).==(5)))) then - {} - else - if (((5.*(5)) * 6) * (-(((-(giiumorq)) * 6).*(2)))) == 3 then { - - } - - extension (dxx: Boolean) def m(lrutpowzm: Boolean, lojlnrcx: Int) = { } - !(((((ml * 1).*(b)) * (-(yrgkhcqkn))) * (ml.+(2.*(4)))) < ((giiumorq.+(-(6))).*(5 * 5))) - if r - ( ((-(5 + 4)).*((0 * 5) + 0)) * (-(1 * ((-(3)) * (3.+(2))))) - , ((((0.*(6)) * (6.*(5))).*(3 * 6)) * ((3.*(6)) + 0)) * (0 * (2 * (-(1)))) - , 3 * (((0.*(3)) * (-(-(3)))) + ((0 * 0) * (0.*(5.*(6))))) - , ((6.*((0.+(1)) * 2)).*(5)).+(6) - , (-(((5.*(5)) * (3.*(4))) * ((4 * 6) * (5 * 1)))) * (-(3)) - ) then - if r - ( 4.*(-(((4 * 2) * (1 + 0)).*(6))) - , -(((-(3.*(3))).*(5 * (6 * 3))) * (1 * 0)) - , 1.*((5.*((3.*(6)).*(4))) + (((1 * 6) * (-(2))).*((6.*(5)).+(4)))) - , (-(((1 * 5).*(2 * 0)).*((4 * 2).*(4)))).*(-((0 * (2.*(6))) * (4 * 1))) - , 3.*(((3 + 0).*(3)) * ((1.+(3)) * ((6 * 1).*(1)))) - ) then - {} - - else - {} - if true then { + var mmopked: Boolean = false + if mmopked then + if ((ynynxspcyx.*(6)).*(-(3))).==(-(1)) then { } else { } - -(2.+(3 * (((1 * 3) * 5).+(5)))) - } - val oeywpe = (zfz: Boolean, jmvrzlzqin: Int, irp: Int, u: Boolean, defc: Int) => { - if 1 == qsrdonvvh() then - if irp.==(irp) then { - - } - - else - Console.println(-((((6.*(qsrdonvvh())) * (qsrdonvvh() * (-(1)))).*(0 * 1)) * (-(qsrdonvvh() * 2)))) - - jmvrzlzqin * ((-(qsrdonvvh())).*((3 * (4 * jmvrzlzqin)) * 0)) - } - if false.||(((!(oeywpe(true, 6, 4, true, 5).<(-(5)))) && true).&&((2 == 6).&&((false && true) && (false && false)))) then - val rr = () => - {} else - val cgsaa: Int = - oeywpe - ( ! - ( (oeywpe - ( 3 == 4 - , 0 - , -(0) - , false.&&(false) - , 2 - ).==(oeywpe(true, 1, oeywpe(false, 4, 0, true, 1), false || true, 6))) || (!(oeywpe(true, 5, 3, true, 0).==(3))) - ) - , qsrdonvvh() - , oeywpe - ( oeywpe - ( false - , oeywpe(false, oeywpe(false, 4, 6, true, 6), oeywpe(false, 1, 0, true, 1), true && true, -(0)) - , oeywpe(true, 5, oeywpe(true, 4, 2, false, 4), true.&&(false), -(5)) - , true && (3 == 6) - , oeywpe(true, 4, 6, 5 == 5, -(4)) - ).==(5) - , oeywpe - ( 6.==(qsrdonvvh()) - , oeywpe - ( 6.==(-(1)) - , oeywpe(false.&&(false), -(5), 1, 5.==(2), 4 * 4) - , 6 - , 4.==(oeywpe(false, 0, 6, true, 5)) - , oeywpe(false, oeywpe(false, 6, 4, true, 2), oeywpe(true, 5, 5, true, 0), true, -(5)) - ) - , qsrdonvvh() - , (4 * 1) == 6 - , 5 - ) - , oeywpe(((false.&&(true)) || (4.<=(1))) && false, 1, 0, (!(6 == 6)).&&(true && false), 0) - , true - , - - ( oeywpe - ( qsrdonvvh().<=(oeywpe(false, 2, 3, false, 1)) - , 0 - , oeywpe(false && true, -(1), 0, 0.==(1), 3) - , oeywpe(true, 2, 5, true, 5).==(oeywpe(true, 6, 3, false, 0)) - , 6 - ) - ) - ) - , oeywpe - ( true && (true && (!(true))) - , -(oeywpe(true, qsrdonvvh(), 3, true, 3 * 5)) - , oeywpe(!(true), 5, oeywpe(true, 1 * 2, -(1), true, 2), false, 4) - , true - , oeywpe(4.==(4), 1, 4, true && false, 1).*(6) - ) < 3 - , oeywpe - ( true - , 0 - , oeywpe - ( !(false) - , oeywpe(3 == 1, oeywpe(false && true, 0, qsrdonvvh(), true, qsrdonvvh()), oeywpe(4 < 1, 1, 6, false, 2), !(5.==(4)), 1) - , qsrdonvvh() - , 6 == oeywpe(false, 1, 1.*(0), 1 == 0, oeywpe(true, 5, 4, false, 4)) - , oeywpe - ( false - , oeywpe(true.&&(false), oeywpe(true, 4, 4, true, 0), 3, true, 2) - , 5 - , true - , oeywpe(true, oeywpe(true, 0, 2, false, 1), 5, !(true), 3) - ) - ) - , !(oeywpe(false.||(true), 3, 0, false, oeywpe(false, 3, 5, false, 4)).<(qsrdonvvh())) - , 5 - ) - ) - - var kqeyphmd: Boolean = false - - } else { - val ojbcnbh = 5 - val fyjre: Boolean = ((ojbcnbh * ((ojbcnbh.*(1)).*(ojbcnbh))).==(ojbcnbh)).&&(((-(6)) * (1.*((5.*(1)) * 1))) == ojbcnbh) - var tuonwnoerf: Int = -((((4.*(ojbcnbh)) * ojbcnbh) + ((ojbcnbh * (-(2))).*(ojbcnbh))) + 1) - if ((3 + 5).*(ojbcnbh.*(2))).==((-(ojbcnbh)).*(2)) then - Console.println - ((((4.*(tuonwnoerf + 2)).*(((4 * ojbcnbh).*(tuonwnoerf)).+(3))) * ((3 * ojbcnbh) * ((5.*(ojbcnbh * 6)).*((1 * ojbcnbh) * 6)))) + ((ojbcnbh.*(5)).*((ojbcnbh.*((ojbcnbh * ojbcnbh).*(ojbcnbh * 3))).*((-(-(ojbcnbh))).*(ojbcnbh))))) + Console.println((ynynxspcyx + ynynxspcyx) + ynynxspcyx) + if true then + {} else {} - tuonwnoerf = ojbcnbh - - } - Console.println(0 * (((3.*((3 * 2).*(2.*(6)))) * ((-(0)) * ((2 * 3) * 0))).*(((1 * 1) * (2 + (1.+(3)))) * 3))) - var h = - ((((-(5)) * ((-(1)) * 4)) * (((2.*(5)).*(5)).*(5.*(1)))).*(3.*((6 * 1).*(6)))).+((-(((-(1)).*(6)).*((-(2)).*(5)))).*((((2 * 3) * (6.*(1))).*(0.*(5.*(0)))) * 6)) - extension (yk: Int) - def eno(): Unit = { - var hdjqmwzjvq = - ((2.==((h * (h * yk)).*((3.*(h)) * (-(1))))) && ((((false || true) || true).&&(false)) && (false && (true && (h.==(h)))))).&&(!((0.*(0)) < h)) - Console.println((((4 * (h.*(2))) * (-(5))) * 5) * (-(0))) - - } - h = (((((2.*(2)).*(h.*(h))).*(h * 0)) * 4) * 6).*(((((h.*(h)).*(h)).*((3.*(h)).*(5))) * ((h.*(6 * h)).*(h))) * (((-(h)).*(0 * h)) * (((5.*(h)) * 4) * 5))) - h = h - -} -------------------- - -val vq = 0 - -@main -def yarimzgu(): Unit = { - if !(!(6 == 0)) then { - var jlhmmq: Int = vq - extension (ghivn: Boolean) - def dypbtyxf(jbsy: Int, c: Boolean) = { - jlhmmq = -(((((vq * 5).*(vq)).*(jbsy * (vq.*(vq)))).*((3.*(jlhmmq)) * vq)) * (-(5 * 1))) - if false then - {} - ((((0.*(vq)).*(6 * 6)) * ((0.*(jbsy)).*((vq * 4).*(vq)))) * ((1 * vq) * (-(vq)))).*(-(((vq.*(1.*(vq))) + (jbsy * jlhmmq)) * ((vq * (6 * 3)) * 1))) - } - val tylbuarm: Boolean = - (true.dypbtyxf( (((6.<(6)).dypbtyxf( vq - , false - )) == (false.dypbtyxf( vq - , vq == vq - ))).dypbtyxf( (vq.==(4)).dypbtyxf( false.dypbtyxf( 5 - , false - ) - , true.&&(false) - ) - , (!(true)) || false - ) - , jlhmmq.<=(5) - )).<=( (((!(6.==(jlhmmq))) || true) && false).dypbtyxf( jlhmmq - , true - ) - ) - val zurnferod = true && tylbuarm } else { - Console.println((-((4 * (vq.*(1))) * 4)).*(5)) - if (vq * ((2 * (4 * (vq * vq))).*((5.+(vq)).*(vq)))) == ((((2 * vq) * vq) * (vq * 5)).*((2 * ((vq * 5).*(vq))) * 0)) then { - val zd: Int = vq - var dxofglgc: Boolean = ((((-(-(vq))) * 2) * ((5.*(vq)).*(0))) * vq) == ((-(-(3 * 5))) * ((-(vq.*(6 * vq))).*(2))) + def evc(uwo: Boolean, wmpfqwta: Int, vs: Int, bqzet: Int) = + Console.println((((4.*(vs)).*((ynynxspcyx.*(2)).*(ynynxspcyx * 4))).*((-(wmpfqwta)).+(bqzet.*(2.*(0))))) + (wmpfqwta * 3)) + val heytkxp = (ffjio: Boolean, ltzhf: Int) => + extension (omcmkgbaxl: Boolean) + def fblsyj(ieebwc: Boolean, mgb: Boolean, xhbkvw: Int, lrkb: Boolean) = { ((5.*(ltzhf)).*(2.*(0.*(-(0))))) * ltzhf } + + val vz = (ouaj: Boolean, nbd: Int, iiycetwe: Boolean, uaurcdniyd: Boolean) => { } : Unit + + val lnvcqk: Boolean = ynynxspcyx < (6 * ynynxspcyx) + if false then + evc + ( (((-(ynynxspcyx)).*((ynynxspcyx.+(ynynxspcyx)).+(6))) + 5) <= (-(4)) + , ((-(((5.+(ynynxspcyx)).*(2 + ynynxspcyx)) * ((4.+(ynynxspcyx)) * 1))) + ynynxspcyx).*((((6 + ynynxspcyx) * ynynxspcyx) * ((ynynxspcyx.*(6)).*(ynynxspcyx))).*(3)) + , ynynxspcyx + , -(2) + ) - } else { - Console.println(((vq + ((-(vq)).*(vq))).*(vq)) * (-(4 * vq))) - if (((true || (2.==(4))) && ((false && (true && true)) && false)) || true).||(false) then { - - } else { - - } + else + var kcqjvbjmdv = (-(ynynxspcyx.+(ynynxspcyx))).*(ynynxspcyx) - } - val akwftikho = 1.<=(vq) + var ffz: Int = -((ynynxspcyx * 0).*(ynynxspcyx)) } - Console.println(vq) - Console.println(6) - if false then - extension (ajd: Int) - def bwvxxxror() = - {} - - else - var nfqt = 3 == ((vq * vq).*(-(vq * ((vq.*(vq)).*(5))))) - } ------------------- -val vvw = (jnagczqp: Boolean, rsrxh: Boolean, yhlaujkvk: Int) => { - val onrgts = (tggthuyw: Int) => { - extension (cybn: Boolean) - def irrqsabpiv(scdsiwx: Int, emuhuf: Boolean, kbchw: Int, b: Boolean, stkyy: Int) = { - Console.println(6.*(5)) - if rsrxh then - {} - else - extension (uhhvsa: Int) def egzdl(tliob: Int, lo: Boolean, jsj: Int): Unit = { {} } : Unit - - val suxf = (fpwsxwavb: Int, wgk: Boolean, u: Boolean) => { {} } : Unit - yhlaujkvk +val kki = () => { + if ((-(2.*(1))) + (((6 * 0).+(3)).+((2.*(-(1))) + (4 * (5.*(1)))))).<(((0.*(6.*(5))) * 6) * (((-(4)) * (2 * (4.*(3)))).*(2.*(5)))) then { + Console.println + (((-(1 * ((5 * 2) * 1))).*(((0.*(3)).*(-(3))).*((3 * (2 * 1)) * 5))) * (((-((0.*(2)) + 1)).*(5 * (5.*(3)))).*((3 * ((1 * 4) * (6 * 0))).+(2 * (-(5 * 3)))))) + Console.println + ((((-(3)) * (((-(4)).+(4)) * (2 * (-(1))))) * (((-(2)).+(1 * (2 * 0))) * ((-(3)).*(2)))).*((((-(1)) * 6) * (-(2 * (3 * 4)))).+(-(((4.+(5)) * (5.*(2))) * (0 * 1))))) + def hzxxhclil(cblgles: Boolean, aao: Int) = { + Console.println((-(4.*(aao))) * (((aao * (aao * aao)) * (((1 * 0) + aao).*(aao))).*(aao))) + ((1 + (0.*(aao))) * (-(5))) <= ((aao.*(aao)) * 1) + } + + } else { + if (((6 * (0 * 2)).*(5.*((4.*(1)).*(0)))).*(4 * (6.*((4.*(6)).*(2.*(2)))))) == 2 then + def ykazx(qnfijusp: Boolean): Boolean = { + val ivqydxyay = (6 * 6) <= (-(-(((-(0)) * 6).*((0.*(0)) + 0)))) + val wavh = (((((5 * 6).*(5)) * ((3 + 0) * (2.*(0)))) * ((4.*(1)) * (4 * 0))) * 0).*(0) + wavh.==(0 + ((4 + wavh).*(wavh))) } - if !(true && jnagczqp) then { - var y = - (- - ( true.irrqsabpiv( 1 - , (true.irrqsabpiv( true.irrqsabpiv( 5 - , false - , 2 - , true - , 1 - ) - , rsrxh - , tggthuyw - , jnagczqp - , true.irrqsabpiv( yhlaujkvk - , true - , 5 - , jnagczqp - , 3 - ) - )) == (jnagczqp.irrqsabpiv( tggthuyw - , false - , 2 - , jnagczqp - , -(1) - )) - , - - ( (yhlaujkvk.==(yhlaujkvk)).irrqsabpiv( tggthuyw - , false - , -(yhlaujkvk) - , true - , yhlaujkvk - ) - ) - , (!(jnagczqp)) && jnagczqp - , false.irrqsabpiv( 0 - , jnagczqp || rsrxh - , -(2) - , rsrxh - , jnagczqp.irrqsabpiv( yhlaujkvk * tggthuyw - , jnagczqp - , 5 - , true - , true.irrqsabpiv( yhlaujkvk - , false - , yhlaujkvk - , rsrxh - , tggthuyw - ) - ) - ) - ) - )) == ((!(jnagczqp || rsrxh)).irrqsabpiv( (!(3.==(tggthuyw))).irrqsabpiv( rsrxh.irrqsabpiv( true.irrqsabpiv(5, jnagczqp, yhlaujkvk, jnagczqp, 4) - , false - , -(tggthuyw) - , true.&&(jnagczqp) - , (jnagczqp.irrqsabpiv(6, jnagczqp, 5, jnagczqp, 3)) * yhlaujkvk - ) - , 6 <= yhlaujkvk - , yhlaujkvk - , jnagczqp - , (-(false.irrqsabpiv(yhlaujkvk, jnagczqp, 1, rsrxh, 1))) * 0 - ) - , (false.irrqsabpiv(3, false, 6, true, yhlaujkvk * yhlaujkvk)).<(2) - , 3 - , ((2 < yhlaujkvk) && ((6 * 3) == yhlaujkvk)).&&( yhlaujkvk == ((false.irrqsabpiv( yhlaujkvk - , jnagczqp - , 4 - , jnagczqp - , tggthuyw - )) * yhlaujkvk) - ) - , jnagczqp.irrqsabpiv( (yhlaujkvk.==( jnagczqp.irrqsabpiv( yhlaujkvk - , true - , yhlaujkvk - , false - , yhlaujkvk - ) - )).irrqsabpiv( tggthuyw - , false - , true.irrqsabpiv( false.irrqsabpiv( 5 - , jnagczqp - , yhlaujkvk - , jnagczqp - , yhlaujkvk - ) - , 4.==(yhlaujkvk) - , jnagczqp.irrqsabpiv( yhlaujkvk - , false - , 1 - , jnagczqp - , yhlaujkvk - ) - , jnagczqp - , 4 - ) - , rsrxh && (0 == 4) - , jnagczqp.irrqsabpiv( 0 - , jnagczqp - , 0 - , rsrxh - , -(4) - ) - ) - , ((rsrxh && true).irrqsabpiv(1, 6.==(0), 3, true && false, 0)).<=(-(1)) - , rsrxh.irrqsabpiv( false.irrqsabpiv(yhlaujkvk, yhlaujkvk.<=(yhlaujkvk), yhlaujkvk, false, yhlaujkvk) - , rsrxh - , -(true.irrqsabpiv(tggthuyw, false, 1, rsrxh, 0)) - , false - , -(yhlaujkvk) - ) - , !(1 == (jnagczqp.irrqsabpiv(yhlaujkvk, jnagczqp, 5, jnagczqp, 5))) - , -(-(jnagczqp.irrqsabpiv(5, true, tggthuyw, false, tggthuyw))) - ) - )) - var sdgnir: Boolean = true + Console.println(-(2)) + Console.println(((((-(4)).*(1 * 6)) * (0.*(1))) * (-((-(6)).*(-(4))))) * (-(0))) - } else { - Console.println - ( ((yhlaujkvk.*(4)) == ((2.<( jnagczqp.irrqsabpiv( -(yhlaujkvk) - , rsrxh - , true.irrqsabpiv( tggthuyw - , jnagczqp - , yhlaujkvk - , rsrxh - , 5 - ) - , yhlaujkvk.==(yhlaujkvk) - , rsrxh.irrqsabpiv( 6 - , rsrxh - , yhlaujkvk - , true - , yhlaujkvk - ) - ) - )).irrqsabpiv( 2 - , ((rsrxh.irrqsabpiv( 2 - , false - , 5 - , jnagczqp - , yhlaujkvk - )).==(6)).&&( yhlaujkvk == (jnagczqp.irrqsabpiv( yhlaujkvk - , jnagczqp - , yhlaujkvk - , rsrxh - , 0 - )) - ) - , tggthuyw - , false && (false.&&(2.==(yhlaujkvk))) - , (4.==(5.*(6))).irrqsabpiv(-(6), false, 6, false, -(tggthuyw)) - ))).irrqsabpiv( -(yhlaujkvk) - , jnagczqp - , rsrxh.irrqsabpiv( jnagczqp.irrqsabpiv( yhlaujkvk.*(-(1)) - , 0 < (true.irrqsabpiv( jnagczqp.irrqsabpiv(4, false, yhlaujkvk, rsrxh, yhlaujkvk) - , yhlaujkvk.<=(4) - , 1 - , jnagczqp - , 4 - )) - , 0 - , (true.irrqsabpiv( yhlaujkvk - , !(jnagczqp) - , yhlaujkvk - , false.&&(rsrxh) - , yhlaujkvk - )) == (1.*(yhlaujkvk)) - , (jnagczqp && jnagczqp).irrqsabpiv( 0 - , false - , -(6) - , (true.irrqsabpiv( 0 - , false - , 2 - , false - , yhlaujkvk - )).<( true.irrqsabpiv( 5 - , false - , yhlaujkvk - , false - , 2 - ) - ) - , tggthuyw - ) - ) - , rsrxh.&&(true.&&(false && false)) - , jnagczqp.irrqsabpiv( yhlaujkvk - , !(jnagczqp) - , 5 - , 3 == (true.irrqsabpiv(3.*(tggthuyw), jnagczqp, -(3), rsrxh, 1)) - , jnagczqp.irrqsabpiv( (yhlaujkvk == yhlaujkvk).irrqsabpiv( 2 - , true.&&(jnagczqp) - , -(yhlaujkvk) - , false - , 3 - ) - , yhlaujkvk == tggthuyw - , yhlaujkvk - , false - , 4 - ) - ) - , !(rsrxh) - , yhlaujkvk - ) - , false && jnagczqp - , yhlaujkvk - ) - ) - var cencqsr: Int = yhlaujkvk + else + Console.println(3) - } - var hbwkqm = 0 - hbwkqm = 0 - } : Unit - val qhuljmg = jnagczqp - var pytvvuoaa: Int = 0 - if false then { + } + Console.println + (((((-(5)).+((5.*(0)).*(-(5)))) * (2.*(0))) * (((2 + (4.*(6))).*(4 * 2)) + 4)) + ((1 + ((3 * 6) * ((5 * 3) + 2))).+(((-(4)).*(-(4))) * (((-(3)).*(1.+(6))).*(3))))) + if (3 * ((-(6)).*(((-(5)).*(4)).*(4.*(5 * 2))))) == ((5.*(3 * 1)) + ((-((0.*(5)).+(2 * 4))) * (-((6.+(0)).*(5.*(3)))))) then { + def peamf(ubokgxik: Int, c: Boolean, upiip: Boolean, i: Boolean, z: Int, aznh: Int): Int = + extension (wbylxdxv: Int) + def afrclpzoc(iicczck: Int, qknu: Int, wmifrpwwnx: Boolean, sw: Boolean, mb: Boolean): Unit = + {} + 3 } else { - Console.println(5) + var iabbqoby = 5.<=(-(4.+(1))) } - var avdeqn = (((2 * 1).*(-(6 * 5))).*(-((0 * yhlaujkvk).*(yhlaujkvk)))).*(3) + var c: Int = (((-((-(4)).*(2))) * (6 * (2.*(3)))).*(0)) * ((6 * (1 * (3.*(1 * 1)))).*(((5 * (3 * 0)) * 5) * (-((4 + 5) * 3)))) + extension (lzwsqc: Boolean) def mtwfgil(kcphro: Int, xywoinr: Boolean) = { (c.*((-(c * 0)) * ((kcphro * (2.*(2))).*(c.*(kcphro))))).*((c.*(2)).+(c)) } -} -val h = (((1.*(-(5.*(1)))) + 6).+(4.*(1))) <= ((3.+((2 * 5) * (2 * (6.*(0))))).*((-(5 * (-(5)))).*((-(-(1))) * (1 * 1)))) +} : Unit @main -def vwordfka(): Unit = { - if (!((((1.*(0)).*(3)) * 0) == (1 * 6))).&&(h.&&(false && (5 <= 2))) then - extension (qzncoeqm: Int) - def nayr(mtwfg: Boolean, sdlglvqe: Boolean, itkhrnconn: Int): Int = { - vvw - ( ((-(qzncoeqm)) == ((((-(qzncoeqm)).*(2.*(qzncoeqm))) * 0).*(itkhrnconn.*((1.*(qzncoeqm)) * (2.*(2)))))).&&((true && true) && h) - , true.||(!(false)) - , (-(qzncoeqm.*((0.*(itkhrnconn)).+(itkhrnconn.*(6))))).*(qzncoeqm * qzncoeqm) - ) - if true then { - - } else { - - } - (-((qzncoeqm.*(5)) * (qzncoeqm.*(qzncoeqm)))) * 4 - } : Int - var dfpxzc: Boolean = - (((2.*(4)).*( (-(-(1))).nayr( true - , 2.==(4) - , 4 - ) - )).nayr( !(1 == ((5.nayr(false, h, 5)) + 3)) - , (-(1)) == ((2.nayr( false - , h - , 0 - )).nayr( false.&&(h) - , true - , 4 - )) - , 3 - )).<=( (-(2)).nayr( (6.nayr( h.&&(false) - , false - , (5.nayr( h - , h - , 5 - )).nayr( true - , h - , 2.nayr( false - , true - , 5 - ) - ) - )) == ((-(-(1))).nayr( false - , false - , 0.nayr( 3 == 6 - , 4 < 4 - , 1.nayr( true - , true - , 3 - ) - ) - )) - , ((5.nayr(4.==(6), 1.==(3), 1.*(3))).==(6)).&&(true) - , (1 * 1) * 1 - ) - ) - var izqzkz = 3.==(2) +def tcou(): Unit = { + if true then + var voukkkys = (4 + ((-(1)) + (1.*(3.*(1.*(0)))))) < 5 + val kzt: Int = -((((3 * 1) * ((3 * 4) * (-(0)))).*(-(-(4)))) * ((-((4 * 4) * (2.+(2)))) * 5)) + var b: Int = 0 + Console.println(kzt * ((-(1)).*(1))) else - if (((((2.*(6)).*(2)).*(3.+(6.*(0)))).*((4 * 4).*(-(6)))) * ((((4 * 1).*(4.*(4))).*(1)).*(((1 + 2).*(3)) * 6))) == ((-(4.*(0))) * (-(3))) then { - var knunlwsi: Boolean = ((((6 * 0).*((0.*(4)).*(-(6)))) * (6.*((1 * 5) * 1))).*(5)).<=(0) - val imayj = (qxp: Int, upiip: Boolean, y: Boolean, bfauakmz: Boolean, ddfnjaz: Boolean, ve: Boolean) => { qxp } : Int + if true then + Console.println((-(2)).*((6.*(((4.+(2)).*(5 * 3)).+((0 * 4).*(-(6))))).*((4 * (5.*(4.+(6)))) + ((2.*(4.*(5))) * (-(3)))))) + val rnk: Boolean = 5 <= 0 - } else { - def fiofk(zpxmxnr: Boolean, rpwwnx: Int, pvyrnbxksw: Boolean, tfbwpipxeb: Boolean): Int = { - val bonhaiabb: Boolean = false - ((-(((-(rpwwnx)).*(4)).*(1))).*(rpwwnx.*(3))).*(-(rpwwnx)) - } - extension (t: Int) def hhg(xgry: Boolean): Int = { fiofk(true && true, 6, xgry, t.==(fiofk(true, t, h, !((!(h)) || h)))) } : Int + else + if (-((-(-(1))) + ((1.*(0 + 3)).*((1.*(5)) * (1.*(6)))))) < 0 then + if 1 < (-(0)) then + {} + else + extension (ngjd: Boolean) + def bfzhigtu(nkvmxks: Int, vbr: Int): Unit = + {} + + Console.println(((4.*((3.*(4.*(1))) + ((-(3)).*(5.*(6))))).*(2)).*(1)) + + Console.println((4.*((-(5)) * (6 * (-(5))))) * ((4.*(1.*(5))) * ((6 * 0).*(4.*(-(4 * 0)))))) + if 3 <= 4 then { + + } - } - val cisoebm = (amfmg: Int, s: Int) => { - vvw(true, false, (-(s * (0 * amfmg))).*((-(-((0.*(1)).*(6)))).*(((amfmg.*(4)).*(amfmg.*(6 + 0))) * amfmg))) - amfmg.*(4) - } : Int - var wfxyk: Int = 2.*(cisoebm(-(2 * 5), (-(6)).*(0))) + extension (c: Boolean) + def qzis(xkmfsklg: Boolean) = + Console.println(((-(((1 + 3) + 5).*((-(5)).*(6.*(1))))).*((5.+(3)).+(4 * 1))).*(2.*(((4.*(2)) * (5 + (0 * 1))).*(-(3))))) + ((-(4 * ((4.*(1)) * (-(0))))) * (2 * ((1.*(5 * 0)).*((5.*(1)).+(1))))) + (((-(5)) * (2.*(6.*(5)))).*(2 * 0)) + def im(blitkf: Int) = { + val cboohd = + (((blitkf * 2) * (((true.qzis(true)) < (true qzis true)).qzis(true))) < (blitkf * (-(-(0))))).qzis((true qzis ((true qzis true) < blitkf)) < ((0 + blitkf).*(blitkf))) + blitkf + } + val ihredpvgxa = (ejvib: Boolean, sugy: Int, bgmuf: Int, kgsqtsdoja: Boolean) => + (6) : Int - if ((((4.*(6 * 0)).*(6.*(1))) * (-((2 * 1).*(6.*(0))))) <= (2.*(3))).&&(((((5.*(2)).==(1)) && h).||(((0.+(1)) * (5.+(2))) < 4)).&&(((-(4.*(5))).*(4)).==(4))) then { - extension (gbwvichlrj: Boolean) def kcgyoqzlh(exvayfl: Boolean, byvljjd: Int, khbvvhvwex: Int): Unit = { } : Unit - if false.&&(!(true)) then { - - } else { - - } + kki() + def idthitejb(uyahokypoa: Boolean, m: Int, mua: Boolean, fdfpxzc: Int, qzkzqyfibo: Int, yotgmawju: Boolean): Unit = { } + if ((-(0 + 4)) * (0 + (-(-(5))))) < (-(1 * (0.*(0)))) then { + if ((-(3.*(1))).*(((0 + (-(4))).*(6)) * 1)).<((3 * (-((0 + 3).*(0)))).*(((-(1.*(0))).*(1.+(0))).*(1))) then + {} + else + {} } else { - def gkwdxzlt(wgavser: Boolean) = - vvw - ( 0 == (3.*((6 * ((1 * 0) * (6.*(2)))) * 2)) - , (!(h)) && h - , (0 * ((((3.*(3)).*(2)).*(3 * (-(3)))).+((3.*(0.*(5))) * (5 * 1)))).*((((2 * (0 * 2)).*((6.*(4)) * 3)) * (2.*(-(0)))) * 3) - ) - (((6 + ((4 * 3).*(2))).*(-(6))).==(2.*(((0 * 2) * 0) * ((6 * 6) * 1)))) && ((2.*(((4 * 6).*(-(5))).*((0.*(5)) * 2))) <= (-(-(1)))) - def w(): Boolean = - (-((5 * 4).*(((1 + 4) * (1.*(2))).*(1.*(2 * 5))))) == (-((-(1)) * (5 * 6))) + extension (huj: Boolean) def qcxve(ginvqeeku: Int, in: Boolean) = { -((-(ginvqeeku)).+((-((-(1)) * ginvqeeku)) * (4.*(6.*(1))))) } } - var ykazxklxll = ((((-(6 * 1)).*(4)) * (6.*(-(1)))) * ((5 * ((5 * 3) * 4)) * (((6.*(3)) * 6) + 1))) * 6 + var qrf = -(-(3)) } From 45123aa0aeb1cbac30c7ec7facdc2f4bac271979 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 24 Feb 2026 19:51:39 +0300 Subject: [PATCH 72/81] [ fix ] Work around mgn quirks --- .../src/Deriving/SpecialiseData.idr | 57 ++++++++++++++++--- .../specdata-028-reproPilReg2/Shared.idr | 1 + .../specdata-028-reproPilReg2/Test.idr | 23 ++++++++ .../specdata-028-reproPilReg2/expected | 2 + .../specdata-028-reproPilReg2/run | 1 + .../specdata-028-reproPilReg2/test.ipkg | 1 + 6 files changed, 77 insertions(+), 8 deletions(-) create mode 120000 elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Shared.idr create mode 100644 elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Test.idr create mode 100644 elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/expected create mode 120000 elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/run create mode 120000 elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/test.ipkg diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 4d014822d..6760f6e0a 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -807,6 +807,10 @@ parameters (t : SpecTask) --- POLY TO POLY CAST DERIVATION --- ------------------------------------ + transMachineVars : TTImp -> TTImp + transMachineVars $ IVar fc n@(MN ns nn) = IVar fc $ fromString "MS^\{show ns}^\{show nn}" + transMachineVars $ IBindVar fc n@(MN ns nn) = IBindVar fc $ fromString "MS^\{show ns}^\{show nn}" + transMachineVars t = t ||| Generate specialised to polymorphic type conversion function clause @@ -823,10 +827,11 @@ parameters (t : SpecTask) Nat -> Clause mkMToPImplClause ur _ con mcon meta _ = - var "mToPImpl" .$ - mcon.apply bindVar - (substituteVariables - (fromList $ argsToBindMap mcon.args) <$> ur.fullResult) + mapClause transMachineVars $ + var "mToPImpl" .$ + mcon.apply bindVar + (substituteVariables + (fromList $ argsToBindMap mcon.args) <$> ur.fullResult) .= (substituteVariables meta.mToPRenames $ con.apply var ur.fullResult) ||| Generate specialised to polymorphic type conversion function declarations @@ -1046,9 +1051,10 @@ parameters (t : SpecTask) Nat -> Clause mkPToMImplClause ur _ con mcon meta _ = - var "pToMImpl" .$ con.apply bindVar - (substituteVariables - (fromList $ argsToBindMap $ con.args) <$> ur.fullResult) + mapClause transMachineVars $ + var "pToMImpl" .$ con.apply bindVar + (substituteVariables + (fromList $ argsToBindMap $ con.args) <$> ur.fullResult) .= (substituteVariables meta.pToMRenames $ mcon.apply var ur.fullResult) ||| Generate specialised to polymorphic type conversion function declarations @@ -1123,30 +1129,65 @@ parameters (t : SpecTask) ||| Generate declarations for given task, unification results, and specialised type specDecls : MonadLog m => UniResults -> (mt : TypeInfo) -> (0 _ : AllTyArgsNamed mt) => TypeMeta -> m $ List Decl specDecls uniResults specTy specMeta = do + let specTySig = mkSpecTySig let specTyDecl = specTy.decl + logPoint DetailedDebug "specialiseData.specDecls.specTy.sig" [specTy] $ show mkSpecTySig logPoint DetailedDebug "specialiseData.specDecls.specTy" [specTy] $ show specTyDecl + let mToPImplClaim = mkMToPImplClaim let mToPImplDecls = mkMToPImplDecls uniResults specTy specMeta + logPoint DetailedDebug "specialiseData.specDecls.mToPImpl.sig" [specTy] $ show mToPImplClaim logPoint DetailedDebug "specialiseData.specDecls.mToPImpl" [specTy] $ show mToPImplDecls + let mToPClaim = mkMToPClaim let mToPDecls = mkMToPDecls specTy + logPoint DetailedDebug "specialiseData.specDecls.mToP.sig" [specTy] $ show mToPClaim logPoint DetailedDebug "specialiseData.specDecls.mToP" [specTy] $ show mToPDecls let castInjDecls = mkCastInjDecls uniResults specTy specMeta logPoint DetailedDebug "specialiseData.specDecls.castInj" [specTy] $ show castInjDecls + let decEqClaims : List Decl = [ mkDecEqImplClaim, mkDecEqClaim ] let decEqDecls = mkDecEqDecls uniResults specTy + logPoint DetailedDebug "specialiseData.specDecls.decEq.sig" [specTy] $ show decEqClaims logPoint DetailedDebug "specialiseData.specDecls.decEq" [specTy] $ show decEqDecls + let showClaims = mkShowClaims let showDecls = mkShowDecls uniResults specTy + logPoint DetailedDebug "specialiseData.specDecls.show.sig" [specTy] $ show showClaims logPoint DetailedDebug "specialiseData.specDecls.show" [specTy] $ show showDecls + let eqClaims = mkEqClaims let eqDecls = mkEqDecls uniResults specTy + logPoint DetailedDebug "specialiseData.specDecls.eq.sig" [specTy] $ show eqClaims logPoint DetailedDebug "specialiseData.specDecls.eq" [specTy] $ show eqDecls + let pToMImplClaim = mkPToMImplClaim let pToMImplDecls = mkPToMImplDecls uniResults specTy specMeta + logPoint DetailedDebug "specialiseData.specDecls.pToMImpl.sig" [specTy] $ show pToMImplClaim logPoint DetailedDebug "specialiseData.specDecls.pToMImpl" [specTy] $ show pToMImplDecls + let pToMClaim = mkPToMClaim let pToMDecls = mkPToMDecls specTy + logPoint DetailedDebug "specialiseData.specDecls.pToM.sig" [specTy] $ show pToMClaim logPoint DetailedDebug "specialiseData.specDecls.pToM" [specTy] $ show pToMDecls + let fromStringClaims = mkFromStringClaims let fromStringDecls = mkFromStringDecls specTy + logPoint DetailedDebug "specialiseData.specDecls.fromString.sig" [specTy] $ show fromStringClaims logPoint DetailedDebug "specialiseData.specDecls.fromString" [specTy] $ show fromStringDecls + let numClaims = mkNumClaims let numDecls = mkNumDecls specTy + logPoint DetailedDebug "specialiseData.specDecls.num.sig" [specTy] $ show numClaims logPoint DetailedDebug "specialiseData.specDecls.num" [specTy] $ show numDecls let anyUndecided = any isUndecided uniResults - let claims = standardClaims ++ if anyUndecided then [] else decidedClaims + let sClaims = + [ mToPImplClaim + , mToPClaim + ] ++ join + [ decEqClaims + , showClaims + , eqClaims + ] + let dClaims = + [ pToMImplClaim + , pToMClaim + ] ++ join + [ fromStringClaims + , numClaims + ] + let claims = sClaims ++ if anyUndecided then [] else dClaims logPoint DetailedDebug "specialiseData.specDecls.claims" [specTy] $ show claims let decidedDecls = [ pToMImplDecls diff --git a/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Shared.idr b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Shared.idr new file mode 120000 index 000000000..988e6e0ff --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Shared.idr @@ -0,0 +1 @@ +../_shared/Shared.idr \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Test.idr b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Test.idr new file mode 100644 index 000000000..dc55fd3b8 --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Test.idr @@ -0,0 +1,23 @@ +module Test + +import Shared + +%language ElabReflection + +public export +data Lookup : a -> List (a, b) -> Type where + Here : {0 type_of_x : Type} -> {0 x : type_of_x} -> {0 b : Type} -> {0 xys : List (type_of_x, b)} -> (y : b) -> Lookup {b} {a = type_of_x} x ((::) {a = (type_of_x, b)} (MkPair {a = type_of_x} {b} x y) xys) + There : {0 b : Type} -> {0 a : Type} -> {0 x : a} -> {0 y : b} -> {0 z : a} -> {0 xys : List (a, b)} -> Lookup {b} {a} z xys -> Lookup {b} {a} z ((::) {a = (a, b)} (MkPair {a} {b} x y) xys) + +public export +data IsReveal : Lookup {a} {b} x xys -> b -> Type where + IsHere : IsReveal (Here y) y + IsThere : IsReveal subl y -> IsReveal (There subl) y + +export +data Name = MkName String + +public export +data Type' = Bool' | Int' | String' + +%runElab specialiseDataLam' "IsRevealName" $ \ 0 l0 => \ 0 l1 => \ l2 => \ l3 => Test.IsReveal {a = Test.Name} {x = l0} {b = Type'} {xys = l1} l2 l3 diff --git a/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/expected b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/expected new file mode 100644 index 000000000..4a77231de --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/expected @@ -0,0 +1,2 @@ +1/2: Building Shared (Shared.idr) +2/2: Building Test (Test.idr) diff --git a/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/run b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/run new file mode 120000 index 000000000..64c976f45 --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/run @@ -0,0 +1 @@ +../_shared/run \ No newline at end of file diff --git a/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/test.ipkg b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/test.ipkg new file mode 120000 index 000000000..f5e58508a --- /dev/null +++ b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/test.ipkg @@ -0,0 +1 @@ +../_shared/test/test.ipkg \ No newline at end of file From 77da5af17b0a05669316f7722d7da74fb542dca2 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 2 Mar 2026 16:29:11 +0300 Subject: [PATCH 73/81] [ fix ] Generate correct DPair sequences for specialiseds with >=2 givens --- .../DepTyCheck/Util/Specialisation.idr | 2 +- .../DerivedGen.idr | 46 +++++++++++++++++++ .../RunDerivedGen.idr | 1 + .../07-1 vect-indexed-multargspec/derive.ipkg | 1 + .../07-1 vect-indexed-multargspec/expected | 27 +++++++++++ .../07-1 vect-indexed-multargspec/run | 1 + 6 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/RunDerivedGen.idr create mode 120000 tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/derive.ipkg create mode 100644 tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/expected create mode 120000 tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/run diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index 5cd519268..af22f3157 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -261,7 +261,7 @@ mkDPairHelper (S n) helper t = do dPairHelper : Nat -> TTImp dPairHelper 0 = `(?) -dPairHelper (S n) = `(DPair ? ~(dPairHelper n)) +dPairHelper (S n) = `(DPair ? $ \_ => ~(dPairHelper n)) inSameNS : Name -> Name -> Name inSameNS (NS ns _) n = NS ns n diff --git a/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr new file mode 100644 index 000000000..467d22b65 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr @@ -0,0 +1,46 @@ +module DerivedGen + +import RunDerivedGen + +import public Data.Fin +import Data.Fuel +import Data.String +import Data.Vect +import public Data.Vect.AtIndex + +import Decidable.Equality + +import Deriving.DepTyCheck.Gen + +%language ElabReflection + +%default total + +public export +Regs : Nat -> Type +Regs n = Vect n $ Maybe Bool + +public export +RegIsType : Fin r -> Bool -> Regs r -> Type +RegIsType fn t rs = AtIndex fn rs (Just t) + +Show (AtIndex f v t) where + showPrec d $ Here = "Here" + showPrec d $ There x = showCon d "There" $ showArg x + +------------------- +--- Expressions --- +------------------- + +public export +data SimpleExpr : Regs r -> Bool -> Type where + Read : (idx : Fin r) -> RegIsType idx t regs => SimpleExpr regs t + +Show (SimpleExpr regs b) where + showPrec d $ Read idx @{rit} = showCon d "Read" $ showArg idx ++ showArg "@{\{show rit}}" + +checkedGen : Fuel -> (r : Nat) -> (t : Bool) -> Gen MaybeEmpty (a : Regs r ** SimpleExpr a t) +checkedGen = deriveGen + +main : IO Unit +main = runGs [ G (\f => checkedGen f 3 True) ] diff --git a/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/RunDerivedGen.idr b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/RunDerivedGen.idr new file mode 120000 index 000000000..2b18cc56c --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/RunDerivedGen.idr @@ -0,0 +1 @@ +../_common/RunDerivedGen.idr \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/derive.ipkg b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/expected b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/expected new file mode 100644 index 000000000..0edcf41ee --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/expected @@ -0,0 +1,27 @@ +1/2: Building RunDerivedGen (RunDerivedGen.idr) +2/2: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.util.specialisation:10: Data.Vect.AtIndex.AtIndex[0(type), 1(n), 4(x)] Declared specialised type DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525: Data.Vect.AtIndex.AtIndex {type = Prelude.Types.Maybe Prelude.Basics.Bool} {n = lam^0} lam^1 lam^2 lam^3 +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186: Data.Vect.Vect lam^0 (Prelude.Types.Maybe Prelude.Basics.Bool) +LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926: Prelude.Types.Maybe Prelude.Basics.Bool +Generated values: +----- +----- +([Just True, Nothing, Just True] ** Read 2 "@{There (There Here)}") +----- +([Nothing, Just False, Just True] ** Read 2 "@{There (There Here)}") +----- +([Just False, Just True, Just True] ** Read 2 "@{There (There Here)}") +----- +([Nothing, Just False, Just True] ** Read 2 "@{There (There Here)}") +----- +([Just False, Just True, Just True] ** Read 2 "@{There (There Here)}") +----- +([Nothing, Just True, Just True] ** Read 2 "@{There (There Here)}") +----- +([Nothing, Just False, Just True] ** Read 2 "@{There (There Here)}") +----- +([Nothing, Nothing, Just True] ** Read 2 "@{There (There Here)}") +----- +([Nothing, Nothing, Just True] ** Read 2 "@{There (There Here)}") +----- +([Just True, Nothing, Just False] ** Read 0 "@{Here}") diff --git a/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/run b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 6d6a0a045a98e24eecc86b238d27f4c770d00d68 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 2 Mar 2026 17:42:52 +0300 Subject: [PATCH 74/81] [ new ] Use polymorphic types in PilDyn --- examples/pil-dyn/src/Language/PilDyn.idr | 47 ++----- .../pil-dyn/tests/gens/all-given/expected | 86 ++++++------ .../pil-dyn/tests/gens/ins-given/expected | 114 ++++++++-------- examples/pil-dyn/tests/gens/no-given/expected | 125 ++++++++++-------- .../pil-dyn/tests/gens/outs-given/expected | 117 ++++++++-------- 5 files changed, 236 insertions(+), 253 deletions(-) diff --git a/examples/pil-dyn/src/Language/PilDyn.idr b/examples/pil-dyn/src/Language/PilDyn.idr index 173a00469..b53154c42 100644 --- a/examples/pil-dyn/src/Language/PilDyn.idr +++ b/examples/pil-dyn/src/Language/PilDyn.idr @@ -2,6 +2,8 @@ module Language.PilDyn import public Data.Fin import Data.String +import public Data.Vect +import public Data.Vect.AtIndex import Decidable.Equality @@ -22,43 +24,12 @@ DecEq Ty where decEq B I = No $ \Refl impossible public export -data MaybeTy = Nothing | Just Ty - -export -Injective PilDyn.Just where - injective Refl = Refl - -export -DecEq MaybeTy where - decEq Nothing Nothing = Yes Refl - decEq (Just x) (Just y) = decEqCong $ decEq x y - decEq Nothing (Just _) = No $ \Refl impossible - decEq (Just _) Nothing = No $ \Refl impossible - -namespace Regs - public export - data Regs : Nat -> Type where - Nil : Regs 0 - (::) : MaybeTy -> Regs n -> Regs $ S n - -export -Biinjective Regs.(::) where - biinjective Refl = (Refl, Refl) - -export -DecEq (Regs n) where - decEq [] [] = Yes Refl - decEq (x::xs) (y::ys) = decEqCong2 (decEq x y) (decEq xs ys) - -public export -update : Fin r -> MaybeTy -> Regs r -> Regs r -update FZ t (x::xs) = t :: xs -update (FS i) t (x::xs) = x :: update i t xs +Regs : Nat -> Type +Regs n = Vect n $ Maybe Ty public export -data RegIsType : Fin r -> Ty -> Regs r -> Type where - Here : RegIsType FZ t (Just t :: rest) - There : RegIsType i t rest -> RegIsType (FS i) t (reg :: rest) +RegIsType : Fin r -> Ty -> Regs r -> Type +RegIsType fn t rs = AtIndex fn rs (Just t) ------------------- --- Expressions --- @@ -119,7 +90,7 @@ data LinBlock : (ins, outs : Regs r) -> Type where Assign : (target : Fin r) -> (expr : Expr ins t) -> - (cont : LinBlock (update target (Just t) ins) outs) -> + (cont : LinBlock (replaceAt target (Just t) ins) outs) -> LinBlock ins outs --- Linear block DSL --- @@ -131,7 +102,7 @@ data Assignment : (target : _) -> (ins : _) -> (t : _) -> Type where export infix 2 #= public export %inline -(>>) : Assignment target ins t -> LinBlock (update target (Just t) ins) outs -> LinBlock ins outs +(>>) : Assignment target ins t -> LinBlock (replaceAt target (Just t) ins) outs -> LinBlock ins outs target #= expr >> cont = Assign target expr cont export @@ -153,7 +124,7 @@ Interpolation Ty where interpolate B = "B" export -Interpolation MaybeTy where +Interpolation (Maybe Ty) where interpolate $ Just t = "\{t}" interpolate Nothing = "?" diff --git a/examples/pil-dyn/tests/gens/all-given/expected b/examples/pil-dyn/tests/gens/all-given/expected index 6c15e1209..b6088a7cb 100644 --- a/examples/pil-dyn/tests/gens/all-given/expected +++ b/examples/pil-dyn/tests/gens/all-given/expected @@ -9,64 +9,64 @@ Both inputs and outputs are given [1] := [0] * 31 [0] := 7 < 5 ------------------------- -[1] := [3] * [3] -[3] := [3] + -19 -[3] := [0] * 0 -[0] := [2] || T +[1] := -35 * [3] +[3] := [3] + [3] +[3] := [3] + 0 +[0] := [2] [3] := [2] && [2] ------------------------- +[1] := [2] +[1] := [3] * 7 +[3] := [0] < -24 +[3] := [1] + -23 +[3] := [2] && F [0] := F -[1] := [3] + [3] -[3] := [2] && [0] -[3] := [1] + -24 -[2] := ![2] -[3] := [2] ------------------------- -[3] := [2] -[1] := [3] -[2] := 15 + [0] -[1] := 24 * -38 -[2] := [3] -[0] := [2] || [3] +[3] := F && F +[3] := [3] +[1] := [3] && F +[1] := [0] * [0] +[1] := [1] + -3 +[0] := [0] == 15 ------------------------- -[2] := [3] * [3] -[3] := T -[2] := -21 * [2] -[1] := 0 + 20 +[3] := [3] * [3] +[0] := -21 * [3] [2] := F +[1] := 0 +[3] := [3] < -39 [0] := [3] ------------------------- -[3] := [3] + [3] -[3] := [3] * -18 +[3] := -18 +[3] := [3] * -28 [3] := [2] [1] := -6 [1] := [1] [0] := F || [2] ------------------------- -[2] := [2] == [2] -[1] := -37 < 37 -[3] := T && [2] -[3] := T && [3] -[1] := 7 + 26 -[0] := T +[2] := [3] +[2] := [3] + [2] +[1] := -28 +[2] := T && T +[3] := 7 == 26 +[0] := [3] ------------------------- -[3] := F -[1] := [3] +[3] := ![2] +[0] := T +[3] := [0] +[1] := 35 [1] := F -[3] := [3] -[1] := -40 * 29 -[0] := [0] == 28 +[1] := -18 ------------------------- -[0] := 19 * [3] -[1] := [2] && [2] -[2] := !T +[0] := [3] + [3] +[1] := 10 +[2] := [2] +[1] := [3] [3] := F -[1] := [0] * [0] -[0] := ![3] +[0] := F ------------------------- -[1] := -22 + [3] -[1] := [2] -[1] := 31 < [3] -[3] := T && F -[0] := [1] || T -[1] := -21 +[3] := [3] + [3] +[3] := [3] * [3] +[2] := [2] +[3] := [2] +[1] := 8 +[0] := F diff --git a/examples/pil-dyn/tests/gens/ins-given/expected b/examples/pil-dyn/tests/gens/ins-given/expected index a570240db..e2980994e 100644 --- a/examples/pil-dyn/tests/gens/ins-given/expected +++ b/examples/pil-dyn/tests/gens/ins-given/expected @@ -3,75 +3,71 @@ Now compiling the executable: test Input registers state is given ------------------------- -- outputs: I, I, I, B -[2] := 35 * 34 -[1] := [2] < 13 +[2] := [3] +[1] := F [1] := [3] [3] := T ------------------------- --- outputs: ?, ?, ?, I -[2] := -35 * [3] -[3] := [3] + [3] -[3] := 0 -[0] := T == T -[2] := [0] || F -[1] := T || [2] +-- outputs: B, ?, ?, I +[3] := [3] +[3] := [3] +[0] := [2] == T +[1] := [3] + 0 +[0] := [3] < [1] +[2] := [2] || F ------------------------- --- outputs: B, B, B, ? -[0] := [3] == [3] -[1] := [3] + [3] -[3] := [2] -[3] := [1] -[1] := -20 < -12 +-- outputs: I, ?, ?, I +[1] := !T ------------------------- --- outputs: ?, I, ?, ? -[0] := T == T -[3] := [2] -[3] := [3] && F -[1] := -14 < -5 -[1] := -33 * -28 -[3] := [1] -------------------------- --- outputs: ?, ?, I, ? -[3] := -19 +-- outputs: I, ?, B, ? +[3] := T || F +[3] := 23 * [0] +[3] := [3] == -39 [2] := [3] -[3] := T && T -[2] := 20 -[3] := 0 -[1] := [3] < -39 +[0] := [0] * [0] +[1] := -24 == [0] ------------------------- --- outputs: ?, I, ?, ? -[3] := -18 -[3] := 27 + [3] -[3] := ![2] -[2] := -40 == [0] -[3] := T -[1] := [0] -------------------------- --- outputs: I, ?, I, ? -[2] := [0] * 7 -[2] := [3] -[1] := -1 + 14 -[3] := T +-- outputs: B, I, ?, ? +[3] := [3] +[3] := [2] +[0] := F +[3] := T == T +[3] := -30 +[1] := 36 ------------------------- --- outputs: I, B, ?, B -[2] := [0] * [0] -[3] := !T -[3] := -10 -[2] := [3] == [3] -[3] := [2] && T +-- outputs: I, I, B, ? [1] := [3] +[3] := 26 +[3] := 11 * [0] +[2] := T +[3] := [3] + -35 +[3] := [2] ------------------------- --- outputs: I, ?, B, ? -[2] := [2] +-- outputs: ?, I, B, ? +[3] := T || [2] [2] := [2] -[0] := -38 -[1] := [3] -[2] := ![2] +[3] := F && F +[3] := [0] * [0] +[3] := [2] +[1] := -6 ------------------------- --- outputs: I, ?, B, I +-- outputs: ?, B, B, ? +[1] := [2] [3] := [2] -[3] := -29 == [0] -[3] := [0] -[3] := 24 -[2] := [2] -[1] := T +[3] := [0] * -37 +[3] := [2] +[3] := F && T +[0] := 35 == 19 +------------------------- +-- outputs: ?, ?, B, ? +[1] := [3] == [3] +[3] := T +[1] := F +[1] := F || T +------------------------- +-- outputs: ?, ?, B, ? +[2] := [3] * 27 +[2] := [3] * [3] +[2] := T == T +[1] := 15 +[1] := F && F diff --git a/examples/pil-dyn/tests/gens/no-given/expected b/examples/pil-dyn/tests/gens/no-given/expected index a1789f076..2cacfadef 100644 --- a/examples/pil-dyn/tests/gens/no-given/expected +++ b/examples/pil-dyn/tests/gens/no-given/expected @@ -2,76 +2,85 @@ Now compiling the executable: test No register state is given ------------------------- --- inputs: ?, B, ?, B +-- inputs: ?, B, ?, I -- outputs: ?, ?, I, I -[0] := 4 -[3] := [3] || F +[0] := -33 +[3] := [1] || F [3] := -8 + 39 [3] := 37 [0] := F [2] := 35 + 34 ------------------------- --- inputs: ?, B, I, I --- outputs: I, ?, ?, I -[2] := [2] + [3] -[3] := [1] -[1] := !T -[3] := -6 + [2] -[0] := -27 -[3] := [3] * -21 +-- inputs: I, B, ?, B +-- outputs: ?, B, B, I +[3] := 35 +[3] := T +[2] := [1] +[1] := [3] || [3] +[3] := [0] ------------------------- --- inputs: ?, ?, ?, B --- outputs: ?, ?, B, B -[3] := -12 -[0] := -17 -[3] := T == T -[2] := T -[0] := [0] == [0] -[1] := T +-- inputs: ?, I, ?, ? +-- outputs: ?, B, B, B +[1] := 22 +[3] := F +[3] := [3] +[1] := [1] == 2 +[2] := -11 == -12 +[0] := -29 + 35 ------------------------- --- inputs: ?, B, B, I --- outputs: ?, ?, ?, ? -[1] := T -[0] := [2] +-- inputs: B, I, I, B +-- outputs: ?, ?, I, B ------------------------- --- inputs: ?, ?, B, B --- outputs: I, ?, ?, ? -[3] := ![3] -[3] := -39 +-- inputs: ?, B, I, I +-- outputs: I, ?, I, ? +[3] := [2] < [3] +[3] := [2] + [2] +[1] := [1] && F +[3] := -30 + 28 +[3] := 20 + [3] +[0] := -19 +------------------------- +-- inputs: ?, ?, ?, I +-- outputs: B, I, ?, ? +[3] := 9 +[3] := F && T +[3] := 40 + -40 [2] := [3] -[1] := [3] < [3] -[3] := [1] && F -[0] := 28 +[1] := -33 + 4 +[0] := F || T ------------------------- --- inputs: I, ?, B, B --- outputs: B, I, B, ? -[2] := [3] && T -[0] := [3] -[3] := 2 + -6 -[3] := -40 -[3] := [2] || [0] -[1] := 18 +-- inputs: ?, B, B, ? +-- outputs: B, ?, I, I +[3] := F +[2] := -18 +[1] := 19 * [2] +[3] := 7 == 26 +[3] := [2] +[0] := T ------------------------- --- inputs: I, I, I, ? --- outputs: ?, I, ?, ? -[3] := [2] == 23 -[1] := 21 +-- inputs: B, I, I, B +-- outputs: B, ?, I, B +[3] := F +[1] := [2] < 16 +[3] := T +[1] := ![3] +[1] := [2] == [2] +[3] := !T ------------------------- --- inputs: I, I, ?, I --- outputs: ?, I, ?, I +-- inputs: B, ?, B, ? +-- outputs: B, ?, B, ? +[3] := -26 == -38 [3] := [3] -[0] := F -[3] := -4 < [3] -[2] := [1] * 9 -[3] := -37 * 37 -------------------------- --- inputs: B, ?, B, I --- outputs: ?, B, ?, I -[2] := [0] && F -[1] := ![2] -[0] := 2 -[3] := -20 -[2] := [2] +[2] := 24 * 8 +[3] := F || [0] +[2] := [2] < -15 +[1] := -31 * 18 ------------------------- --- inputs: I, I, I, I --- outputs: ?, ?, ?, ? +-- inputs: I, ?, I, I +-- outputs: ?, I, ?, ? +[3] := 6 + -8 +[3] := [3] + [2] +[3] := F +[2] := F +[3] := [3] +[1] := [0] diff --git a/examples/pil-dyn/tests/gens/outs-given/expected b/examples/pil-dyn/tests/gens/outs-given/expected index 4d115ba97..d502ed2c2 100644 --- a/examples/pil-dyn/tests/gens/outs-given/expected +++ b/examples/pil-dyn/tests/gens/outs-given/expected @@ -2,74 +2,81 @@ Now compiling the executable: test Output register state is given ------------------------- --- inputs: ?, B, ?, B -[0] := 4 +-- inputs: ?, B, ?, I +[0] := -33 [3] := !T [3] := -26 [3] := -2 [2] := T ------------------------- --- inputs: B, B, ?, B -[3] := -24 -[3] := T -[3] := -6 == 35 -[2] := T -[3] := -35 * -21 -[0] := [3] -------------------------- --- inputs: ?, ?, I, ? -[3] := 11 == [2] -[2] := -17 -[0] := -23 + 39 -[2] := T && F -[1] := ![3] -[3] := -16 * [0] -------------------------- --- inputs: ?, ?, B, I -[3] := [3] < [3] -[3] := 20 * -3 -[1] := !F -[3] := 12 -[3] := 20 + [3] -[0] := -19 +-- inputs: ?, ?, B, B +[2] := 13 +[3] := F +[2] := 38 == [2] +[1] := F && T +[3] := -21 + 28 +[0] := [3] + [3] ------------------------- --- inputs: I, ?, ?, I -[3] := -18 < 18 -[3] := [3] +-- inputs: B, I, I, B +[3] := [2] +[3] := [0] == T [3] := [3] -[3] := -33 + 4 -[1] := [3] * -17 +[2] := [2] < [2] +[0] := -8 +[3] := -16 * [1] +------------------------- +-- inputs: B, I, I, B +[3] := [1] == -28 +[3] := [2] +[1] := [0] && F +[3] := -30 + 28 +[0] := 20 + [3] [2] := T ------------------------- --- inputs: I, B, B, I +-- inputs: ?, ?, I, I +[3] := [3] * 20 +[3] := F && T +[2] := [3] || [3] +[3] := 18 +[1] := -33 + 4 +[0] := [3] * -17 ------------------------- --- inputs: I, B, B, ? -[2] := -39 -[3] := -18 -[3] := T && [1] -[1] := 7 + 26 -[2] := [3] -[3] := [1] + -1 +-- inputs: ?, B, B, ? +[3] := F +[2] := -18 +[1] := 19 * [2] +[2] := 7 == 26 +[3] := 27 * [1] +[0] := [3] ------------------------- --- inputs: B, I, ?, I -[2] := T -[3] := ![2] -[3] := [1] == -21 -[1] := [1] -[3] := -34 +-- inputs: B, I, I, B +[3] := F +[1] := T +[3] := [0] +[3] := [2] +[2] := F [0] := -18 ------------------------- --- inputs: ?, ?, B, I -[0] := -20 +-- inputs: I, ?, ?, ? +[0] := -28 +[2] := 27 + -38 +[1] := 13 + [2] [1] := !T -[2] := F -[3] := [2] -[0] := [0] + [0] -[3] := 10 +[2] := [1] +[3] := [0] * [0] ------------------------- --- inputs: B, I, B, B -[2] := [3] && T -[3] := [1] -[0] := [1] +-- inputs: B, ?, ?, I +[2] := [3] < [3] +[1] := -37 + [3] [1] := [2] -[2] := [1] || T +[1] := [2] +[2] := [2] +[0] := 17 +------------------------- +-- inputs: B, ?, I, ? +[3] := 1 * 7 +[0] := 31 +[0] := T && F +[2] := ![0] +[1] := -15 +[0] := [1] + 37 From fd64ca6a7ae6464619f3b8577154e962ada65778 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 5 Mar 2026 10:35:32 +0300 Subject: [PATCH 75/81] [ fix ] Add ConsRecs to specialiseIfNeeded --- src/Deriving/DepTyCheck/Util/Specialisation.idr | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index af22f3157..e3c2ab10c 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -271,6 +271,7 @@ export %tcinline specialiseIfNeeded : Elaboration m => NamesInfoInTypes => + ConsRecs => DerivationClosure m => (sig : GenSignature) -> (fuel : TTImp) -> From 8237618bd36c14c814b97c65c1673035fe52483d Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Thu, 5 Mar 2026 13:16:48 +0300 Subject: [PATCH 76/81] [ fix ] Fix tests to work after rebase --- .../specdata-028-reproPilReg2/Test.idr | 8 +- .../specialise/01-2 non-ty imm gend/expected | 4 +- .../specialise/01-3 non-ty imm exist/expected | 4 +- .../02-0 non-ty deep exist/expected | 184 ++++++++--------- .../specialise/02-1 non-ty deep gend/expected | 184 ++++++++--------- .../specialise/02-3 two-similar/expected | 192 +++++++++--------- .../03-0 non-ty imm-deep-same exist/expected | 180 ++++++++-------- .../03-1 non-ty imm-deep-same gend/expected | 180 ++++++++-------- .../expected | 188 ++++++++--------- .../expected | 4 +- .../expected | 180 ++++++++-------- .../expected | 188 ++++++++--------- .../expected | 188 ++++++++--------- .../expected | 188 ++++++++--------- .../expected | 180 ++++++++-------- .../expected | 4 +- .../05-0 non-ty complex exist-both/expected | 186 ++++++++--------- .../print/specialise/06-0 ty shallow/expected | 106 +++++----- .../print/specialise/06-1 ty deeper/expected | 138 ++++++------- .../specialise-if-needed/_common/Shared.idr | 7 +- .../spec-if-needed-002/expected | 8 +- .../spec-if-needed-004/expected | 16 +- 22 files changed, 1270 insertions(+), 1247 deletions(-) diff --git a/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Test.idr b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Test.idr index dc55fd3b8..82b619452 100644 --- a/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Test.idr +++ b/elab-util-extra/tests/specialise-data/specdata-028-reproPilReg2/Test.idr @@ -6,8 +6,12 @@ import Shared public export data Lookup : a -> List (a, b) -> Type where - Here : {0 type_of_x : Type} -> {0 x : type_of_x} -> {0 b : Type} -> {0 xys : List (type_of_x, b)} -> (y : b) -> Lookup {b} {a = type_of_x} x ((::) {a = (type_of_x, b)} (MkPair {a = type_of_x} {b} x y) xys) - There : {0 b : Type} -> {0 a : Type} -> {0 x : a} -> {0 y : b} -> {0 z : a} -> {0 xys : List (a, b)} -> Lookup {b} {a} z xys -> Lookup {b} {a} z ((::) {a = (a, b)} (MkPair {a} {b} x y) xys) + Here : {0 type_of_x : Type} -> {0 x : type_of_x} -> {0 b : Type} -> + {0 xys : List (type_of_x, b)} -> (y : b) -> + Lookup {b} {a = type_of_x} x ((::) {a = (type_of_x, b)} (MkPair {a = type_of_x} {b} x y) xys) + There : {0 b : Type} -> {0 a : Type} -> {0 x : a} -> {0 y : b} -> {0 z : a} -> + {0 xys : List (a, b)} -> Lookup {b} {a} z xys -> + Lookup {b} {a} z ((::) {a = (a, b)} (MkPair {a} {b} x y) xys) public export data IsReveal : Lookup {a} {b} x xys -> b -> Type where diff --git a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected index 32454e353..424c97de5 100644 --- a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected +++ b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected @@ -86,7 +86,9 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" .$ ( var "the" - .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) .$ ( var "map" .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse .=> iCase diff --git a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected index be729bebe..f846ae236 100644 --- a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected +++ b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected @@ -76,7 +76,9 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" .$ ( var "the" - .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) .$ ( var "map" .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse .=> iCase diff --git a/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected index 418c9df86..758406925 100644 --- a/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected +++ b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) -LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -31,14 +31,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" - .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -48,10 +44,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") } }) , IClaim @@ -121,6 +121,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[0]" @@ -188,18 +266,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var ">>=" .$ ( var "[0]" .$ var "^cons_fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) - .$ var "{arg:2}" - .$ var "{arg:3}")))) + .$ var "{arg:3}" + .$ var "{arg:4}")))) ] ] , scope = @@ -240,84 +318,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:4}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) - ] - ] - , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected index 31eca6995..a8b2ef623 100644 --- a/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected +++ b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) -LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -35,14 +35,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" - .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -52,10 +48,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") } }) , IClaim @@ -132,6 +132,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[0]" @@ -199,18 +277,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse .=> var ">>=" .$ ( var "[0]" .$ var "^cons_fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) - .$ var "{arg:3}" - .$ var "{arg:4}")))) + .$ var "{arg:4}" + .$ var "{arg:5}")))) ] ] , scope = @@ -251,84 +329,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:5}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:5}"))) - ] - ] - , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected b/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected index 27979620e..e58eb4d2d 100644 --- a/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected +++ b/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected @@ -3,10 +3,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> {auto conArg : ((arg : Fuel LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#1, #0 (n), #2] LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^8984676908526435328.List^8984676908526435328: Prelude.Basics.List String LOG deptycheck.util.specialisation:10: Prelude.Basics.List[0] Declared specialised type DerivedGen.List^12757670414100080037.List^12757670414100080037: Prelude.Basics.List (Data.Fin.Fin lam^0) -LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.List^12757670414100080037.List^12757670414100080037[0(fv^List^12757670414100080037.List^12757670414100080037^lam^0)] List^12757670414100080037^Con^1 - used final order: [#1, #2] LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8984676908526435328[] List^8984676908526435328^Con^0 - used final order: [] LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8984676908526435328[] List^8984676908526435328^Con^1 - used final order: [#0, #1] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -40,14 +40,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" - .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -57,10 +53,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") } }) , IClaim @@ -150,6 +150,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[0]" @@ -217,18 +295,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse .=> var ">>=" .$ ( var "[0]" .$ var "^cons_fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:6}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) - .$ var "{arg:4}" - .$ var "{arg:5}")))) + .$ var "{arg:5}" + .$ var "{arg:6}")))) ] ] , scope = @@ -269,84 +347,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:6}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:6}"))) - ] - ] - , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[]" @@ -401,15 +401,15 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1 (orders)")) .$ ( var ">>=" .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse .=> var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:6}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1" - .$ var "{arg:4}" - .$ var "{arg:5}")))) + .$ var "{arg:5}" + .$ var "{arg:6}")))) ] ] , scope = diff --git a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected index 19a52a33d..c8923ade0 100644 --- a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected +++ b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -31,16 +31,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -50,10 +44,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -124,6 +124,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[0, 1]" @@ -255,84 +333,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected index aa00df555..84d0d99f5 100644 --- a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected +++ b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (n), #1] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -35,16 +35,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -54,10 +48,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -135,6 +135,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[0, 1]" @@ -266,84 +344,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected index 7b88ce223..f742f50ca 100644 --- a/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected +++ b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (m), #2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -31,18 +31,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -52,10 +44,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) } }) , IClaim @@ -109,7 +109,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse .=> var ">>=" .$ ( var "the" - .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) .$ ( var "map" .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse .=> iCase @@ -144,6 +146,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[1]" @@ -285,84 +365,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected index b70912029..2d8b9a0e5 100644 --- a/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected +++ b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected @@ -96,7 +96,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" .$ ( var "the" - .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) .$ ( var "map" .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse .=> iCase diff --git a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected index 44384286a..39bd8c401 100644 --- a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected +++ b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#0 (m), #2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -33,16 +33,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -52,10 +46,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -129,6 +129,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[0, 1]" @@ -260,84 +338,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected index d4e68b4e0..408d9cfdc 100644 --- a/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (m : Nat ** X m) LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (m), #2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -35,18 +35,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -56,10 +48,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) } }) , IClaim @@ -118,7 +118,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse .=> var ">>=" .$ ( var "the" - .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) .$ ( var "map" .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse .=> iCase @@ -158,6 +160,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[1]" @@ -299,84 +379,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected index baffa76a0..b3e754f7e 100644 --- a/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** X n) LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (m), #2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -35,18 +35,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -56,10 +48,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) } }) , IClaim @@ -118,7 +118,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse .=> var ">>=" .$ ( var "the" - .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) .$ ( var "map" .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse .=> iCase @@ -158,6 +160,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[1]" @@ -299,84 +379,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected index c8e52412f..327d287e5 100644 --- a/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected +++ b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty (n : Nat ** (m : Nat ** X n m)) LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#0 (m), #2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -39,18 +39,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -60,10 +52,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) } }) , IClaim @@ -125,7 +125,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse .=> var ">>=" .$ ( var "the" - .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) .$ ( var "map" .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse .=> iCase @@ -167,6 +169,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[1]" @@ -308,84 +388,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:4}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) - ] - ] - , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected index 15e08a120..9ebc8ccb3 100644 --- a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected @@ -2,10 +2,10 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (n : Nat) -> Gen MaybeEmpty (m : Nat ** X n m) LOG deptycheck.derive.least-effort:7: DerivedGen.X[0] MkX - used final order: [#0 (m), #2] LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] -LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: [#1] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -38,16 +38,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -57,10 +51,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -139,6 +139,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[0, 1]" @@ -270,84 +348,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:4}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) - ] - ] - , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected index 7cc2b58d6..14ba268fd 100644 --- a/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected @@ -104,7 +104,9 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" .$ ( var "the" - .$ (var "Gen" .$ var "MaybeEmpty" .$ (var "DPair" .$ implicitFalse .$ implicitFalse)) + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) .$ ( var "map" .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse .=> iCase diff --git a/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected index bfb082374..5ddf6390e 100644 --- a/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected +++ b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected @@ -3,12 +3,12 @@ LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty X LOG deptycheck.derive.least-effort:7: DerivedGen.X[] MkX - used final order: [#1 (n), #0 (m), #3, #2] LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^6814960928365568963.Either^6814960928365568963: Prelude.Types.Either (Data.Nat.LTE lam^0 lam^1) (Data.Nat.LTE lam^2 lam^3) LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550: Data.Vect.Vect lam^0 (Data.Fin.Fin lam^1) +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^0 - used final order: [] LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550[0(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0), 1(fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1)] Vect^1863907217212445550^Con^1 - used final order: [#3 (xs), #2 (x)] LOG deptycheck.derive.least-effort:7: DerivedGen.Either^6814960928365568963.Either^6814960928365568963[0(fv^Either^6814960928365568963.Either^6814960928365568963^lam^0), 1(fv^Either^6814960928365568963.Either^6814960928365568963^lam^1), 2(fv^Either^6814960928365568963.Either^6814960928365568963^lam^2), 3(fv^Either^6814960928365568963.Either^6814960928365568963^lam^3)] Either^6814960928365568963^Con^0 - used final order: [#4 (x)] LOG deptycheck.derive.least-effort:7: DerivedGen.Either^6814960928365568963.Either^6814960928365568963[0(fv^Either^6814960928365568963.Either^6814960928365568963^lam^0), 1(fv^Either^6814960928365568963.Either^6814960928365568963^lam^1), 2(fv^Either^6814960928365568963.Either^6814960928365568963^lam^2), 3(fv^Either^6814960928365568963.Either^6814960928365568963^lam^3)] Either^6814960928365568963^Con^1 - used final order: [#4 (x)] -LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] -LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] LOG deptycheck.derive.least-effort:7: Data.Nat.LTE[0(n), 1(m)] LTEZero - used final order: [] LOG deptycheck.derive.least-effort:7: Data.Nat.LTE[0(n), 1(m)] LTESucc - used final order: [#2] LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FZ - used final order: [] @@ -29,6 +29,19 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 (MkIClaimData { rig = MW @@ -71,19 +84,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") } }) - , IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 (MkIClaimData { rig = MW @@ -184,6 +184,84 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "<>" .$ var "^fuel_arg^") } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] , IDef emptyFC "[0, 1]" @@ -458,84 +536,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "weight^Prelude.Types.Nat" diff --git a/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected index c63115bec..03b2d074b 100644 --- a/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected +++ b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected @@ -5,10 +5,10 @@ LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared LOG deptycheck.derive.least-effort:7: DerivedGen.Either^4289176107705670177.Either^4289176107705670177[] Either^4289176107705670177^Con^0 - used final order: [#0 (x)] LOG deptycheck.derive.least-effort:7: DerivedGen.Either^4289176107705670177.Either^4289176107705670177[] Either^4289176107705670177^Con^1 - used final order: [#0 (x)] LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^11712255676025100806.Y^11712255676025100806: DerivedGen.Y Prelude.Types.Nat -LOG deptycheck.derive.least-effort:7: DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] Y^11712255676025100806^Con^0 - used final order: [#0] -LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] Y^11712255676025100806^Con^0 - used final order: [#0] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13682636983817606971.Either^13682636983817606971: Prelude.Types.Either Prelude.Types.Nat Prelude.Types.Nat LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^0 - used final order: [#0 (x)] LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] Either^13682636983817606971^Con^1 - used final order: [#0 (x)] MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") @@ -49,12 +49,10 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -64,10 +62,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { 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" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" } }) , IClaim @@ -205,49 +205,6 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit .$ var "Nil"))) } ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0 (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0" .$ var "{arg:2}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] , IDef emptyFC "[]" @@ -300,10 +257,10 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) .$ ( var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:3}"))) + .$ (var "Prelude.Types.S" .$ var "{arg:2}"))) ] ] , scope = @@ -330,6 +287,49 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit } } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0" .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] , IDef emptyFC "[]" diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected index 9426831c7..eb2823a65 100644 --- a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected @@ -5,10 +5,10 @@ LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared LOG deptycheck.derive.least-effort:7: DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^Either^17089122808763292221.Either^17089122808763292221^lam^0)] Either^17089122808763292221^Con^0 - used final order: [#0 (x)] LOG deptycheck.derive.least-effort:7: DerivedGen.Either^17089122808763292221.Either^17089122808763292221[0(fv^Either^17089122808763292221.Either^17089122808763292221^lam^0)] Either^17089122808763292221^Con^1 - used final order: [#1 (x)] LOG deptycheck.util.specialisation:10: DerivedGen.Y[0] Declared specialised type DerivedGen.Y^7167106520753982886.Y^7167106520753982886: DerivedGen.Y (Prelude.Types.Either (Data.Fin.Fin lam^0) String) -LOG deptycheck.derive.least-effort:7: DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^Y^7167106520753982886.Y^7167106520753982886^lam^0)] Y^7167106520753982886^Con^0 - used final order: [#1] -LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^5595291053177582713.Either^5595291053177582713: Prelude.Types.Either Prelude.Types.Nat (Prelude.Types.Either (Data.Fin.Fin lam^0) String) LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] Z - used final order: [] LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: [#0] +LOG deptycheck.derive.least-effort:7: DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^Y^7167106520753982886.Y^7167106520753982886^lam^0)] Y^7167106520753982886^Con^0 - used final order: [#1] +LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^5595291053177582713.Either^5595291053177582713: Prelude.Types.Either Prelude.Types.Nat (Prelude.Types.Either (Data.Fin.Fin lam^0) String) LOG deptycheck.derive.least-effort:7: DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^Either^5595291053177582713.Either^5595291053177582713^lam^0)] Either^5595291053177582713^Con^0 - used final order: [#0 (x)] LOG deptycheck.derive.least-effort:7: DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^Either^5595291053177582713.Either^5595291053177582713^lam^0)] Either^5595291053177582713^Con^1 - used final order: [#1 (x)] LOG deptycheck.util.specialisation:10: Prelude.Types.Either[0(a), 1(b)] Declared specialised type DerivedGen.Either^13748098436294604892.Either^13748098436294604892: Prelude.Types.Either (Data.Fin.Fin lam^0) String @@ -62,13 +62,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -78,10 +75,13 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") } }) , IClaim @@ -287,64 +287,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] - , IDef - emptyFC - "[0]" - [ var "[0]" - .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" - .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") - } - }) - , IDef - emptyFC - "<>" - [ var "<>" - .$ bindVar "^cons_fuel^" - .$ bindVar "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0 (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^5595291053177582713.mToP") - .$ ( var "[0]" - .$ var "^outmost-fuel^" - .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0" - .! ("fv^Y^7167106520753982886.Y^7167106520753982886^lam^0", implicitTrue) - .$ var "{arg:3}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal - (Str - "DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^Y^7167106520753982886.Y^7167106520753982886^lam^0)] (non-spending)")) - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^") - } - ] , IDef emptyFC "[]" @@ -393,10 +335,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) .$ ( var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + .$ (var "Prelude.Types.S" .$ var "{arg:3}"))) ] ] , scope = @@ -423,6 +365,64 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] + , IDef + emptyFC + "[0]" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886" + .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^5595291053177582713.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0" + .! ("fv^Y^7167106520753982886.Y^7167106520753982886^lam^0", implicitTrue) + .$ var "{arg:4}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Y^7167106520753982886.Y^7167106520753982886[0(fv^Y^7167106520753982886.Y^7167106520753982886^lam^0)] (non-spending)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + } + ] , IDef emptyFC "[0]" diff --git a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr index 184b87727..dfc2c3771 100644 --- a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr +++ b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr @@ -3,6 +3,7 @@ module Shared import public Control.Monad.Writer import public Control.Monad.Either import public Deriving.DepTyCheck.Util.Specialisation +import public Deriving.DepTyCheck.Gen.ConsRecs import public Language.Reflection.Unify %language ElabReflection @@ -16,7 +17,7 @@ record CallGen where export [PrintDC] -Monad m => Elaboration m => NamesInfoInTypes => DerivationClosure m where +Monad m => Elaboration m => DerivationClosure m where needWeightFun ti = do logMsg "" 0 "needWeightFun \{show ti}" pure () @@ -26,7 +27,7 @@ Monad m => Elaboration m => NamesInfoInTypes => DerivationClosure m where export [WriterDC] -Monad m => Elaboration m => MonadWriter (Maybe CallGen) m => NamesInfoInTypes => DerivationClosure m where +Monad m => Elaboration m => MonadWriter (Maybe CallGen) m => DerivationClosure m where needWeightFun ti = pure () callGen sig fuel params = do tell $ Just $ MkCallGen sig fuel params @@ -73,6 +74,7 @@ runSIN namesInfo declareSpec e = do let givenVals = formGivenVals (Vect.fromList (Prelude.toList givenSet)) $ snd <$> filtered let dc = PrintDC @{%search} + _ <- getConsRecs r <- specialiseIfNeeded (MkGenSignature ti givenSet) `(?fuel) givenVals case r of Nothing => logMsg "" 0 "sIN returned nothing." @@ -108,6 +110,7 @@ runSIN' namesInfo declareSpec e = do let givenVals = formGivenVals (Vect.fromList (Prelude.toList givenSet)) $ snd <$> filtered let dc = WriterDC @{%search} + _ <- getConsRecs r <- specialiseIfNeeded (MkGenSignature ti givenSet) `(?fuel) givenVals case r of Nothing => pure Nothing diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index 4accb6e48..73f60fbe5 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -7,8 +7,8 @@ LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] ({arg:1} := Prelude.Types LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: \ lam^0 => Test.X Prelude.Types.Nat lam^0 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:2} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^17949373096448478648.X^17949373096448478648 +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^5875988914566845402.X^5875988914566845402 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived Test.X^17949373096448478648.X^17949373096448478648 -LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type Test.X^17949373096448478648.X^17949373096448478648: Test.X Prelude.Types.Nat lam^0 -LOG deptycheck.test.utils.specialise:0: Test.X^17949373096448478648.X^17949373096448478648[0(fv^X^17949373096448478648.X^17949373096448478648^lam^0)] CallGen params: [Prelude.Types.S] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived Test.X^5875988914566845402.X^5875988914566845402 +LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type Test.X^5875988914566845402.X^5875988914566845402: Test.X Prelude.Types.Nat lam^0 +LOG deptycheck.test.utils.specialise:0: Test.X^5875988914566845402.X^5875988914566845402[0(fv^X^5875988914566845402.X^5875988914566845402^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index bcddf3241..e3f44fcab 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -11,11 +11,11 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:3} := Test.Nn) G LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : ({arg:5} : Prelude.Types.Nat) -> Type) -> (lam^2 : Prelude.Types.Nat) -> (lam^3 : ({arg:6} : lam^1 lam^2) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^14421981371219706324.Y^14421981371219706324 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^2732726595258903190.Y^2732726595258903190 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^14421981371219706324.Y^14421981371219706324 -LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^14421981371219706324.Y^14421981371219706324: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) -LOG deptycheck.test.utils.specialise:0: Test.Y^14421981371219706324.Y^14421981371219706324[0(fv^Y^14421981371219706324.Y^14421981371219706324^lam^0), 1(fv^Y^14421981371219706324.Y^14421981371219706324^lam^1), 2(fv^Y^14421981371219706324.Y^14421981371219706324^lam^2), 3(fv^Y^14421981371219706324.Y^14421981371219706324^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^2732726595258903190.Y^2732726595258903190 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^2732726595258903190.Y^2732726595258903190: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) +LOG deptycheck.test.utils.specialise:0: Test.Y^2732726595258903190.Y^2732726595258903190[0(fv^Y^2732726595258903190.Y^2732726595258903190^lam^0), 1(fv^Y^2732726595258903190.Y^2732726595258903190^lam^1), 2(fv^Y^2732726595258903190.Y^2732726595258903190^lam^2), 3(fv^Y^2732726595258903190.Y^2732726595258903190^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn', Test.X Data.Fin.Fin (fromInteger 5) Test.Nn']... LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising @@ -27,8 +27,8 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:3} := Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:6} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^17936145782101774282.Y^17936145782101774282 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^681621592850268394.Y^681621592850268394 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^17936145782101774282.Y^17936145782101774282 -LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^17936145782101774282.Y^17936145782101774282: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) -LOG deptycheck.test.utils.specialise:0: Test.Y^17936145782101774282.Y^17936145782101774282[0(fv^Y^17936145782101774282.Y^17936145782101774282^lam^0), 1(fv^Y^17936145782101774282.Y^17936145782101774282^lam^1), 2(fv^Y^17936145782101774282.Y^17936145782101774282^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^681621592850268394.Y^681621592850268394 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^681621592850268394.Y^681621592850268394: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) +LOG deptycheck.test.utils.specialise:0: Test.Y^681621592850268394.Y^681621592850268394[0(fv^Y^681621592850268394.Y^681621592850268394^lam^0), 1(fv^Y^681621592850268394.Y^681621592850268394^lam^1), 2(fv^Y^681621592850268394.Y^681621592850268394^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] From 7650611f02fe7c63bc6a59df2f80926207c1de5a Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 16 Mar 2026 15:46:18 +0300 Subject: [PATCH 77/81] [ fix ] Update specialisation logic in dtc following rebase --- src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr | 7 ++++++- src/Deriving/DepTyCheck/Util/Specialisation.idr | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr index 1cd6fcded..3bda802ed 100644 --- a/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr +++ b/src/Deriving/DepTyCheck/Gen/ForAllNeededTypes/Impl.idr @@ -73,9 +73,14 @@ DeriveBodyForType => ClosuringContext m => Elaboration m => SortedMap GenSignatu -- check if internal generator asked for is for a primitive type when (isTypeInfoPrim sig.targetType) $ fail "Cannot derive generator for the primitive type \{show $ extractTargetTyExpr sig.targetType}, use external instead" + notfound <- pure $ id $ not $ List.Set.contains sig %search + + sinRet : Maybe TTImp <- if notfound then assert_total specialiseIfNeeded sig fuel values else pure Nothing + let Nothing = sinRet + | Just me => pure (me, Nothing) -- remember the task to derive, if necessary - when (not $ List.Set.contains sig %search) $ do + when notfound $ do modify $ if isTypeKnown sig.targetType then mapFst $ normalise . List.Set.insert sig else mapSnd $ normalise . List.Set.insert sig -- call the internal gen diff --git a/src/Deriving/DepTyCheck/Util/Specialisation.idr b/src/Deriving/DepTyCheck/Util/Specialisation.idr index e3c2ab10c..590e8e749 100644 --- a/src/Deriving/DepTyCheck/Util/Specialisation.idr +++ b/src/Deriving/DepTyCheck/Util/Specialisation.idr @@ -276,7 +276,7 @@ specialiseIfNeeded : (sig : GenSignature) -> (fuel : TTImp) -> Vect sig.givenParams.size TTImp -> - m $ Maybe (List Decl, TypeInfo, TTImp) + m $ Maybe TTImp specialiseIfNeeded sig fuel givenParamValues = do logPoint DetailedDebug "deptycheck.util.specialisation" [sig] "Checking specialisation need for \{show givenParamValues}..." -- Check if there are any given type args, if not return Nothing @@ -358,4 +358,4 @@ specialiseIfNeeded sig fuel givenParamValues = do case invv of ~(mkDPairHelper generateds bindVar (bindVar "inv")) => ~(mkDPairHelper generateds var `(cast @{~(var $ inSameNS specTy.name "mToP")} inv))) ~inv) - pure $ Just (specDecls, specTy, inv) + pure $ Just inv From 38714acef9b2a2d209d761ec95d5bdc596f507c1 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 17 Mar 2026 15:59:48 +0300 Subject: [PATCH 78/81] [ perf ] Monadize another bottleneck ~5 times faster now --- .../Language/Reflection/Unify/Interface.idr | 19 ++++++++++--------- .../Reflection/Unify/WithCompiler.idr | 8 ++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/elab-util-extra/src/Language/Reflection/Unify/Interface.idr b/elab-util-extra/src/Language/Reflection/Unify/Interface.idr index a03bc8d34..6d4cfae92 100644 --- a/elab-util-extra/src/Language/Reflection/Unify/Interface.idr +++ b/elab-util-extra/src/Language/Reflection/Unify/Interface.idr @@ -11,6 +11,7 @@ import Deriving.Show import Language.Reflection import Language.Reflection.Expr import Language.Reflection.Syntax +import Language.Reflection.Logging %language ElabReflection @@ -292,14 +293,14 @@ emptyLeaves : (dg : DependencyGraph) -> FinSet dg.freeVars emptyLeaves dg = intersection dg.empties $ leaves dg ||| List all the free variables without a value in order of dependency -flattenEmpties : (dg : DependencyGraph) -> SnocList $ Fin dg.freeVars +flattenEmpties : Monad m => (dg : DependencyGraph) -> m $ SnocList $ Fin dg.freeVars flattenEmpties dg = flattenEmpties' dg [<] where - flattenEmpties' : (dg : DependencyGraph) -> SnocList (Fin dg.freeVars) -> SnocList $ Fin dg.freeVars + flattenEmpties' : (dg : DependencyGraph) -> SnocList (Fin dg.freeVars) -> m $ SnocList $ Fin dg.freeVars flattenEmpties' dg@(MkDG {freeVars, fvData, fvDeps, empties, nameToId, holeToId}) ctx = do - let els = emptyLeaves dg + els <- pure $ id $ emptyLeaves dg let False = null els - | _ => ctx + | _ => pure ctx -- Now els is a non-empty subset of dg.empties flattenEmpties' -- `assert_smaller dg` is a workaround for a non-working `assert_smaller empties` @@ -324,12 +325,12 @@ filterEmpty = foldl myfun [] ||| Calculate UnificationResult (var-to-value mappings and empty leaf dependency order) export -finalizeDG : (task : UnificationTask) -> (dg : DependencyGraph) -> UnificationResult +finalizeDG : Monad m => MonadLog m => (task : UnificationTask) -> (dg : DependencyGraph) -> m UnificationResult finalizeDG task dg = do - let fvOrder = flattenEmpties dg - let urList = filterEmpty dg.fvData - let (lhsRL, rhsRL) = List.splitAt task.lfv urList - MkUR + fvOrder <- flattenEmpties dg + urList <- pure $ id $ filterEmpty dg.fvData + (lhsRL, rhsRL) <- pure $ id $ List.splitAt task.lfv urList + pure $ MkUR { task , uniDg = dg , lhsResult = fromList lhsRL diff --git a/elab-util-extra/src/Language/Reflection/Unify/WithCompiler.idr b/elab-util-extra/src/Language/Reflection/Unify/WithCompiler.idr index 8c2e92c9a..4a1d5d2ca 100644 --- a/elab-util-extra/src/Language/Reflection/Unify/WithCompiler.idr +++ b/elab-util-extra/src/Language/Reflection/Unify/WithCompiler.idr @@ -216,10 +216,10 @@ solveDG : (dg : DependencyGraph) -> m DependencyGraph solveDG dg = do - let cs = canSub dg + cs <- pure $ id $ canSub dg let False = null cs | _ => pure dg - ds <- pure $ doSub dg cs + ds <- pure $ id $ doSub dg cs -- DG <= DS because cs is non-empty, and every doSub may shrink the set of possibly substitutable variables -- If doSub can't shrink it, the dependency graph stays the same if ds == dg @@ -356,7 +356,7 @@ unifyWithCompiler task = do let err = pure {f=Elab} $ Left $ Just CatastrophicError rr <- try ret err dg <- liftEither rr - ur <- pure $ finalizeDG task dg + ur <- finalizeDG task dg logPoint DetailedDebug "unifyWithCompiler" [] "Unification result: \{show ur}" pure ur @@ -369,7 +369,7 @@ unifyWithCompiler' : m $ UnificationResult unifyWithCompiler' task = do dg <- unify' task - pure $ finalizeDG task dg + finalizeDG task dg export [UnifyWithCompiler] From de5fe1a38a7cecef5fdbafd509e7b03765e816da Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Tue, 17 Mar 2026 16:33:10 +0300 Subject: [PATCH 79/81] [ fix ] Fix tests broken by recent rebase --- .../print/specialise/00-1 simple/expected | 102 +-- .../print/specialise/00-2 simple/expected | 102 +-- .../specialise/00-3 two-same shallow/expected | 112 +-- .../specialise/00-4 two-same deep/expected | 194 ++--- .../specialise/00-5 two-similar/expected | 124 ++-- .../specialise/01-1 non-ty imm givn/expected | 106 +-- .../specialise/01-2 non-ty imm gend/expected | 160 ++--- .../specialise/01-3 non-ty imm exist/expected | 150 ++-- .../02-0 non-ty deep exist/expected | 310 ++++---- .../specialise/02-1 non-ty deep gend/expected | 324 ++++----- .../specialise/02-2 non-ty deep givn/expected | 148 ++-- .../specialise/02-3 two-similar/expected | 380 +++++----- .../03-0 non-ty imm-deep-same exist/expected | 308 ++++---- .../03-1 non-ty imm-deep-same gend/expected | 322 ++++----- .../03-2 non-ty imm-deep-same givn/expected | 146 ++-- .../expected | 352 ++++----- .../expected | 182 ++--- .../expected | 316 ++++---- .../expected | 364 +++++----- .../expected | 364 +++++----- .../expected | 382 +++++----- .../expected | 154 ++-- .../expected | 328 ++++----- .../expected | 202 +++--- .../05-0 non-ty complex exist-both/expected | 548 +++++++------- .../print/specialise/06-0 ty shallow/expected | 224 +++--- .../print/specialise/06-1 ty deeper/expected | 491 +++++++------ .../print/specialise/06-2 ty deep/expected | 274 +++---- .../specialise/06-3 ty deep hkd/expected | 274 +++---- .../specialise/06-4 ty deep hkd/expected | 348 ++++----- .../07-0 list-lookup/DerivedGen.idr | 18 + .../specialise/07-0 list-lookup/derive.ipkg | 1 + .../specialise/07-0 list-lookup/expected | 364 ++++++++++ .../print/specialise/07-0 list-lookup}/run | 0 .../DerivedGen.idr | 33 + .../07-1 vect-indexed-multargspec/derive.ipkg | 1 + .../07-1 vect-indexed-multargspec/expected | 674 ++++++++++++++++++ .../07-1 vect-indexed-multargspec/run | 1 + .../07-0 list-lookup/DerivedGen.idr | 6 +- .../DerivedGen.idr | 12 +- .../specialise-if-needed/_common/Shared.idr | 19 +- .../spec-if-needed-002/expected | 8 +- .../spec-if-needed-004/expected | 16 +- .../spec-if-needed-005/Test.idr | 2 +- .../spec-if-needed-005/dont-run | 1 + 45 files changed, 5012 insertions(+), 3935 deletions(-) create mode 100644 tests/derivation/least-effort/print/specialise/07-0 list-lookup/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/07-0 list-lookup/derive.ipkg create mode 100644 tests/derivation/least-effort/print/specialise/07-0 list-lookup/expected rename tests/derivation/{utils/specialise-if-needed/spec-if-needed-005 => least-effort/print/specialise/07-0 list-lookup}/run (100%) create mode 100644 tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr create mode 120000 tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/derive.ipkg create mode 100644 tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/expected create mode 120000 tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/run create mode 120000 tests/derivation/utils/specialise-if-needed/spec-if-needed-005/dont-run diff --git a/tests/derivation/least-effort/print/specialise/00-1 simple/expected b/tests/derivation/least-effort/print/specialise/00-1 simple/expected index c690758cf..cdc20151e 100644 --- a/tests/derivation/least-effort/print/specialise/00-1 simple/expected +++ b/tests/derivation/least-effort/print/specialise/00-1 simple/expected @@ -16,10 +16,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" } }) , IClaim @@ -29,12 +31,10 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -50,47 +50,6 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] , IDef emptyFC "[]" @@ -145,15 +104,15 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1" - .$ var "{arg:2}" - .$ var "{arg:3}")))) + .$ var "{arg:1}" + .$ var "{arg:2}")))) ] ] , scope = @@ -184,6 +143,47 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: } } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] , IDef emptyFC "[]" diff --git a/tests/derivation/least-effort/print/specialise/00-2 simple/expected b/tests/derivation/least-effort/print/specialise/00-2 simple/expected index 098bb6814..910b6c7bd 100644 --- a/tests/derivation/least-effort/print/specialise/00-2 simple/expected +++ b/tests/derivation/least-effort/print/specialise/00-2 simple/expected @@ -20,10 +20,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8 , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" } }) , IClaim @@ -33,55 +35,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8 , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:2}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] , IDef emptyFC "[]" @@ -136,15 +95,15 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8 .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1 (orders)")) .$ ( var ">>=" .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1" - .$ var "{arg:3}" - .$ var "{arg:4}")))) + .$ var "{arg:2}" + .$ var "{arg:3}")))) ] ] , scope = @@ -175,6 +134,47 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.List^8984676908526435328.List^8 } } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:4}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/expected b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/expected index 67b10240a..a0e3823f0 100644 --- a/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/expected +++ b/tests/derivation/least-effort/print/specialise/00-3 two-same shallow/expected @@ -16,10 +16,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" } }) , IClaim @@ -29,12 +31,10 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -50,52 +50,6 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:1}" .$ var "{arg:2}")))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] , IDef emptyFC "[]" @@ -150,15 +104,15 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1" - .$ var "{arg:3}" - .$ var "{arg:4}")))) + .$ var "{arg:1}" + .$ var "{arg:2}")))) ] ] , scope = @@ -189,6 +143,52 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: } } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:3}" .$ var "{arg:4}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] , IDef emptyFC "[]" diff --git a/tests/derivation/least-effort/print/specialise/00-4 two-same deep/expected b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/expected index c3e0854f6..c21e6beaf 100644 --- a/tests/derivation/least-effort/print/specialise/00-4 two-same deep/expected +++ b/tests/derivation/least-effort/print/specialise/00-4 two-same deep/expected @@ -17,10 +17,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" } }) , IClaim @@ -30,10 +32,10 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.Y" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -43,12 +45,10 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.Y" } }) , IClaim @@ -64,91 +64,6 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:1}" .$ var "{arg:2}")))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.Y" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkY (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkY" .$ var "{arg:3}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] , IDef emptyFC "[]" @@ -203,15 +118,15 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1" - .$ var "{arg:4}" - .$ var "{arg:5}")))) + .$ var "{arg:1}" + .$ var "{arg:2}")))) ] ] , scope = @@ -242,6 +157,91 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: } } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:3}" .$ var "{arg:4}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.Y" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkY (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkY" .$ var "{arg:5}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] , IDef emptyFC "[]" diff --git a/tests/derivation/least-effort/print/specialise/00-5 two-similar/expected b/tests/derivation/least-effort/print/specialise/00-5 two-similar/expected index 856930423..cd5862556 100644 --- a/tests/derivation/least-effort/print/specialise/00-5 two-similar/expected +++ b/tests/derivation/least-effort/print/specialise/00-5 two-similar/expected @@ -25,10 +25,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" } }) , IClaim @@ -38,12 +40,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.List^4779069909474151191.List^4779069909474151191" + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" } }) , IClaim @@ -53,12 +55,10 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -74,52 +74,6 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:2}" .$ var "{arg:3}")))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] , IDef emptyFC "[]" @@ -174,15 +128,15 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^4779069909474151191.List^4779069909474151191^Con^1" - .$ var "{arg:4}" - .$ var "{arg:5}")))) + .$ var "{arg:2}" + .$ var "{arg:3}")))) ] ] , scope = @@ -267,15 +221,15 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1 (orders)")) .$ ( var ">>=" .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1" - .$ var "{arg:4}" - .$ var "{arg:5}")))) + .$ var "{arg:2}" + .$ var "{arg:3}")))) ] ] , scope = @@ -306,6 +260,52 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: } } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^4779069909474151191.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:4}" .$ var "{arg:5}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] , IDef emptyFC "[]" diff --git a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected index d0ccca8cd..4b9ef0819 100644 --- a/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected +++ b/tests/derivation/least-effort/print/specialise/01-1 non-ty imm givn/expected @@ -21,11 +21,14 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 , opts = [] , type = mkTy - { name = "[0]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:2}") + .-> MkArg MW ExplicitArg (Just "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") } }) , IClaim @@ -35,60 +38,13 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 , opts = [] , type = mkTy - { name = "[0]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" - .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:2}") } }) - , IDef - emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:2}>" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:2}") - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP") - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:3}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:2}>") - } - ] , IDef emptyFC "[0]" @@ -202,6 +158,50 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 } } ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:2}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:2}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:2}>") + } + ] ] , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" } diff --git a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected index 424c97de5..5edc29981 100644 --- a/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected +++ b/tests/derivation/least-effort/print/specialise/01-2 non-ty imm gend/expected @@ -20,15 +20,20 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 , opts = [] , type = mkTy - { name = "[]" + { 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 "{arg:2}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:2}")) + .$ ( MkArg + MW + ExplicitArg + (Just "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") + (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" + .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) } }) , IClaim @@ -38,91 +43,17 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 , opts = [] , type = mkTy - { name = "[]" + { 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 "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0") - (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^120651999565177027.Vect^120651999565177027" - .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:2}")) } }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:2}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:2}")) - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "the" - .$ ( var "Gen" - .$ var "MaybeEmpty" - .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) - .$ ( var "map" - .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse - .=> iCase - { sc = var "invv" - , ty = implicitFalse - , clauses = - [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" - .= var "MkDPair" - .$ var "dph^0" - .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP" .$ var "inv") - ] - }) - .$ (var "[]" .$ var "^outmost-fuel^"))) - .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse - .=> iCase - { sc = var "{lamc:1}" - , ty = implicitFalse - , clauses = - [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" - .= var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:3}")) - ] - })) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] , IDef emptyFC "[]" @@ -243,6 +174,75 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 } } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:2}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP" .$ var "inv") + ] + }) + .$ (var "[]" .$ var "^outmost-fuel^"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:3}")) + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected index f846ae236..c890309f3 100644 --- a/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected +++ b/tests/derivation/least-effort/print/specialise/01-3 non-ty imm exist/expected @@ -14,19 +14,6 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 .=> local { decls = [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "[]" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IClaim (MkIClaimData { rig = MW , vis = Export @@ -49,68 +36,19 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 .$ var "fv^Vect^120651999565177027.Vect^120651999565177027^lam^0")) } }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "the" - .$ ( var "Gen" - .$ var "MaybeEmpty" - .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) - .$ ( var "map" - .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse - .=> iCase - { sc = var "invv" - , ty = implicitFalse - , clauses = - [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" - .= var "MkDPair" - .$ var "dph^0" - .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP" .$ var "inv") - ] - }) - .$ (var "[]" .$ var "^outmost-fuel^"))) - .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse - .=> iCase - { sc = var "{lamc:1}" - , ty = implicitFalse - , clauses = - [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" - .= var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}") - ] - })) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) , IDef emptyFC "[]" @@ -231,6 +169,68 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^120651999565177027.Vect^12 } } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^120651999565177027.mToP" .$ var "inv") + ] + }) + .$ (var "[]" .$ var "^outmost-fuel^"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}") + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected index 758406925..b4695fe5d 100644 --- a/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected +++ b/tests/derivation/least-effort/print/specialise/02-0 non-ty deep exist/expected @@ -18,10 +18,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") } }) , IClaim @@ -31,10 +35,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -44,14 +49,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" - .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -59,146 +60,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") - .$ ( var "[0]" - .$ var "^outmost-fuel^" - .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:1}")))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[0]" @@ -266,18 +142,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var ">>=" .$ ( var "[0]" .$ var "^cons_fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) - .$ var "{arg:3}" - .$ var "{arg:4}")))) + .$ var "{arg:1}" + .$ var "{arg:2}")))) ] ] , scope = @@ -318,12 +194,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -375,10 +245,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -395,6 +265,136 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:4}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:5}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected index a8b2ef623..91da1cd0f 100644 --- a/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected +++ b/tests/derivation/least-effort/print/specialise/02-1 non-ty deep gend/expected @@ -18,14 +18,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") } }) , IClaim @@ -35,10 +35,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -48,14 +49,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" - .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) } }) , IClaim @@ -63,153 +64,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:1}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}")) - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") - .$ ( var "[0]" - .$ var "^outmost-fuel^" - .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}"))))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[0]" @@ -277,18 +146,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var ">>=" .$ ( var "[0]" .$ var "^cons_fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) - .$ var "{arg:4}" - .$ var "{arg:5}")))) + .$ var "{arg:2}" + .$ var "{arg:3}")))) ] ] , scope = @@ -329,12 +198,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -386,10 +249,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:6}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:6}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -406,6 +269,143 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:5}"))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:6}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:6}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/expected b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/expected index d2da6226f..b2ab3d242 100644 --- a/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/expected +++ b/tests/derivation/least-effort/print/specialise/02-2 non-ty deep givn/expected @@ -11,20 +11,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .=> local { decls = [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "[0]" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") - } - }) - , IClaim (MkIClaimData { rig = MW , vis = Export @@ -46,7 +32,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData @@ -55,57 +48,20 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { 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") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") } }) - , IDef - emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:1}") - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") - } - ] + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) , IDef emptyFC "[0]" @@ -173,18 +129,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var ">>=" .$ ( var "[0]" .$ var "^cons_fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) - .$ var "{arg:3}" - .$ var "{arg:4}")))) + .$ var "{arg:2}" + .$ var "{arg:3}")))) ] ] , scope = @@ -225,12 +181,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -282,10 +232,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -302,6 +252,56 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:5}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" } diff --git a/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected b/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected index e58eb4d2d..da199b717 100644 --- a/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected +++ b/tests/derivation/least-effort/print/specialise/02-3 two-similar/expected @@ -27,10 +27,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" + .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") } }) , IClaim @@ -40,10 +44,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -53,14 +58,12 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^List^12757670414100080037.List^12757670414100080037^lam^0") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037" - .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") + .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" } }) , IClaim @@ -70,12 +73,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.List^8984676908526435328.List^8984676908526435328" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -83,151 +84,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") - .$ ( var "[0]" - .$ var "^outmost-fuel^" - .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}" .$ var "{arg:3}"))))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:4}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) - ] - ] - , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[0]" @@ -295,18 +166,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1 (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var ">>=" .$ ( var "[0]" .$ var "^cons_fuel^" .$ var "fv^List^12757670414100080037.List^12757670414100080037^lam^0") - .$ ( MkArg MW ExplicitArg (Just "{arg:6}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^12757670414100080037.List^12757670414100080037^Con^1" .! ("fv^List^12757670414100080037.List^12757670414100080037^lam^0", implicitTrue) - .$ var "{arg:5}" - .$ var "{arg:6}")))) + .$ var "{arg:2}" + .$ var "{arg:3}")))) ] ] , scope = @@ -347,6 +218,77 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) + .$ var "Nil"))) + } + ] , IDef emptyFC "[]" @@ -401,15 +343,15 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1 (orders)")) .$ ( var ">>=" .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var ">>=" .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:6}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.List^8984676908526435328.List^8984676908526435328^Con^1" - .$ var "{arg:5}" - .$ var "{arg:6}")))) + .$ var "{arg:2}" + .$ var "{arg:3}")))) ] ] , scope = @@ -440,14 +382,59 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^8984676908526435328.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.List^12757670414100080037.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:6}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:5}" .$ var "{arg:6}"))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } ] , IDef emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -457,11 +444,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -471,50 +457,64 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= 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" + .$ (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 "Prelude.Types.S" .$ bindVar "k") + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) .$ ( var ">>=" - .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") + .$ (var "[]" .$ var "^cons_fuel^") .$ ( MkArg MW ExplicitArg (Just "{arg:7}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:7}"))) - , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + .$ (var "Prelude.Types.S" .$ var "{arg:7}"))) ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.frequency" - .$ ( var "::" - .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) - .$ ( var "::" - .$ ( var "Builtin.MkPair" - .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) - .$ var "Nil"))) + 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } } ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected index c8923ade0..730122e59 100644 --- a/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected +++ b/tests/derivation/least-effort/print/specialise/03-0 non-ty imm-deep-same exist/expected @@ -18,10 +18,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -31,10 +37,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -44,16 +51,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -61,147 +62,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "n" - .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:1}")))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[0, 1]" @@ -333,12 +208,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -390,10 +259,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:1}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -410,6 +279,137 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected index 84d0d99f5..977f330b9 100644 --- a/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected +++ b/tests/derivation/least-effort/print/specialise/03-1 non-ty imm-deep-same gend/expected @@ -18,14 +18,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -35,10 +37,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -48,16 +51,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) } }) , IClaim @@ -65,154 +66,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:1}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}")) - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "n" - .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}"))))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[0, 1]" @@ -344,12 +212,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -401,10 +263,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:2}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -421,6 +283,144 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:3}"))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected index be08392aa..56b293ced 100644 --- a/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected +++ b/tests/derivation/least-effort/print/specialise/03-2 non-ty imm-deep-same givn/expected @@ -11,20 +11,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .=> local { decls = [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "[0]" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") - } - }) - , IClaim (MkIClaimData { rig = MW , vis = Export @@ -48,7 +34,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData @@ -57,60 +50,20 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { 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") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") } }) - , IDef - emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:1}") - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "n" - .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:2}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") - } - ] + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) , IDef emptyFC "[0, 1]" @@ -242,12 +195,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -299,10 +246,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:2}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -319,6 +266,59 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("n", implicitTrue) .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" } diff --git a/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected index f742f50ca..ac667e081 100644 --- a/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected +++ b/tests/derivation/least-effort/print/specialise/04-0 non-ty imm-deep-diff exist-both/expected @@ -18,10 +18,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) } }) , IClaim @@ -31,10 +39,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -44,18 +53,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -63,167 +64,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse - .=> var ">>=" - .$ ( var "the" - .$ ( var "Gen" - .$ var "MaybeEmpty" - .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) - .$ ( var "map" - .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse - .=> iCase - { sc = var "invv" - , ty = implicitFalse - , clauses = - [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" - .= var "MkDPair" - .$ var "dph^0" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") - ] - }) - .$ ( var "[1]" - .$ var "^outmost-fuel^" - .$ var "m"))) - .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse - .=> iCase - { sc = var "{lamc:1}" - , ty = implicitFalse - , clauses = - [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:1}" - .= var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:1}") - ] - }))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[1]" @@ -365,12 +220,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -422,10 +271,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:1}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -442,6 +291,157 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ ( var "[1]" + .$ var "^outmost-fuel^" + .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:2}") + ] + }))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected index 2d8b9a0e5..cb8530f3c 100644 --- a/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected +++ b/tests/derivation/least-effort/print/specialise/04-1 non-ty imm-deep-diff exist-givn/expected @@ -11,20 +11,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .=> local { decls = [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "[0]" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") - } - }) - , IClaim (MkIClaimData { rig = MW , vis = Export @@ -50,7 +36,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData @@ -59,78 +52,20 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { 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") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") } }) - , IDef - emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:1}") - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "m" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "the" - .$ ( var "Gen" - .$ var "MaybeEmpty" - .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) - .$ ( var "map" - .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse - .=> iCase - { sc = var "invv" - , ty = implicitFalse - , clauses = - [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" - .= var "MkDPair" - .$ var "dph^0" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") - ] - }) - .$ (var "[1]" .$ var "^outmost-fuel^" .$ var "m"))) - .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse - .=> iCase - { sc = var "{lamc:1}" - , ty = implicitFalse - , clauses = - [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" - .= var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:2}") - ] - })) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") - } - ] + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) , IDef emptyFC "[1]" @@ -272,12 +207,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -329,10 +258,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:2}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -349,6 +278,77 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "m" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ (var "[1]" .$ var "^outmost-fuel^" .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:3}") + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" } diff --git a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected index 39bd8c401..1651a59a4 100644 --- a/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected +++ b/tests/derivation/least-effort/print/specialise/04-2 non-ty imm-deep-diff exist-givn/expected @@ -19,11 +19,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -33,10 +38,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -46,16 +52,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "DerivedGen.X" .$ var "{arg:1}") } }) , IClaim @@ -63,150 +64,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:1}") - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "n" - .$ var "m")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:2}")))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[0, 1]" @@ -338,12 +210,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -395,10 +261,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:2}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -415,6 +281,140 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "m")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:3}")))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" } diff --git a/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected index 408d9cfdc..5829177a2 100644 --- a/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-3 non-ty imm-deep-diff exist-gend/expected @@ -18,14 +18,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "Builtin.DPair.DPair" .$ var "Prelude.Types.Nat" - .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) } }) , IClaim @@ -35,10 +39,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -48,18 +53,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "Builtin.DPair.DPair" .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) } }) , IClaim @@ -67,177 +68,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:1}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}")) - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse - .=> var ">>=" - .$ ( var "the" - .$ ( var "Gen" - .$ var "MaybeEmpty" - .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) - .$ ( var "map" - .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse - .=> iCase - { sc = var "invv" - , ty = implicitFalse - , clauses = - [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" - .= var "MkDPair" - .$ var "dph^0" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") - ] - }) - .$ ( var "[1]" - .$ var "^outmost-fuel^" - .$ var "m"))) - .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse - .=> iCase - { sc = var "{lamc:1}" - , ty = implicitFalse - , clauses = - [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" - .= var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ ( var "DerivedGen.MkX" - .! ("m", implicitTrue) - .! ("n", implicitTrue) - .$ var "{arg:2}")) - ] - }))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[1]" @@ -379,12 +224,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -436,10 +275,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:2}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -456,6 +295,167 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ ( var "[1]" + .$ var "^outmost-fuel^" + .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:3}")) + ] + }))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected index b3e754f7e..c33b14ea4 100644 --- a/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-4 non-ty imm-deep-diff exist-gend/expected @@ -18,14 +18,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "Builtin.DPair.DPair" .$ var "Prelude.Types.Nat" - .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) } }) , IClaim @@ -35,10 +39,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -48,18 +53,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "Builtin.DPair.DPair" .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + .$ (MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .=> var "DerivedGen.X" .$ var "{arg:1}")) } }) , IClaim @@ -67,177 +68,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:1}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}")) - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse - .=> var ">>=" - .$ ( var "the" - .$ ( var "Gen" - .$ var "MaybeEmpty" - .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) - .$ ( var "map" - .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse - .=> iCase - { sc = var "invv" - , ty = implicitFalse - , clauses = - [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" - .= var "MkDPair" - .$ var "dph^0" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") - ] - }) - .$ ( var "[1]" - .$ var "^outmost-fuel^" - .$ var "m"))) - .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse - .=> iCase - { sc = var "{lamc:1}" - , ty = implicitFalse - , clauses = - [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:2}" - .= var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ ( var "DerivedGen.MkX" - .! ("m", implicitTrue) - .! ("n", implicitTrue) - .$ var "{arg:2}")) - ] - }))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[1]" @@ -379,12 +224,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -436,10 +275,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:2}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -456,6 +295,167 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ ( var "[1]" + .$ var "^outmost-fuel^" + .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:3}")) + ] + }))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected index 327d287e5..f22357575 100644 --- a/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected +++ b/tests/derivation/least-effort/print/specialise/04-5 non-ty imm-deep-diff gend-both/expected @@ -18,18 +18,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "Builtin.DPair.DPair" .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .=> var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}"))) + .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) } }) , IClaim @@ -39,10 +39,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -52,18 +53,18 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ ( var "Builtin.DPair.DPair" .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .=> var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}"))) } }) , IClaim @@ -71,182 +72,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:1}") (var "Prelude.Types.Nat") - .=> var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}"))) - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse - .=> var ">>=" - .$ ( var "the" - .$ ( var "Gen" - .$ var "MaybeEmpty" - .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) - .$ ( var "map" - .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse - .=> iCase - { sc = var "invv" - , ty = implicitFalse - , clauses = - [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" - .= var "MkDPair" - .$ var "dph^0" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") - ] - }) - .$ ( var "[1]" - .$ var "^outmost-fuel^" - .$ var "m"))) - .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse - .=> iCase - { sc = var "{lamc:1}" - , ty = implicitFalse - , clauses = - [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" - .= var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ ( var "DerivedGen.MkX" - .! ("m", implicitTrue) - .! ("n", implicitTrue) - .$ var "{arg:3}"))) - ] - }))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:4}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) - ] - ] - , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[1]" @@ -388,12 +228,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -445,10 +279,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -465,6 +299,172 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:1}") (var "Prelude.Types.Nat") + .=> var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}"))) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ ( var "[1]" + .$ var "^outmost-fuel^" + .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:4}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:4}"))) + ] + }))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:5}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected index a43c04c78..4fb124156 100644 --- a/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected +++ b/tests/derivation/least-effort/print/specialise/04-6 non-ty imm-deep-diff givn-both/expected @@ -12,23 +12,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .=> local { decls = [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "[0, 1]" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}") - } - }) - , IClaim (MkIClaimData { rig = MW , vis = Export @@ -52,7 +35,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData @@ -61,61 +51,23 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[0, 1]" , 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") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}") } }) - , IDef - emptyFC - "[0, 1]" - [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" .$ bindVar "inter^<{arg:2}>" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ (var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}") - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" .$ bindVar "m" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "n" - .$ var "m")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:3}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0, 1] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>" .$ var "inter^<{arg:2}>") - } - ] + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) , IDef emptyFC "[0, 1]" @@ -247,12 +199,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -304,10 +250,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -324,6 +270,60 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" .$ bindVar "inter^<{arg:2}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ (var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" .$ bindVar "m" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "m")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:4}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0, 1] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>" .$ var "inter^<{arg:2}>") + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[0, 1]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" } diff --git a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected index 9ebc8ccb3..e88079136 100644 --- a/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-7 non-ty imm-deep-diff givn-gend/expected @@ -19,16 +19,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[0, 1]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}")) + .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" + .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") } }) , IClaim @@ -38,10 +38,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> 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 @@ -51,16 +52,16 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Vect^1863907217212445550.Vect^1863907217212445550" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^0" - .$ var "fv^Vect^1863907217212445550.Vect^1863907217212445550^lam^1") + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}")) } }) , IClaim @@ -68,155 +69,21 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) - , IDef - emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}")) - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "n" - .$ var "m")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:3}"))))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - 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 "{arg:4}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) - ] - ] - , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } - } - ] , IDef emptyFC "[0, 1]" @@ -348,12 +215,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -405,10 +266,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -425,6 +286,145 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:1}" .$ var "{arg:2}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "n" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "m")) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:4}"))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[0] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 "{arg:5}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "Prelude.Types.S" .$ var "{arg:5}"))) + ] + ] + , 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[0]" .$ var "^outmost-fuel^" .$ var "outer^" } diff --git a/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected index 14ba268fd..7cef7a7a5 100644 --- a/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected +++ b/tests/derivation/least-effort/print/specialise/04-8 non-ty imm-deep-diff givn-gend/expected @@ -11,25 +11,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .=> local { decls = [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "[1]" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:2}" .$ var "{arg:1}")) - } - }) - , IClaim (MkIClaimData { rig = MW , vis = Export @@ -55,7 +36,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData @@ -64,83 +52,25 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[1]" , 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") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:2}" .$ var "{arg:1}")) } }) - , IDef - emptyFC - "[1]" - [ var "[1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "Builtin.DPair.DPair" - .$ var "Prelude.Types.Nat" - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") - .=> var "DerivedGen.X" .$ var "{arg:2}" .$ var "{arg:1}")) - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "m" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "the" - .$ ( var "Gen" - .$ var "MaybeEmpty" - .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) - .$ ( var "map" - .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse - .=> iCase - { sc = var "invv" - , ty = implicitFalse - , clauses = - [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" - .= var "MkDPair" - .$ var "dph^0" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") - ] - }) - .$ (var "[1]" .$ var "^outmost-fuel^" .$ var "m"))) - .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse - .=> iCase - { sc = var "{lamc:1}" - , ty = implicitFalse - , clauses = - [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:3}" - .= var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "Builtin.DPair.MkDPair" - .$ implicitTrue - .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:3}")) - ] - })) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[1] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") - } - ] + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) , IDef emptyFC "[1]" @@ -282,12 +212,6 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: } } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0]" @@ -339,10 +263,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -359,6 +283,82 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ var "Nil"))) } ] + , IDef + emptyFC + "[1]" + [ var "[1]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ var "Prelude.Types.Nat" + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "Prelude.Types.Nat") + .=> var "DerivedGen.X" .$ var "{arg:2}" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "m" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ (var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv" + .= var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP" .$ var "inv") + ] + }) + .$ (var "[1]" .$ var "^outmost-fuel^" .$ var "m"))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "n" .$ bindVar "{arg:4}" + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ (var "DerivedGen.MkX" .! ("m", implicitTrue) .! ("n", implicitTrue) .$ var "{arg:4}")) + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[1] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[1]" .$ var "^outmost-fuel^" .$ var "outer^" } diff --git a/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected index 5ddf6390e..3c0149859 100644 --- a/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected +++ b/tests/derivation/least-effort/print/specialise/05-0 non-ty complex exist-both/expected @@ -23,23 +23,20 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "[]" + { name = "[0, 1, 2, 3]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") } }) , IClaim @@ -68,20 +65,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1, 2, 3]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") + .-> 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 @@ -89,7 +77,15 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 "m") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Nat.LTE" .$ var "n" .$ var "m") + } }) , IClaim (MkIClaimData @@ -98,12 +94,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0, 1]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "n") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "m") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ (var "Data.Nat.LTE" .$ var "n" .$ var "m") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -113,81 +107,28 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + }) , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" - } - }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse - .=> var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^6814960928365568963.mToP") - .$ ( var "[0, 1, 2, 3]" - .$ var "^outmost-fuel^" - .$ (var "Prelude.Types.S" .$ var "n") - .$ var "m" - .$ (var "Prelude.Types.S" .$ var "m") - .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{conArg:1}") implicitFalse - .=> var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "n" - .$ var "n")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "DerivedGen.MkX" - .! ("m", implicitTrue) - .! ("n", implicitTrue) - .$ var "{arg:1}" - .@ var "{conArg:1}")))))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[0, 1, 2, 3]" + [ var "[0, 1, 2, 3]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -197,10 +138,20 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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" + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") } }) , IClaim @@ -210,56 +161,106 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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" + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" .= 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") + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^0" + .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^0", implicitTrue) + .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^1", implicitTrue) + .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + ) + .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" + , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" + ) + .$ var "x"))) ] , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^1 (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" + .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:2}"))) + .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^1" + .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" + ) + .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" + ) + .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^2", implicitTrue) + .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^3", implicitTrue) + .$ var "x"))) ] ] , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Either^6814960928365568963.Either^6814960928365568963[0(fv^Either^6814960928365568963.Either^6814960928365568963^lam^0), 1(fv^Either^6814960928365568963.Either^6814960928365568963^lam^1), 2(fv^Either^6814960928365568963.Either^6814960928365568963^lam^2), 3(fv^Either^6814960928365568963.Either^6814960928365568963^lam^3)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^" + .$ var "inter^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^" + .$ var "inter^" + .$ var "inter^") + .$ var "Nil"))) } ] , IDef @@ -392,16 +393,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] } } - ] - , IDef - emptyFC - "[0, 1, 2, 3]" - [ var "[0, 1, 2, 3]" - .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" - .$ bindVar "inter^" - .$ bindVar "inter^" - .$ bindVar "inter^" + ] + , IDef + emptyFC + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .= local { decls = [ IClaim @@ -411,20 +407,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") + .-> 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 @@ -434,114 +421,50 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2") (var "Prelude.Types.Nat") - .-> MkArg MW ExplicitArg (Just "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") + .-> 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^" - .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" - .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" - .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" - .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^0 (orders)")) - .$ ( var ">>=" - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^0" - .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^0", implicitTrue) - .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^1", implicitTrue) - .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" - , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" - ) - .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" - , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" - ) - .$ var "x"))) + .$ (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^" - .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" - .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" - .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" - .$ bindVar "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" - .$ ( var "[0, 1]" - .$ var "^outmost-fuel^" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^2" - .$ var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^3") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "DerivedGen.Either^6814960928365568963.Either^6814960928365568963^Con^1" - .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" - , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^0" - ) - .! ( "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" - , var "fv^Either^6814960928365568963.Either^6814960928365568963^lam^1" - ) - .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^2", implicitTrue) - .! ("fv^Either^6814960928365568963.Either^6814960928365568963^lam^3", implicitTrue) - .$ var "x"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:1}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal - (Str - "DerivedGen.Either^6814960928365568963.Either^6814960928365568963[0(fv^Either^6814960928365568963.Either^6814960928365568963^lam^0), 1(fv^Either^6814960928365568963.Either^6814960928365568963^lam^1), 2(fv^Either^6814960928365568963.Either^6814960928365568963^lam^2), 3(fv^Either^6814960928365568963.Either^6814960928365568963^lam^3)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^" - .$ var "inter^" - .$ var "inter^") + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^" - .$ var "inter^" - .$ var "inter^" - .$ var "inter^") + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) .$ var "Nil"))) } ] - , IDef - emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] , IDef emptyFC "[0, 1]" @@ -604,10 +527,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ (var "fromString" .$ primVal (Str "Data.Nat.LTESucc (orders)")) .$ ( var ">>=" .$ (var "[0, 1]" .$ var "^cons_fuel^" .$ var "left" .$ var "right") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Nat.LTESucc" .! ("right", implicitTrue) .! ("left", implicitTrue) .$ var "{arg:3}"))) + .$ (var "Data.Nat.LTESucc" .! ("right", implicitTrue) .! ("left", implicitTrue) .$ var "{arg:2}"))) , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" ] ] @@ -628,8 +551,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -639,11 +562,74 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "n") implicitFalse + .=> var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "m") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^6814960928365568963.mToP") + .$ ( var "[0, 1, 2, 3]" + .$ var "^outmost-fuel^" + .$ (var "Prelude.Types.S" .$ var "n") + .$ var "m" + .$ (var "Prelude.Types.S" .$ var "m") + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{conArg:1}") implicitFalse + .=> var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^1863907217212445550.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "n" + .$ var "n")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.MkX" + .! ("m", implicitTrue) + .! ("n", implicitTrue) + .$ var "{arg:3}" + .@ var "{conArg:1}")))))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + 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 @@ -653,50 +639,64 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= 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" + .$ (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 "Prelude.Types.S" .$ bindVar "k") + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) .$ ( var ">>=" - .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") + .$ (var "[]" .$ var "^cons_fuel^") .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:4}"))) - , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.frequency" - .$ ( var "::" - .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) - .$ ( var "::" - .$ ( var "Builtin.MkPair" - .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) - .$ var "Nil"))) + 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } } ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected index 03b2d074b..220e438e6 100644 --- a/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected +++ b/tests/derivation/least-effort/print/specialise/06-0 ty shallow/expected @@ -21,10 +21,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) , IClaim @@ -49,10 +51,10 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -77,18 +79,16 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -98,32 +98,68 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^4289176107705670177.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) } ] , IDef @@ -207,8 +243,8 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -218,73 +254,32 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = 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 - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" + { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , 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 "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^4289176107705670177.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:2}"))) + .$ (var "DerivedGen.MkX" .$ var "{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 "Prelude.Types.Nat[] (dry fuel)")) - .$ (var "<>" .$ var "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") } ] , IDef @@ -318,10 +313,10 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit .$ ( var "map" .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0" .$ var "{arg:3}"))) + .$ (var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0" .$ var "{arg:2}"))) ] ] , scope = @@ -332,8 +327,8 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -343,12 +338,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .$ var "Prelude.Types.Nat" } }) , IClaim @@ -358,53 +353,58 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + .$ (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 "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) + .$ (var "Prelude.Types.S" .$ var "{arg:3}"))) ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ var "Nil"))) + 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } } ] ] diff --git a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected index eb2823a65..4155ded63 100644 --- a/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected +++ b/tests/derivation/least-effort/print/specialise/06-1 ty deeper/expected @@ -32,10 +32,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" + .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") } }) , IClaim @@ -62,10 +66,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" + .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" + .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") } }) , IClaim @@ -91,14 +99,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[0]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" - .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") + .-> 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 @@ -108,14 +113,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "[0]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" - .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -123,26 +124,27 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: { rig = MW , vis = Export , opts = [] - , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} + , type = + 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 (MkIClaimData { rig = MW , vis = Export , opts = [] - , type = - 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") - } + , type = mkTy {name = "weight^Prelude.Types.Nat", type = MkArg MW ExplicitArg Nothing (var "Prelude.Types.Nat") .-> var "Data.Nat1.Nat1"} }) , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[0]" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -152,37 +154,87 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" + .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" + .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^17089122808763292221.mToP") - .$ ( var "[0]" - .$ var "^outmost-fuel^" - .$ ( var "Prelude.Types.S" - .$ ( var "Prelude.Types.S" - .$ ( var "Prelude.Types.S" - .$ (var "Prelude.Types.S" .$ (var "Prelude.Types.S" .$ var "Prelude.Types.Z"))))))) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0" + .! ("fv^Either^13748098436294604892.Either^13748098436294604892^lam^0", implicitTrue) + .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:2}"))) + .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1" + .$ var "x" + .! ( "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" + , var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" + )))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^Either^13748098436294604892.Either^13748098436294604892^lam^0)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ var "Nil"))) } ] , IDef @@ -289,8 +341,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[0]" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" .= local { decls = [ IClaim @@ -300,10 +354,14 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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" + .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" + .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") } }) , IClaim @@ -313,56 +371,74 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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" + .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" + .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" .= 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") + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0" + .$ var "x" + .! ( "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" + , var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" + )))) ] , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1 (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^13748098436294604892.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:3}"))) + .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1" + .! ("fv^Either^5595291053177582713.Either^5595291053177582713^lam^0", implicitTrue) + .$ var "x"))) ] ] , 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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } + var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^Either^5595291053177582713.Either^5595291053177582713^lam^0)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ ( var "::" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + .$ var "Nil"))) } ] , IDef @@ -404,12 +480,12 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: .$ ( var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Y^7167106520753982886.Y^7167106520753982886^lam^0")) - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ ( var "DerivedGen.Y^7167106520753982886.Y^7167106520753982886^Con^0" .! ("fv^Y^7167106520753982886.Y^7167106520753982886^lam^0", implicitTrue) - .$ var "{arg:4}"))) + .$ var "{arg:2}"))) ] ] , scope = @@ -425,10 +501,8 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: ] , IDef emptyFC - "[0]" - [ var "[0]" - .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" + "[0]" + [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .= local { decls = [ IClaim @@ -438,14 +512,11 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" - .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") + .-> 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 @@ -455,82 +526,54 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713" - .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0") + .-> 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^" - .$ bindVar "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0 (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^0" - .$ var "x" - .! ( "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" - , var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" - )))) + .$ (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^" - .$ bindVar "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^13748098436294604892.mToP") - .$ ( var "[0]" - .$ var "^outmost-fuel^" - .$ var "fv^Either^5595291053177582713.Either^5595291053177582713^lam^0")) - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "DerivedGen.Either^5595291053177582713.Either^5595291053177582713^Con^1" - .! ("fv^Either^5595291053177582713.Either^5595291053177582713^lam^0", implicitTrue) - .$ var "x"))) + .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:3}"))) + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal - (Str - "DerivedGen.Either^5595291053177582713.Either^5595291053177582713[0(fv^Either^5595291053177582713.Either^5595291053177582713^lam^0)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") + .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^") + .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^") + .$ ( var "Builtin.MkPair" + .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) .$ var "Nil"))) } ] , IDef emptyFC - "[0]" - [ var "[0]" - .$ bindVar "^fuel_arg^" - .$ bindVar "inter^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -540,99 +583,42 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" - .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") - } - }) - , IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> MkArg MW ExplicitArg (Just "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") (var "Prelude.Types.Nat") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892" - .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IDef emptyFC - "<>" - [ var "<>" - .$ bindVar "^cons_fuel^" - .$ bindVar "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0 (orders)")) - .$ ( var ">>=" - .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^0" - .! ("fv^Either^13748098436294604892.Either^13748098436294604892^lam^0", implicitTrue) - .$ var "x"))) - ] - , IDef - emptyFC - "<>" - [ var "<>" - .$ bindVar "^cons_fuel^" - .$ bindVar "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" - .$ (var "external^<^prim^.String>[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^17089122808763292221.mToP") + .$ ( var "[0]" + .$ var "^outmost-fuel^" + .$ ( var "Prelude.Types.S" + .$ ( var "Prelude.Types.S" + .$ (var "Prelude.Types.S" .$ (var "Prelude.Types.S" .$ (var "Prelude.Types.S" .$ var "Prelude.Types.Z"))))))) + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ ( var "DerivedGen.Either^13748098436294604892.Either^13748098436294604892^Con^1" - .$ var "x" - .! ( "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" - , var "fv^Either^13748098436294604892.Either^13748098436294604892^lam^0" - )))) + .$ (var "DerivedGen.MkX" .$ var "{arg:4}"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal - (Str - "DerivedGen.Either^13748098436294604892.Either^13748098436294604892[0(fv^Either^13748098436294604892.Either^13748098436294604892^lam^0)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^") - .$ ( var "::" - .$ ( var "<>" - .$ var "^fuel_arg^" - .$ var "inter^") - .$ var "Nil"))) + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") } ] , IDef emptyFC - "weight^Prelude.Types.Nat" - [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" - , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") - ] - , IDef - emptyFC - "[0]" - [ var "[0]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -642,11 +628,10 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IClaim @@ -656,50 +641,64 @@ LOG deptycheck.derive.least-effort:7: Data.Fin.Fin[0(n)] FS - used final order: , opts = [] , type = mkTy - { name = "<>" + { 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") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" .$ (var "Prelude.Types.S" .$ bindVar "k") + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= 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" + .$ (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 "Prelude.Types.S" .$ bindVar "k") + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Data.Fin.FS (orders)")) + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) .$ ( var ">>=" - .$ (var "[0]" .$ var "^cons_fuel^" .$ var "k") + .$ (var "[]" .$ var "^cons_fuel^") .$ ( MkArg MW ExplicitArg (Just "{arg:5}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Data.Fin.FS" .! ("k", implicitTrue) .$ var "{arg:5}"))) - , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + .$ (var "Prelude.Types.S" .$ var "{arg:5}"))) ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Data.Fin.Fin[0(n)] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.frequency" - .$ ( var "::" - .$ (var "Builtin.MkPair" .$ var "Data.Nat1.one" .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) - .$ ( var "::" - .$ ( var "Builtin.MkPair" - .$ (var "weight^Prelude.Types.Nat" .$ var "inter^") - .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^")) - .$ var "Nil"))) + 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } } ] + , IDef + emptyFC + "weight^Prelude.Types.Nat" + [ var "weight^Prelude.Types.Nat" .$ var "Prelude.Types.Z" .= var "Data.Nat1.one" + , var "weight^Prelude.Types.Nat" .$ (var "Prelude.Types.S" .$ bindVar "arg^0") .= var "succ" .$ (var "weight^Prelude.Types.Nat" .$ var "arg^0") + ] ] , scope = var "[]" .$ var "^outmost-fuel^" } diff --git a/tests/derivation/least-effort/print/specialise/06-2 ty deep/expected b/tests/derivation/least-effort/print/specialise/06-2 ty deep/expected index da2f59fa1..f7d2d235b 100644 --- a/tests/derivation/least-effort/print/specialise/06-2 ty deep/expected +++ b/tests/derivation/least-effort/print/specialise/06-2 ty deep/expected @@ -23,10 +23,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) , IClaim @@ -36,12 +38,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" + .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" } }) , IClaim @@ -51,12 +53,10 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -66,10 +66,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { 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" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" } }) , IClaim @@ -94,18 +96,16 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -115,75 +115,68 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Y^11712255676025100806.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim + , IClaim (MkIClaimData { rig = MW , vis = Export , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0 (orders)")) + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^8529713418737914198.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0" .$ var "{arg:2}"))) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) } ] , IDef @@ -267,8 +260,8 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -278,73 +271,75 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) - , IClaim + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Y^11712255676025100806.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim (MkIClaimData { rig = MW , vis = Export , opts = [] , type = mkTy - { name = "<>" + { 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" + .$ var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806" } }) , 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 "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0 (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^8529713418737914198.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:3}"))) + .$ (var "DerivedGen.Y^11712255676025100806.Y^11712255676025100806^Con^0" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^11712255676025100806.Y^11712255676025100806[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") } ] , IDef @@ -378,10 +373,10 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit .$ ( var "map" .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:4}"))) + .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:3}"))) ] ] , scope = @@ -392,8 +387,8 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -403,12 +398,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .$ var "Prelude.Types.Nat" } }) , IClaim @@ -418,53 +413,58 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + .$ (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 "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ var "Nil"))) + 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } } ] ] diff --git a/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/expected b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/expected index 3dc6d985b..e134c780e 100644 --- a/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/expected +++ b/tests/derivation/least-effort/print/specialise/06-3 ty deep hkd/expected @@ -23,10 +23,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) , IClaim @@ -36,12 +38,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" + .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" } }) , IClaim @@ -51,12 +53,10 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^8529713418737914198.Either^8529713418737914198" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -66,10 +66,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { 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" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" } }) , IClaim @@ -94,18 +96,16 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -115,75 +115,68 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Y^6741950274054397085.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim + , IClaim (MkIClaimData { rig = MW , vis = Export , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0 (orders)")) + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^8529713418737914198.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0" .$ var "{arg:2}"))) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) } ] , IDef @@ -267,8 +260,8 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -278,73 +271,75 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { 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" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) - , IClaim + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Y^6741950274054397085.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim (MkIClaimData { rig = MW , vis = Export , opts = [] , type = mkTy - { name = "<>" + { 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" + .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" } }) , 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 "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0 (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^cons_fuel^") - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^8529713418737914198.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "Prelude.Types.S" .$ var "{arg:3}"))) + .$ (var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0" .$ var "{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 "^fuel_arg^") - , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") - .$ (var "<>" .$ var "^sub^fuel_arg^")) - .$ var "Nil"))) - ] - } + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") } ] , IDef @@ -378,10 +373,10 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit .$ ( var "map" .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:4}"))) + .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:3}"))) ] ] , scope = @@ -392,8 +387,8 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -403,12 +398,12 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .$ var "Prelude.Types.Nat" } }) , IClaim @@ -418,53 +413,58 @@ LOG deptycheck.derive.least-effort:7: DerivedGen.Either^13682636983817606971.Eit , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .$ var "Prelude.Types.Nat" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + .$ (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 "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "Prelude.Types.S (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .$ (var "[]" .$ var "^cons_fuel^") + .$ ( MkArg MW ExplicitArg (Just "{arg:4}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) + .$ (var "Prelude.Types.S" .$ var "{arg:4}"))) ] ] , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ var "Nil"))) + 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 "^fuel_arg^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Types.Nat[] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ (var "<>" .$ var "^sub^fuel_arg^")) + .$ var "Nil"))) + ] + } } ] ] diff --git a/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/expected b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/expected index 712779e3f..e7bf6e3df 100644 --- a/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/expected +++ b/tests/derivation/least-effort/print/specialise/06-4 ty deep hkd/expected @@ -28,10 +28,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) , IClaim @@ -41,12 +43,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" + .$ var "DerivedGen.Either^70731854558853028.Either^70731854558853028" } }) , IClaim @@ -56,12 +58,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^70731854558853028.Either^70731854558853028" + .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" } }) , IClaim @@ -71,12 +73,10 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IClaim @@ -86,12 +86,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" + .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" } }) , IClaim @@ -101,12 +101,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .$ var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768" } }) , IClaim @@ -116,12 +116,12 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "[]" + { name = "[]" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" + .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" } }) , IClaim @@ -139,8 +139,8 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: }) , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -150,75 +150,68 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) - .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Y^6741950274054397085.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) - ] - ] - , scope = - var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") - } - ] - , IDef - emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" - .= local - { decls = - [ IClaim + , IClaim (MkIClaimData { rig = MW , vis = Export , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" + .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0 (orders)")) + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) .$ ( var ">>=" - .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^70731854558853028.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0" .$ var "{arg:2}"))) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) } ] , IDef @@ -302,8 +295,8 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -313,40 +306,76 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768" + .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^15549736185298716768.Z^15549736185298716768^Con^0 (orders)")) + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^0 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^0" .$ var "x"))) + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^1 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^9277747372264086100.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ (var "cast" .@ var "DerivedGen.Z^4772972569107533783.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768^Con^0" .$ var "{arg:3}"))) + .$ (var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^1" .$ var "x"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^15549736185298716768.Z^15549736185298716768[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") + .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) } ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -356,40 +385,38 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.X" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.MkX (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .$ (var "cast" .@ var "DerivedGen.Y^6741950274054397085.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:3}"))) + .$ (var "DerivedGen.MkX" .$ var "{arg:1}"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783[] (non-spending)")) - .$ (var "<>" .$ var "^fuel_arg^") + .$ (var "fromString" .$ primVal (Str "DerivedGen.X[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") } ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -399,74 +426,40 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "<>" - , type = - MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") - .-> var "Test.DepTyCheck.Gen.Gen" - .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" - } - }) - , IClaim - (MkIClaimData - { rig = MW - , vis = Export - , opts = [] - , type = - mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971" + .$ var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0 (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^0" .$ var "x"))) - ] - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0 (orders)")) .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^70731854558853028.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^13682636983817606971.Either^13682636983817606971^Con^1" .$ var "x"))) + .$ (var "DerivedGen.Y^6741950274054397085.Y^6741950274054397085^Con^0" .$ var "{arg:2}"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^13682636983817606971.Either^13682636983817606971[] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ var "Nil"))) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Y^6741950274054397085.Y^6741950274054397085[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") } ] , IDef emptyFC - "[]" - [ var "[]" .$ bindVar "^fuel_arg^" + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" .= local { decls = [ IClaim @@ -476,70 +469,77 @@ LOG deptycheck.derive.least-effort:7: Prelude.Types.Nat[] S - used final order: , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" + .$ var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768" } }) - , IClaim + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^15549736185298716768.Z^15549736185298716768^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Either^9277747372264086100.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Z^15549736185298716768.Z^15549736185298716768^Con^0" .$ var "{arg:3}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^15549736185298716768.Z^15549736185298716768[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim (MkIClaimData { rig = MW , vis = Export , opts = [] , type = mkTy - { name = "<>" + { name = "<>" , type = MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" - .$ var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100" + .$ var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783" } }) , IDef emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" - .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^0 (orders)")) - .$ ( var ">>=" - .$ (var "[]" .$ var "^outmost-fuel^") - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse - .=> var "Prelude.pure" - .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^0" .$ var "x"))) - ] - , IDef - emptyFC - "<>" - [ var "<>" .$ bindVar "^cons_fuel^" + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .= var "Test.DepTyCheck.Gen.label" - .$ ( var "fromString" - .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^1 (orders)")) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0 (orders)")) .$ ( var ">>=" .$ ( var "map" - .$ (var "cast" .@ var "DerivedGen.Z^4772972569107533783.mToP") - .$ (var "[]" .$ var "^outmost-fuel^")) - .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .$ (var "cast" .@ var "DerivedGen.Either^13682636983817606971.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "{arg:3}") implicitFalse .=> var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) - .$ (var "DerivedGen.Either^9277747372264086100.Either^9277747372264086100^Con^1" .$ var "x"))) + .$ (var "DerivedGen.Z^4772972569107533783.Z^4772972569107533783^Con^0" .$ var "{arg:3}"))) ] ] , scope = var "Test.DepTyCheck.Gen.label" - .$ (var "fromString" .$ primVal (Str "DerivedGen.Either^9277747372264086100.Either^9277747372264086100[] (non-spending)")) - .$ ( var "Test.DepTyCheck.Gen.oneOf" - .! ("em", var "MaybeEmpty") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ ( var "::" - .$ (var "<>" .$ var "^fuel_arg^") - .$ var "Nil"))) + .$ (var "fromString" .$ primVal (Str "DerivedGen.Z^4772972569107533783.Z^4772972569107533783[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") } ] , IDef diff --git a/tests/derivation/least-effort/print/specialise/07-0 list-lookup/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/07-0 list-lookup/DerivedGen.idr new file mode 100644 index 000000000..9ba0c9359 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/07-0 list-lookup/DerivedGen.idr @@ -0,0 +1,18 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +%default total + +%language ElabReflection + + +public export +data Lookup : a -> List (a, b) -> Type where + Here : (y : b) -> Lookup x $ (x, y)::xys + There : Lookup z xys -> Lookup z $ (x, y)::xys + +data UseLookup : Type where + UL : Lookup True [(True, True, True, True)] -> UseLookup + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> Gen MaybeEmpty UseLookup diff --git a/tests/derivation/least-effort/print/specialise/07-0 list-lookup/derive.ipkg b/tests/derivation/least-effort/print/specialise/07-0 list-lookup/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/07-0 list-lookup/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/07-0 list-lookup/expected b/tests/derivation/least-effort/print/specialise/07-0 list-lookup/expected new file mode 100644 index 000000000..61e05e618 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/07-0 list-lookup/expected @@ -0,0 +1,364 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> Gen MaybeEmpty UseLookup +LOG deptycheck.derive.least-effort:7: DerivedGen.UseLookup[] UL - used final order: [#0] +LOG deptycheck.util.specialisation:10: DerivedGen.Lookup[0(b), 1(a), 2, 3] Declared specialised type DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048: DerivedGen.Lookup {b = Builtin.Pair Prelude.Basics.Bool (Builtin.Pair Prelude.Basics.Bool Prelude.Basics.Bool)} {a = Prelude.Basics.Bool} lam^0 lam^1 +LOG deptycheck.derive.least-effort:7: DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048[0(fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0), 1(fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1)] Lookup^7730538649293255048^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048[0(fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0), 1(fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1)] Lookup^7730538649293255048^Con^1 - used final order: [#4] + MkArg MW ExplicitArg (Just "^outmost-fuel^") (var "Data.Fuel.Fuel") +.=> local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 1]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0") (var "Prelude.Basics.Bool") + .-> MkArg + MW + ExplicitArg + (Just "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1") + ( var "Prelude.Basics.List" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")))) + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048" + .$ var "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0" + .$ var "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.UseLookup" + } + }) + , IDef + emptyFC + "[0, 1]" + [ var "[0, 1]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0") (var "Prelude.Basics.Bool") + .-> MkArg + MW + ExplicitArg + (Just "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1") + ( var "Prelude.Basics.List" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")))) + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048" + .$ var "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0" + .$ var "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0") (var "Prelude.Basics.Bool") + .-> MkArg + MW + ExplicitArg + (Just "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1") + ( var "Prelude.Basics.List" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")))) + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048" + .$ var "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0" + .$ var "fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1") + } + }) + , IDef + emptyFC + "<>" + [ withClause + { lhs = + var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "x" + .$ ( var "Prelude.Basics.(::)" + .! ( "a" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")) + ) + .$ ( var "Builtin.MkPair" + .! ("a", var "Prelude.Basics.Bool") + .! ( "b" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool") + ) + .$ bindVar "to_be_deceqed^^x0" + .$ bindVar "y") + .$ bindVar "xys") + , rig = MW + , wval = var "Decidable.Equality.decEq" .$ var "to_be_deceqed^^x0" .$ var "x" + , prf = Nothing + , flags = [] + , clauses = + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "x" + .$ ( var "Prelude.Basics.(::)" + .! ( "a" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")) + ) + .$ ( var "Builtin.MkPair" + .! ("a", var "Prelude.Basics.Bool") + .! ( "b" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool") + ) + .$ bindVar "x" + .$ bindVar "y") + .$ bindVar "xys") + .$ (var "Prelude.Yes" .$ var "Builtin.Refl") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048^Con^0" + .! ("x", var "x") + .! ("xys", var "xys") + .$ var "y")) + , var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "x" + .$ ( var "Prelude.Basics.(::)" + .! ( "a" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")) + ) + .$ ( var "Builtin.MkPair" + .! ("a", var "Prelude.Basics.Bool") + .! ( "b" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool") + ) + .$ bindVar "to_be_deceqed^^x0" + .$ bindVar "y") + .$ bindVar "xys") + .$ (var "Prelude.No" .$ implicitTrue) + .= var "empty" + ] + } + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ bindVar "z" + .$ ( var "Prelude.Basics.(::)" + .! ( "a" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")) + ) + .$ ( var "Builtin.MkPair" + .! ("a", var "Prelude.Basics.Bool") + .! ( "b" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool") + ) + .$ bindVar "x" + .$ bindVar "y") + .$ bindVar "xys") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[0, 1]" .$ var "^cons_fuel^" .$ var "z" .$ var "xys") + .$ ( MkArg MW ExplicitArg (Just "{arg:1}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048^Con^1" + .! ("x", var "x") + .! ("y", var "y") + .! ("z", implicitTrue) + .! ("xys", implicitTrue) + .$ var "{arg:1}"))) + , 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.Lookup^7730538649293255048.Lookup^7730538649293255048[0(fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0), 1(fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Lookup^7730538649293255048.Lookup^7730538649293255048[0(fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^0), 1(fv^Lookup^7730538649293255048.Lookup^7730538649293255048^lam^1)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "DerivedGen.UseLookup" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.UL (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Lookup^7730538649293255048.mToP") + .$ ( var "[0, 1]" + .$ var "^outmost-fuel^" + .$ var "Prelude.Basics.True" + .$ ( var "Prelude.Basics.(::)" + .! ( "a" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")) + ) + .$ ( var "Builtin.MkPair" + .! ("a", var "Prelude.Basics.Bool") + .! ( "b" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool") + ) + .$ var "Prelude.Basics.True" + .$ ( var "Builtin.MkPair" + .! ("a", var "Prelude.Basics.Bool") + .! ("b", var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool") + .$ var "Prelude.Basics.True" + .$ ( var "Builtin.MkPair" + .! ("a", var "Prelude.Basics.Bool") + .! ("b", var "Prelude.Basics.Bool") + .$ var "Prelude.Basics.True" + .$ var "Prelude.Basics.True"))) + .$ ( var "Prelude.Basics.Nil" + .! ( "a" + , var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ ( var "Builtin.Pair" + .$ var "Prelude.Basics.Bool" + .$ (var "Builtin.Pair" .$ var "Prelude.Basics.Bool" .$ var "Prelude.Basics.Bool")) + ))))) + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.UL" .$ var "{arg:2}"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.UseLookup[] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^") + } + ] + ] + , scope = var "[]" .$ var "^outmost-fuel^" + } + diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/run b/tests/derivation/least-effort/print/specialise/07-0 list-lookup/run similarity index 100% rename from tests/derivation/utils/specialise-if-needed/spec-if-needed-005/run rename to tests/derivation/least-effort/print/specialise/07-0 list-lookup/run diff --git a/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr b/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr new file mode 100644 index 000000000..4b1ef30d7 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr @@ -0,0 +1,33 @@ +module DerivedGen + +import Deriving.DepTyCheck.Gen + +import public Data.Fin +import Data.Fuel +import Data.String +import Data.Vect +import public Data.Vect.AtIndex + +import Decidable.Equality + +import Deriving.DepTyCheck.Gen + +%language ElabReflection + +%default total + +%language ElabReflection + +public export +Regs : Nat -> Type +Regs n = Vect n $ Maybe Bool + +public export +RegIsType : Fin r -> Bool -> Regs r -> Type +RegIsType fn t rs = AtIndex fn rs (Just t) + +public export +data SimpleExpr : Regs r -> Bool -> Type where + Read : (idx : Fin r) -> RegIsType idx t regs => SimpleExpr regs t + +%runElab deriveGenPrinter @{MainCoreDerivator @{LeastEffort}} $ Fuel -> (r : Nat) -> (t : Bool) -> Gen MaybeEmpty (a : Regs r ** SimpleExpr a t) diff --git a/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/derive.ipkg b/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/derive.ipkg new file mode 120000 index 000000000..ff0da46fe --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/derive.ipkg @@ -0,0 +1 @@ +../_common/derive.ipkg \ No newline at end of file diff --git a/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/expected b/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/expected new file mode 100644 index 000000000..7f2a3901b --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/expected @@ -0,0 +1,674 @@ +1/1: Building DerivedGen (DerivedGen.idr) +LOG deptycheck.derive.print:5: type: (arg : Fuel) -> (r : Nat) -> (t : Bool) -> Gen MaybeEmpty (a : Regs r ** SimpleExpr a t) +LOG deptycheck.derive.least-effort:7: DerivedGen.SimpleExpr[0(r), 2] Read - used final order: [#4] +LOG deptycheck.util.specialisation:10: Data.Vect.AtIndex.AtIndex[0(type), 1(n), 4(x)] Declared specialised type DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525: Data.Vect.AtIndex.AtIndex {type = Prelude.Types.Maybe Prelude.Basics.Bool} {n = lam^0} lam^1 lam^2 lam^3 +LOG deptycheck.derive.least-effort:7: DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525[0(fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0), 3(fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3)] AtIndex^2737362274073714525^Con^0 - used final order: [#2 (xs)] +LOG deptycheck.util.specialisation:10: Data.Vect.Vect[0(len), 1(elem)] Declared specialised type DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186: Data.Vect.Vect lam^0 (Prelude.Types.Maybe Prelude.Basics.Bool) +LOG deptycheck.derive.least-effort:7: DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525[0(fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0), 3(fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3)] AtIndex^2737362274073714525^Con^1 - used final order: [#5 (later), #1 (y)] +LOG deptycheck.util.specialisation:10: Prelude.Types.Maybe[0(ty)] Declared specialised type DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926: Prelude.Types.Maybe Prelude.Basics.Bool +LOG deptycheck.derive.least-effort:7: DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926[] Maybe^2151327891283438926^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926[] Maybe^2151327891283438926^Con^1 - used final order: [#0 (x)] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186[0(fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0)] Vect^15780912604163783186^Con^0 - used final order: [] +LOG deptycheck.derive.least-effort:7: DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186[0(fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0)] Vect^15780912604163783186^Con^1 - used final order: [#1 (x), #2 (xs)] +LOG deptycheck.derive.least-effort:7: Prelude.Basics.Bool[] False - used final order: [] +LOG deptycheck.derive.least-effort:7: Prelude.Basics.Bool[] True - used final order: [] + 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 + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 3]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") (var "Prelude.Types.Nat") + .-> MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3") + (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") + .$ ( MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^1") + (var "Data.Fin.Fin" .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") + .=> var "Builtin.DPair.DPair" + .$ ( var "Data.Vect.Vect" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + .$ (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool")) + .$ ( MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^2") + ( var "Data.Vect.Vect" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + .$ (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool")) + .=> var "DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525" + .! ( "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + , var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + ) + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^1" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^2" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3"))) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186" + .$ var "fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[0, 2]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "r") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Basics.Bool") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "DerivedGen.Regs" .$ var "r") + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "DerivedGen.Regs" .$ var "r") + .=> var "DerivedGen.SimpleExpr" .! ("r", var "r") .$ var "{arg:2}" .$ var "{arg:1}")) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "[]" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Basics.Bool" + } + }) + , IDef + emptyFC + "[0, 3]" + [ var "[0, 3]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") (var "Prelude.Types.Nat") + .-> MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3") + (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") + .$ ( MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^1") + (var "Data.Fin.Fin" .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") + .=> var "Builtin.DPair.DPair" + .$ ( var "Data.Vect.Vect" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + .$ (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool")) + .$ ( MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^2") + ( var "Data.Vect.Vect" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + .$ (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool")) + .=> var "DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525" + .! ( "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + , var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + ) + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^1" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^2" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3"))) + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") (var "Prelude.Types.Nat") + .-> MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3") + (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "Data.Fin.Fin" .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") + .$ ( MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^1") + (var "Data.Fin.Fin" .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0") + .=> var "Builtin.DPair.DPair" + .$ ( var "Data.Vect.Vect" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + .$ (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool")) + .$ ( MkArg + MW + ExplicitArg + (Just "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^2") + ( var "Data.Vect.Vect" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + .$ (var "Prelude.Types.Maybe" .$ var "Prelude.Basics.Bool")) + .=> var "DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525" + .! ( "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + , var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0" + ) + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^1" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^2" + .$ var "fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3"))) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "{len:1}") + .$ bindVar "x" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525^Con^0 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Vect^15780912604163783186.mToP") + .$ (var "[0]" .$ var "^outmost-fuel^" .$ var "{len:1}")) + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525^Con^0" + .! ("{len:1}", implicitTrue) + .! ("x", var "x") + .! ("xs", var "xs")))))) + , var "<>" .$ implicitTrue .$ implicitTrue .$ implicitTrue + .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "{n:1}") + .$ bindVar "x" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[0, 3]" .$ var "^cons_fuel^" .$ var "{n:1}" .$ var "x") + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" .$ bindVar "rest" .$ (var "Builtin.DPair.MkDPair" .$ bindVar "xs" .$ bindVar "later") + .= var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Maybe^2151327891283438926.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "y") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525^Con^1" + .! ("{n:1}", implicitTrue) + .! ("y", var "y") + .! ("x", implicitTrue) + .! ("xs", implicitTrue) + .! ("rest", implicitTrue) + .$ var "later")))) + ] + })) + , 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.AtIndex^2737362274073714525.AtIndex^2737362274073714525[0(fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0), 3(fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.AtIndex^2737362274073714525.AtIndex^2737362274073714525[0(fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^0), 3(fv^AtIndex^2737362274073714525.AtIndex^2737362274073714525^lam^3)] (non-dry fuel)")) + .$ ( var "Test.DepTyCheck.Gen.frequency" + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ var "Data.Nat1.one" + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ ( var "::" + .$ ( var "Builtin.MkPair" + .$ (var "Deriving.DepTyCheck.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[0]" + [ var "[0]" + .$ bindVar "^fuel_arg^" + .$ bindVar "inter^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186" + .$ var "fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0") + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0") (var "Prelude.Types.Nat") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186" + .$ var "fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0") + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ var "Prelude.Types.Z" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186^Con^0") + , var "<>" .$ implicitTrue .$ implicitTrue .= var "empty" + ] + , IDef + emptyFC + "<>" + [ var "<>" + .$ bindVar "^cons_fuel^" + .$ (var "Prelude.Types.S" .$ bindVar "len") + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186^Con^1 (orders)")) + .$ ( var ">>=" + .$ ( var "map" + .$ (var "cast" .@ var "DerivedGen.Maybe^2151327891283438926.mToP") + .$ (var "[]" .$ var "^outmost-fuel^")) + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var ">>=" + .$ (var "[0]" .$ var "^cons_fuel^" .$ var "len") + .$ ( MkArg MW ExplicitArg (Just "xs") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186^Con^1" + .! ("len", implicitTrue) + .$ var "x" + .$ var "xs")))) + , 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 + "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186[0(fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0)] (dry fuel)")) + .$ ( var "<>" + .$ var "^fuel_arg^" + .$ var "inter^") + , var "Data.Fuel.More" .$ bindVar "^sub^fuel_arg^" + .= var "Test.DepTyCheck.Gen.label" + .$ ( var "fromString" + .$ primVal + (Str + "DerivedGen.Vect^15780912604163783186.Vect^15780912604163783186[0(fv^Vect^15780912604163783186.Vect^15780912604163783186^lam^0)] (non-dry 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.Gen.ConsRecs.leftDepth" .$ var "^sub^fuel_arg^") + .$ ( var "<>" + .$ var "^sub^fuel_arg^" + .$ var "inter^")) + .$ var "Nil"))) + ] + } + } + ] + , IDef + emptyFC + "[0, 2]" + [ var "[0, 2]" .$ bindVar "^fuel_arg^" .$ bindVar "inter^" .$ bindVar "inter^<{arg:1}>" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> MkArg MW ExplicitArg (Just "r") (var "Prelude.Types.Nat") + .-> MkArg MW ExplicitArg (Just "{arg:1}") (var "Prelude.Basics.Bool") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ ( var "Builtin.DPair.DPair" + .$ (var "DerivedGen.Regs" .$ var "r") + .$ ( MkArg MW ExplicitArg (Just "{arg:2}") (var "DerivedGen.Regs" .$ var "r") + .=> var "DerivedGen.SimpleExpr" .! ("r", var "r") .$ var "{arg:2}" .$ var "{arg:1}")) + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" .$ bindVar "r" .$ bindVar "t" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Read (orders)")) + .$ ( var ">>=" + .$ ( var "the" + .$ ( var "Gen" + .$ var "MaybeEmpty" + .$ ( var "DPair" + .$ implicitFalse + .$ ( MkArg MW ExplicitArg Nothing implicitFalse + .=> var "DPair" .$ implicitFalse .$ (MkArg MW ExplicitArg Nothing implicitFalse .=> implicitFalse)))) + .$ ( var "map" + .$ ( MkArg MW ExplicitArg (Just "invv") implicitFalse + .=> iCase + { sc = var "invv" + , ty = implicitFalse + , clauses = + [ var "MkDPair" .$ bindVar "dph^1" .$ (var "MkDPair" .$ bindVar "dph^0" .$ bindVar "inv") + .= var "MkDPair" + .$ var "dph^1" + .$ ( var "MkDPair" + .$ var "dph^0" + .$ (var "cast" .@ var "DerivedGen.AtIndex^2737362274073714525.mToP" .$ var "inv")) + ] + }) + .$ ( var "[0, 3]" + .$ var "^outmost-fuel^" + .$ var "r" + .$ (var "Prelude.Types.Just" .! ("ty", var "Prelude.Basics.Bool") .$ var "t")))) + .$ ( MkArg MW ExplicitArg (Just "{lamc:1}") implicitFalse + .=> iCase + { sc = var "{lamc:1}" + , ty = implicitFalse + , clauses = + [ var "Builtin.DPair.MkDPair" + .$ bindVar "idx" + .$ (var "Builtin.DPair.MkDPair" .$ bindVar "regs" .$ bindVar "{conArg:1}") + .= var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ ( var "Builtin.DPair.MkDPair" + .$ implicitTrue + .$ ( var "DerivedGen.Read" + .! ("r", implicitTrue) + .! ("regs", implicitTrue) + .! ("t", implicitTrue) + .$ implicitTrue + .@ var "{conArg:1}")) + ] + })) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.SimpleExpr[0(r), 2] (non-spending)")) + .$ (var "<>" .$ var "^fuel_arg^" .$ var "inter^" .$ var "inter^<{arg:1}>") + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" + .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" + .$ var "DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926^Con^0 (orders)")) + .$ ( var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ var "DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926^Con^0") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926^Con^1 (orders)")) + .$ ( var ">>=" + .$ (var "[]" .$ var "^outmost-fuel^") + .$ ( MkArg MW ExplicitArg (Just "x") implicitFalse + .=> var "Prelude.pure" + .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) + .$ (var "DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926^Con^1" .$ var "x"))) + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "DerivedGen.Maybe^2151327891283438926.Maybe^2151327891283438926[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ var "Nil"))) + } + ] + , IDef + emptyFC + "[]" + [ var "[]" .$ bindVar "^fuel_arg^" + .= local + { decls = + [ IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Basics.Bool" + } + }) + , IClaim + (MkIClaimData + { rig = MW + , vis = Export + , opts = [] + , type = + mkTy + { name = "<>" + , type = + MkArg MW ExplicitArg Nothing (var "Data.Fuel.Fuel") + .-> var "Test.DepTyCheck.Gen.Gen" .$ var "Test.DepTyCheck.Gen.Emptiness.MaybeEmpty" .$ var "Prelude.Basics.Bool" + } + }) + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Basics.False (orders)")) + .$ (var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ var "Prelude.Basics.False") + ] + , IDef + emptyFC + "<>" + [ var "<>" .$ bindVar "^cons_fuel^" + .= var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Basics.True (orders)")) + .$ (var "Prelude.pure" .! ("f", var "Test.DepTyCheck.Gen.Gen" .$ implicitTrue) .$ var "Prelude.Basics.True") + ] + ] + , scope = + var "Test.DepTyCheck.Gen.label" + .$ (var "fromString" .$ primVal (Str "Prelude.Basics.Bool[] (non-spending)")) + .$ ( var "Test.DepTyCheck.Gen.oneOf" + .! ("em", var "MaybeEmpty") + .$ ( var "::" + .$ (var "<>" .$ var "^fuel_arg^") + .$ (var "::" .$ (var "<>" .$ var "^fuel_arg^") .$ var "Nil"))) + } + ] + ] + , scope = var "[0, 2]" .$ var "^outmost-fuel^" .$ var "outer^" .$ var "outer^" + } + diff --git a/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/run b/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/least-effort/print/specialise/07-1 vect-indexed-multargspec/run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file diff --git a/tests/derivation/least-effort/run/specialise/07-0 list-lookup/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/DerivedGen.idr index dcd4b2529..b3f9de613 100644 --- a/tests/derivation/least-effort/run/specialise/07-0 list-lookup/DerivedGen.idr +++ b/tests/derivation/least-effort/run/specialise/07-0 list-lookup/DerivedGen.idr @@ -10,13 +10,13 @@ data Lookup : a -> List (a, b) -> Type where Here : (y : b) -> Lookup x $ (x, y)::xys There : Lookup z xys -> Lookup z $ (x, y)::xys +data UseLookup : Type where + UL : Lookup True [(True, True, True, True)] -> UseLookup + Show a => Show b => Show (Lookup {a=a} {b=b} x xs) where showPrec d $ Here y = showCon d "Here" $ showArg y showPrec d $ There y = showCon d "There" $ showArg y -data UseLookup : Type where - UL : Lookup True [(True, True, True, True)] -> UseLookup - Show UseLookup where showPrec d $ UL y = showCon d "UL" $ showArg y diff --git a/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr index 467d22b65..44b38f1f0 100644 --- a/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr +++ b/tests/derivation/least-effort/run/specialise/07-1 vect-indexed-multargspec/DerivedGen.idr @@ -24,18 +24,14 @@ public export RegIsType : Fin r -> Bool -> Regs r -> Type RegIsType fn t rs = AtIndex fn rs (Just t) -Show (AtIndex f v t) where - showPrec d $ Here = "Here" - showPrec d $ There x = showCon d "There" $ showArg x - -------------------- ---- Expressions --- -------------------- - public export data SimpleExpr : Regs r -> Bool -> Type where Read : (idx : Fin r) -> RegIsType idx t regs => SimpleExpr regs t +Show (AtIndex f v t) where + showPrec d $ Here = "Here" + showPrec d $ There x = showCon d "There" $ showArg x + Show (SimpleExpr regs b) where showPrec d $ Read idx @{rit} = showCon d "Read" $ showArg idx ++ showArg "@{\{show rit}}" diff --git a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr index dfc2c3771..6938cbaae 100644 --- a/tests/derivation/utils/specialise-if-needed/_common/Shared.idr +++ b/tests/derivation/utils/specialise-if-needed/_common/Shared.idr @@ -18,9 +18,6 @@ record CallGen where export [PrintDC] Monad m => Elaboration m => DerivationClosure m where - needWeightFun ti = do - logMsg "" 0 "needWeightFun \{show ti}" - pure () callGen sig fuel params = do logPoint Warning "deptycheck.test.utils.specialise" [sig] "CallGen params: \{show params}" pure (`(_), Nothing) @@ -28,7 +25,6 @@ Monad m => Elaboration m => DerivationClosure m where export [WriterDC] Monad m => Elaboration m => MonadWriter (Maybe CallGen) m => DerivationClosure m where - needWeightFun ti = pure () callGen sig fuel params = do tell $ Just $ MkCallGen sig fuel params pure (`(?dc_return), Nothing) @@ -78,14 +74,13 @@ runSIN namesInfo declareSpec e = do r <- specialiseIfNeeded (MkGenSignature ti givenSet) `(?fuel) givenVals case r of Nothing => logMsg "" 0 "sIN returned nothing." - Just (sdecls, stype, retExpr) => do - if declareSpec then declare sdecls else pure () + Just _ => pure () export runSIN' : Elaboration m => MonadWriter (Maybe CallGen) m => - Maybe NamesInfoInTypes -> Bool -> TTImp -> m $ Maybe (TTImp, TypeInfo) + Maybe NamesInfoInTypes -> Bool -> TTImp -> m $ Maybe TTImp runSIN' namesInfo declareSpec e = do e <- expandNames e logPoint Warning "deptycheck.test.utils.specialise" [] "Expanded e: \{show e}" @@ -111,17 +106,11 @@ runSIN' namesInfo declareSpec e = do let dc = WriterDC @{%search} _ <- getConsRecs - r <- specialiseIfNeeded (MkGenSignature ti givenSet) `(?fuel) givenVals - case r of - Nothing => pure Nothing - Just (sdecls, stype, retExpr) => do - when declareSpec $ declare sdecls - pure $ Just (retExpr, stype) - + specialiseIfNeeded (MkGenSignature ti givenSet) `(?fuel) givenVals export runSIN'' : Elaboration m => - Maybe NamesInfoInTypes -> Bool -> TTImp -> m (Maybe (TTImp, TypeInfo), Maybe CallGen) + Maybe NamesInfoInTypes -> Bool -> TTImp -> m (Maybe TTImp, Maybe CallGen) runSIN'' namesInfo declareSpec e = runWriterT {w=Maybe CallGen} {m} $ runSIN' namesInfo declareSpec e diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected index 73f60fbe5..9c80a28b8 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-002/expected @@ -7,8 +7,8 @@ LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] ({arg:1} := Prelude.Types LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Task before normalisation: \ lam^0 => Test.X Prelude.Types.Nat lam^0 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:2} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] lambdaBody = \ lam^0 => Test.X Prelude.Types.Nat lam^0; -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^5875988914566845402.X^5875988914566845402 +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type name: X^17811957646955735153.X^17811957646955735153 LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived Test.X^5875988914566845402.X^5875988914566845402 -LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type Test.X^5875988914566845402.X^5875988914566845402: Test.X Prelude.Types.Nat lam^0 -LOG deptycheck.test.utils.specialise:0: Test.X^5875988914566845402.X^5875988914566845402[0(fv^X^5875988914566845402.X^5875988914566845402^lam^0)] CallGen params: [Prelude.Types.S] +LOG deptycheck.util.specialisation:20: Test.X[0(t), 1] Derived Test.X^17811957646955735153.X^17811957646955735153 +LOG deptycheck.util.specialisation:10: Test.X[0(t), 1] Declared specialised type Test.X^17811957646955735153.X^17811957646955735153: Test.X Prelude.Types.Nat lam^0 +LOG deptycheck.test.utils.specialise:0: Test.X^17811957646955735153.X^17811957646955735153[0(fv^X^17811957646955735153.X^17811957646955735153^lam^0)] CallGen params: [Prelude.Types.S] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected index e3f44fcab..c02213260 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-004/expected @@ -11,11 +11,11 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:3} := Test.Nn) G LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : ({arg:5} : Prelude.Types.Nat) -> Type) -> (lam^2 : Prelude.Types.Nat) -> (lam^3 : ({arg:6} : lam^1 lam^2) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => \ lam^3 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^2732726595258903190.Y^2732726595258903190 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^17791941975642973451.Y^17791941975642973451 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^2732726595258903190.Y^2732726595258903190 -LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^2732726595258903190.Y^2732726595258903190: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) -LOG deptycheck.test.utils.specialise:0: Test.Y^2732726595258903190.Y^2732726595258903190[0(fv^Y^2732726595258903190.Y^2732726595258903190^lam^0), 1(fv^Y^2732726595258903190.Y^2732726595258903190^lam^1), 2(fv^Y^2732726595258903190.Y^2732726595258903190^lam^2), 3(fv^Y^2732726595258903190.Y^2732726595258903190^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^17791941975642973451.Y^17791941975642973451 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^17791941975642973451.Y^17791941975642973451: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X lam^1 lam^2 lam^3) +LOG deptycheck.test.utils.specialise:0: Test.Y^17791941975642973451.Y^17791941975642973451[0(fv^Y^17791941975642973451.Y^17791941975642973451^lam^0), 1(fv^Y^17791941975642973451.Y^17791941975642973451^lam^1), 2(fv^Y^17791941975642973451.Y^17791941975642973451^lam^2), 3(fv^Y^17791941975642973451.Y^17791941975642973451^lam^3)] CallGen params: [Test.Nn, Test.Nt, fromInteger 5, Test.Nn] LOG deptycheck.test.utils.specialise:0: Expanded e: Test.Y {a = Prelude.Types.Nat} Test.Nn' (Test.X Data.Fin.Fin (fromInteger 5) Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Checking specialisation need for [Prelude.Types.Nat, Test.Nn', Test.X Data.Fin.Fin (fromInteger 5) Test.Nn']... LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] (a := Prelude.Types.Nat) Given a type invocation w/o arguments, specialising @@ -27,8 +27,8 @@ LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] ({arg:3} := Test.Nn') LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Task before normalisation: \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] NormaliseTask returned: lambdaTy = (lam^0 : ({arg:4} : Prelude.Types.Nat) -> Prelude.Types.Nat) -> (lam^1 : Prelude.Types.Nat) -> (lam^2 : ({arg:6} : Data.Fin.Fin lam^1) -> Prelude.Types.Nat) -> Type; LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] lambdaBody = \ lam^0 => \ lam^1 => \ lam^2 => Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2); -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^681621592850268394.Y^681621592850268394 +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type name: Y^15100848304045734396.Y^15100848304045734396 LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Specialised type not found, deriving... -LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^681621592850268394.Y^681621592850268394 -LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^681621592850268394.Y^681621592850268394: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) -LOG deptycheck.test.utils.specialise:0: Test.Y^681621592850268394.Y^681621592850268394[0(fv^Y^681621592850268394.Y^681621592850268394^lam^0), 1(fv^Y^681621592850268394.Y^681621592850268394^lam^1), 2(fv^Y^681621592850268394.Y^681621592850268394^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] +LOG deptycheck.util.specialisation:20: Test.Y[0(a), 1, 2] Derived Test.Y^15100848304045734396.Y^15100848304045734396 +LOG deptycheck.util.specialisation:10: Test.Y[0(a), 1, 2] Declared specialised type Test.Y^15100848304045734396.Y^15100848304045734396: Test.Y {a = Prelude.Types.Nat} lam^0 (Test.X Data.Fin.Fin lam^1 lam^2) +LOG deptycheck.test.utils.specialise:0: Test.Y^15100848304045734396.Y^15100848304045734396[0(fv^Y^15100848304045734396.Y^15100848304045734396^lam^0), 1(fv^Y^15100848304045734396.Y^15100848304045734396^lam^1), 2(fv^Y^15100848304045734396.Y^15100848304045734396^lam^2)] CallGen params: [Test.Nn', fromInteger 5, Test.Nn'] diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Test.idr b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Test.idr index bfaf96ba1..f76c7000b 100644 --- a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Test.idr +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/Test.idr @@ -9,7 +9,7 @@ import Shared %runElab do - (Just (_, ti), _) <- runSIN'' Nothing False `(List Nat) + (Just ti, _) <- runSIN'' Nothing False `(List Nat) | _ => fail "Didn't generate a specialised type!" logMsg "" 0 $ show ti.name specNIIT <- getNamesInfoInTypes ti diff --git a/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/dont-run b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/dont-run new file mode 120000 index 000000000..805165988 --- /dev/null +++ b/tests/derivation/utils/specialise-if-needed/spec-if-needed-005/dont-run @@ -0,0 +1 @@ +../_common/run \ No newline at end of file From 95130c6f51cdfe6564977d420b6c856ac043c224 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 6 Apr 2026 16:41:54 +0300 Subject: [PATCH 80/81] [ clean ] Cleanup specialiser code --- .../src/Deriving/SpecialiseData.idr | 101 ++++++++---------- 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 6760f6e0a..07f41c9f2 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -130,14 +130,6 @@ interface NamespaceProvider (0 m : Type -> Type) where constructor MkNSProvider provideNS : m Namespace --- export --- %defaulthint --- CurrentNS : Elaboration m => NamespaceProvider m --- CurrentNS = MkNSProvider $ do --- NS nsn _ <- inCurrentNS "" --- | _ => fail "Internal error: inCurrentNS did not return NS" --- pure nsn - export Monad m => MonadTrans t => NamespaceProvider m => NamespaceProvider (t m) where provideNS = lift provideNS @@ -223,6 +215,7 @@ tupleOfN 0 _ = `(Unit) tupleOfN 1 t = t tupleOfN (S n) t = `(MkPair ~(t) ~(tupleOfN n t)) +||| Assemble a TTImp of a tuple from a list of `TTImp`s tupleOf : List TTImp -> TTImp tupleOf [] = `(()) tupleOf [x] = x @@ -274,11 +267,7 @@ aliasedApp (xs :< (n, an)) t = aliasedApp xs t .! (n, var an) ||| Given a list of arguments and a sorted set of names, ||| assert that every argument's name is in that set -checkArgsUse : - MonadError SpecialisationError m => - List Arg -> - SortedSet Name -> - m () +checkArgsUse : MonadError SpecialisationError m => List Arg -> SortedSet Name -> m () checkArgsUse [] _ = pure () checkArgsUse (x :: xs) t = do let Just n = x.name @@ -287,6 +276,7 @@ checkArgsUse (x :: xs) t = do then checkArgsUse xs t else throwError UnusedVarError +||| Remove named and auto-implicit applications of holes cleanupHoleAutoImplicitsImpl : TTImp -> TTImp cleanupHoleAutoImplicitsImpl (IAutoApp _ x (Implicit _ _)) = x cleanupHoleAutoImplicitsImpl (INamedApp _ x _ (Implicit _ _)) = x @@ -400,25 +390,25 @@ namespace ConInvoke TTImp (.apply) con f vals = reAppAny (var con.name) $ con.args.appsWith f vals @{conArgsNamed} +||| List + List.All to Vect + Vect.All allL2V : (l : List t) -> (0 pr : All p l) => Subset (Vect (length l) t) (All p) allL2V [] = Element [] [] allL2V (x :: xs) @{p :: ps} = do let Element xs' ps' = allL2V xs @{ps} Element (x :: xs') (p :: ps') -0 snocLengthEqS : (prev : List a) -> (new : a) -> length (snoc prev new) = S (length prev) -snocLengthEqS [] _ = Refl -snocLengthEqS (x :: xs) y = rewrite snocLengthEqS xs y in Refl - -0 snocAll : {0 prev : Vect _ _} -> All IsNamedArg prev -> (new : Arg) -> IsNamedArg new -> All IsNamedArg (snoc prev new) +||| Proof that Vect.All works over Vect.snoc +0 snocAll : {0 prev : Vect _ _} -> All pred prev -> (new : Arg) -> pred new -> All pred (snoc prev new) snocAll [] new y = [y] snocAll (y :: ys) new z = y :: snocAll ys new z -0 snocAllL : {0 prev : List _} -> All IsNamedArg prev -> (new : Arg) -> IsNamedArg new -> All IsNamedArg (snoc prev new) +||| Proof that List.All works over List.snoc +0 snocAllL : {0 prev : List _} -> All pred prev -> (new : Arg) -> pred new -> All pred (snoc prev new) snocAllL [] new y = [y] snocAllL (y :: ys) new z = y :: snocAllL ys new z -snocAll2L : (sl : SnocList Arg) -> (0 _ : All IsNamedArg sl) -> Subset (List Arg) (All IsNamedArg) +||| SnocList + SnocList.All to List + List.All +snocAll2L : (sl : SnocList Arg) -> (0 _ : All pred sl) -> Subset (List Arg) (All pred) snocAll2L [<] [<] = Element [] [] snocAll2L (sx :< x) (sy :< y) = do let Element xs ys = snocAll2L sx sy @@ -432,47 +422,51 @@ record RecursionSearchState where argsForUnifier : Subset (Vect (length areArgsRecursive) Arg) (All IsNamedArg) argsOutput : Subset (SnocList Arg) (All IsNamedArg) +||| Specialistaion-related constructor argument metadata record ArgMeta where constructor MkAMeta - isResursiveArg : Bool - --- Workaround for possible compiler bug -isRA : ArgMeta -> Bool -isRA (MkAMeta True) = True -isRA (MkAMeta False) = False + ||| The argument's type can be substituted by specialised type invocation + isRecursiveArg : Bool +||| Specialisation-related constructor metadat record ConMeta where constructor MkCMeta + ||| Metadata for each argument argMeta : List ArgMeta + ||| Replacements to transform original argument's type to specialised type mToPRenames : SortedMap Name TTImp + ||| Replacement to transform specialised type to original argument's type pToMRenames : SortedMap Name TTImp hasRecursiveArgs : ConMeta -> Bool -hasRecursiveArgs = any isRA . argMeta +hasRecursiveArgs = any isRecursiveArg . argMeta countRecursiveArgs : ConMeta -> Nat -countRecursiveArgs = count isRA . argMeta +countRecursiveArgs = count isRecursiveArg . argMeta recursiveArgNames : Con -> ConMeta -> List Name recursiveArgNames con meta = do - let recursiveArgPairs = List.filter (isRA . snd) $ zip con.args meta.argMeta + let recursiveArgPairs = List.filter (isRecursiveArg . snd) $ zip con.args meta.argMeta fromMaybe "" . name . fst <$> recursiveArgPairs +||| Specialisation-related type metadata record TypeMeta where constructor MkTyMeta + ||| Specialisation-related metadata for each constructor conMeta : List ConMeta -amrContent : Arg -> ArgMeta -> (Name -> Name) -> TTImp -amrContent a (MkAMeta False) _ = `(_) -amrContent a (MkAMeta True) alias = bindVar $ alias $ fromMaybe "" a.name - -argMaybeRecursive : (Name -> Name) -> (Arg, ArgMeta) -> AnyApp -argMaybeRecursive alias (a@(MkArg count ExplicitArg name type), am) = PosApp $ amrContent a am alias -argMaybeRecursive alias (a@(MkArg count _ name type), am) = NamedApp (fromMaybe "" name) $ amrContent a am alias +||| Generate a constructor binding where only recursive arguments are bound. +||| Said arguments are also aliased via `alias` function. +bindConRecArgsAliased : Con -> ConMeta -> (Name -> Name) -> TTImp +bindConRecArgsAliased con meta alias = + reAppAny (var con.name) $ processArg <$> zip con.args meta.argMeta + where + maybeBind : Arg -> ArgMeta -> TTImp + maybeBind a am = if isRecursiveArg am then bindVar $ alias $ fromMaybe "" a.name else `(_) -conOnlyRecursivesAliased : Con -> ConMeta -> (Name -> Name) -> TTImp -conOnlyRecursivesAliased con meta alias = - reAppAny (var con.name) $ argMaybeRecursive alias <$> zip con.args meta.argMeta + processArg : (Arg, ArgMeta) -> AnyApp + processArg (a@(MkArg _ ExplicitArg _ _), am) = PosApp $ maybeBind a am + processArg (a, am) = NamedApp (fromMaybe "" a.name) $ maybeBind a am parameters (t : SpecTask) --------------------------- @@ -545,12 +539,7 @@ parameters (t : SpecTask) ------------------------------- ||| Run unification for a given polymorphic constructor - unifyCon : - MonadLog m => - (unifier : CanUnify m) => - (con : Con) -> - (0 conN : ConArgsNamed con) => - m UnificationVerdict + unifyCon : MonadLog m => (unifier : CanUnify m) => (con : Con) -> (0 conN : ConArgsNamed con) => m UnificationVerdict unifyCon con = logBounds Debug "specialiseData.unifyCon" [t.polyTy, con] $ do let Element ca _ = allL2V con.args @{conArgsNamed} let Element ta _ = allL2V t.tqArgs @{t.tqArgsNamed} @@ -567,10 +556,7 @@ parameters (t : SpecTask) --------------------------------- ||| Generate argument of a specified constructor - mkSpecArg : - (ur : UnificationResult) -> - Fin (ur.uniDg.freeVars) -> - (Subset Arg IsNamedArg) + mkSpecArg : (ur : UnificationResult) -> Fin (ur.uniDg.freeVars) -> Subset Arg IsNamedArg mkSpecArg ur fvId = do let fvData = index fvId ur.uniDg.fvData let fromLambda = finToNat fvId >= ur.task.lfv @@ -582,13 +568,14 @@ parameters (t : SpecTask) getVar (IVar _ n) = Just n getVar _ = Nothing - findRecursiveApps : + ||| Check if a given argument is "recursive" (i.e. its type can be replaced with invocation of specialised type) + checkArgRecursion : Monad m => CanUnify m => MonadLog m => NamesInfoInTypes => RecursionSearchState -> Subset Arg IsNamedArg -> m RecursionSearchState - findRecursiveApps rss (Element thisArg thisArgNamed) = do + checkArgRecursion rss (Element thisArg thisArgNamed) = do let (MkRSS cRenames pToMRenames areArgsRec (Element argsForUni _) (Element argsOut _)) = rss let (aLhs, aa) = unAppAny thisArg.type let True = (length aa /= 0) || (isJust $ lookupType =<< getVar aLhs) @@ -660,14 +647,14 @@ parameters (t : SpecTask) let typeArgs = newArgs.appsWith var ur.fullResult let tyRet = reAppAny (var t.resultName) typeArgs let n = if params.eraseConNames then fromString "\{t.resultName}^Con^\{show cIdx}" else dropNS pCon.name - rssRhs <- foldlM findRecursiveApps (MkRSS empty empty [<] (Element [] []) (Element [<] [<])) specArgs - let (MkRSS cRename pToMRenames argsAreRecursive' _ (Element outArgs' outArgsNamed')) = rssRhs + rssRhs <- foldlM checkArgRecursion (MkRSS empty empty [<] (Element [] []) (Element [<] [<])) specArgs + let (MkRSS mToPRenames pToMRenames argsAreRecursive' _ (Element outArgs' outArgsNamed')) = rssRhs let Element outArgs outArgsNamed = snocAll2L outArgs' outArgsNamed' - let conMeta = MkCMeta (MkAMeta <$> toList argsAreRecursive') cRename pToMRenames + let conMeta = MkCMeta (MkAMeta <$> toList argsAreRecursive') mToPRenames pToMRenames pure $ (MkCon { name = inGenNS t $ n , args = outArgs - , type = substituteVariables cRename tyRet + , type = substituteVariables mToPRenames tyRet } `Element` TheyAreNamed outArgsNamed, conMeta) ||| Generate a specialised type @@ -898,8 +885,8 @@ parameters (t : SpecTask) ||| Generate a left-hand-side for recursive argument with-clauses mkInitialLhs : Con -> ConMeta -> TTImp mkInitialLhs con meta = do - let lhsCon = conOnlyRecursivesAliased con meta $ prependS "lhs^" - let rhsCon = conOnlyRecursivesAliased con meta $ prependS "rhs^" + let lhsCon = bindConRecArgsAliased con meta $ prependS "lhs^" + let rhsCon = bindConRecArgsAliased con meta $ prependS "rhs^" var "castInjImpl" .! ("castInj^x", lhsCon) .! ("castInj^y", rhsCon) .$ bindVar "prf" ||| Wrap a clause in with-clauses for all given names From 24f47697cd5a62f86e8dd875e035c9773496e3c5 Mon Sep 17 00:00:00 2001 From: Anton Gusev Date: Mon, 6 Apr 2026 19:09:32 +0300 Subject: [PATCH 81/81] [ clean ] Continue specialiser cleanup --- .../src/Deriving/SpecialiseData.idr | 97 +++++++++---------- 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/elab-util-extra/src/Deriving/SpecialiseData.idr b/elab-util-extra/src/Deriving/SpecialiseData.idr index 07f41c9f2..439ce14d2 100644 --- a/elab-util-extra/src/Deriving/SpecialiseData.idr +++ b/elab-util-extra/src/Deriving/SpecialiseData.idr @@ -180,12 +180,6 @@ applyArgAliases (x :: xs) @{_ :: _} ys ins = do prependS : String -> Name -> Name prependS s n = UN $ Basic $ s ++ show n -||| Given a list of arguments, generate a list of aliases for them -transformArgNames' : (f : Name -> Name) -> (as : List Arg) -> (0 _ : All IsNamedArg as) => List (Name, Name) -transformArgNames' _ [] = [] -transformArgNames' f (x :: xs) @{_ :: _} = - (argName x, f $ Expr.argName x) :: transformArgNames' f xs - ||| Given a list of arguments, generate a list of aliased arguments ||| and a list of aliases transformArgNames : @@ -194,7 +188,7 @@ transformArgNames : (0 _ : All IsNamedArg as) => (Subset (List Arg) (All IsNamedArg), List (Name, Name)) transformArgNames f as = do - let aliases = transformArgNames' f as + let aliases = pushIn as %search <&> \(x `Element` xN) => (argName x, f $ Expr.argName x @{xN}) (applyArgAliases as aliases empty, aliases) ||| Make an argument omega implicit if it is explicit @@ -213,7 +207,7 @@ makeTypeArgM0 a = { count := if a.type == `(Type) then M0 else a.count } a tupleOfN : Nat -> TTImp -> TTImp tupleOfN 0 _ = `(Unit) tupleOfN 1 t = t -tupleOfN (S n) t = `(MkPair ~(t) ~(tupleOfN n t)) +tupleOfN (S n) t = `(MkPair ~t ~(tupleOfN n t)) ||| Assemble a TTImp of a tuple from a list of `TTImp`s tupleOf : List TTImp -> TTImp @@ -249,18 +243,6 @@ hideExplicitArgs xs = hideExplicitArg <$> xs `Element` hideExplicitArgPreservesN makeArgsImplicit : (xs : List Arg) -> (0 _ : All IsNamedArg xs) => Subset (List Arg) (All IsNamedArg) makeArgsImplicit xs = makeImplicit <$> xs `Element` makeImplicitPreservesNames xs -||| Create a binding application of aliased arguments -||| binding everything to `(_) -aliasedAppBind : SnocList (Name, Name) -> TTImp -> TTImp -aliasedAppBind [<] t = t -aliasedAppBind (xs :< (n, an)) t = aliasedAppBind xs t .! (an, `(_)) - - -||| Create a non-binding application of aliased arguments -aliasedApp : SnocList (Name, Name) -> TTImp -> TTImp -aliasedApp [<] t = t -aliasedApp (xs :< (n, an)) t = aliasedApp xs t .! (n, var an) - --------------------- --- TASK ANALYSIS --- --------------------- @@ -390,36 +372,49 @@ namespace ConInvoke TTImp (.apply) con f vals = reAppAny (var con.name) $ con.args.appsWith f vals @{conArgsNamed} -||| List + List.All to Vect + Vect.All -allL2V : (l : List t) -> (0 pr : All p l) => Subset (Vect (length l) t) (All p) -allL2V [] = Element [] [] -allL2V (x :: xs) @{p :: ps} = do - let Element xs' ps' = allL2V xs @{ps} - Element (x :: xs') (p :: ps') - -||| Proof that Vect.All works over Vect.snoc -0 snocAll : {0 prev : Vect _ _} -> All pred prev -> (new : Arg) -> pred new -> All pred (snoc prev new) -snocAll [] new y = [y] -snocAll (y :: ys) new z = y :: snocAll ys new z - -||| Proof that List.All works over List.snoc -0 snocAllL : {0 prev : List _} -> All pred prev -> (new : Arg) -> pred new -> All pred (snoc prev new) -snocAllL [] new y = [y] -snocAllL (y :: ys) new z = y :: snocAllL ys new z - -||| SnocList + SnocList.All to List + List.All -snocAll2L : (sl : SnocList Arg) -> (0 _ : All pred sl) -> Subset (List Arg) (All pred) -snocAll2L [<] [<] = Element [] [] -snocAll2L (sx :< x) (sy :< y) = do - let Element xs ys = snocAll2L sx sy - Element (snoc xs x) (snocAllL ys x y) +namespace VectAll + ||| Proof that Vect.All works over Vect.snoc + export + 0 snoc: All p prev -> p new -> All p (Data.Vect.snoc prev new) + snoc [] y = [y] + snoc (y :: ys) z = y :: snoc ys z + ||| List + List.All to Vect + Vect.All + export + fromListAll : (l : List t) -> (0 pr : All p l) => Subset (Vect (length l) t) (All p) + fromListAll [] = Element [] [] + fromListAll (x :: xs) @{p :: ps} = do + let Element xs' ps' = fromListAll xs @{ps} + Element (x :: xs') (p :: ps') + +namespace ListAll + ||| Proof that List.All works over List.snoc + export + 0 snoc : All p prev -> p new -> All p (Data.List.snoc prev new) + snoc [] y = [y] + snoc (y :: ys) z = y :: snoc ys z + +namespace SnocListAll + ||| SnocList + SnocList.All to List + List.All + export + toListAll : (sl : SnocList Arg) -> (0 _ : All p sl) -> Subset (List Arg) (All p) + toListAll [<] [<] = Element [] [] + toListAll (sx :< x) (sy :< y) = do + let Element xs ys = toListAll sx sy + Element (snoc xs x) (snoc ys y) + +||| Internal state of recursion search algorithm record RecursionSearchState where constructor MkRSS - castRenames : SortedMap Name TTImp + ||| Accumulated transformation to cast from argument type to specialised type + mToPRenames : SortedMap Name TTImp + ||| Accumulated transformation to cast from specialised type to argument type pToMRenames : SortedMap Name TTImp + ||| SnocList containing recursiveness of previous arguments areArgsRecursive : SnocList Bool + ||| The pre-baked arguments to run unification with. argsForUnifier : Subset (Vect (length areArgsRecursive) Arg) (All IsNamedArg) + ||| Accumulated arguments to be used in specialised constructor argsOutput : Subset (SnocList Arg) (All IsNamedArg) ||| Specialistaion-related constructor argument metadata @@ -541,8 +536,8 @@ parameters (t : SpecTask) ||| Run unification for a given polymorphic constructor unifyCon : MonadLog m => (unifier : CanUnify m) => (con : Con) -> (0 conN : ConArgsNamed con) => m UnificationVerdict unifyCon con = logBounds Debug "specialiseData.unifyCon" [t.polyTy, con] $ do - let Element ca _ = allL2V con.args @{conArgsNamed} - let Element ta _ = allL2V t.tqArgs @{t.tqArgsNamed} + let Element ca _ = fromListAll con.args @{conArgsNamed} + let Element ta _ = fromListAll t.tqArgs @{t.tqArgsNamed} let uniTask = MkUniTask {lfv=_} ca con.type {rfv=_} ta t.fullInvocation @@ -589,9 +584,9 @@ parameters (t : SpecTask) cRenames pToMRenames (areArgsRec :< False) - (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) + (Element (snoc argsForUni thisArg) (snoc %search thisArgNamed)) (Element (argsOut :< outArg) (%search :< outArgNamed)) - let Element ta _ = allL2V t.tqArgs @{t.tqArgsNamed} + let Element ta _ = fromListAll t.tqArgs @{t.tqArgsNamed} let uniTask = MkUniTask {lfv=_} argsForUni thisArg.type {rfv=_} ta t.fullInvocation ur <- unify uniTask case ur of @@ -611,7 +606,7 @@ parameters (t : SpecTask) (insert (argName thisArg) `(~mToPImpl ~(var $ argName thisArg)) cRenames) (insert (argName thisArg) `(~pToMImpl ~(var $ argName thisArg)) pToMRenames) (areArgsRec :< True) - (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) + (Element (snoc argsForUni thisArg) (snoc %search thisArgNamed)) (Element (argsOut :< outArg) (%search :< outArgNamed)) _ => do let outPiInfo = substituteVariables cRenames <$> thisArg.piInfo @@ -623,7 +618,7 @@ parameters (t : SpecTask) cRenames pToMRenames (areArgsRec :< False) - (Element (snoc argsForUni thisArg) (snocAll %search thisArg thisArgNamed)) + (Element (snoc argsForUni thisArg) (snoc %search thisArgNamed)) (Element (argsOut :< outArg) (%search :< outArgNamed)) ||| Generate a specialised constructor @@ -649,7 +644,7 @@ parameters (t : SpecTask) let n = if params.eraseConNames then fromString "\{t.resultName}^Con^\{show cIdx}" else dropNS pCon.name rssRhs <- foldlM checkArgRecursion (MkRSS empty empty [<] (Element [] []) (Element [<] [<])) specArgs let (MkRSS mToPRenames pToMRenames argsAreRecursive' _ (Element outArgs' outArgsNamed')) = rssRhs - let Element outArgs outArgsNamed = snocAll2L outArgs' outArgsNamed' + let Element outArgs outArgsNamed = toListAll outArgs' outArgsNamed' let conMeta = MkCMeta (MkAMeta <$> toList argsAreRecursive') mToPRenames pToMRenames pure $ (MkCon { name = inGenNS t $ n