You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
modulechurch;
open importStdlib.Prelude;
Num : Type;
Num := {A : Type} → (A → A) → A → A;
czero : Num;
czero {_} f x := x;
csuc : Num → Num;
csuc n {_} f := f ∘ n {_} f;
toNat : Num → Nat;
toNat n := n {_} ((+) 1) 0;
main : IO;
main :=
printNatLn (toNat (csuc (czero)));
end;
gives the error
juvix: impossible
CallStack (from HasCallStack):
error, called at src/Juvix/Prelude/Base.hs:315:14 in juvix-0.2.8-DyFVJXJWeol4IAnBe15XnM:Juvix.Prelude.Base
impossible, called at src/Juvix/Compiler/Core/Translation/FromInternal.hs:526:34 in juvix-0.2.8-DyFVJXJWeol4IAnBe15XnM:Juvix.Compiler.Core.Translation.FromInternal
The text was updated successfully, but these errors were encountered:
The internal to core translation was removing implicit arguments from
function definitions and applications. This is incorrect as the implicit
bindings are required when translating the following (in `csuc`, the
binding of the implicit argument is required in an application on the
rhs):
```
Num : Type;
Num := {A : Type} → (A → A) → A → A;
csuc : Num → Num;
csuc n {_} f := f ∘ n {_} f;
```
Apart from removing this filter from function and application
translation, this required the following changes:
ConstructorInfo:
The _constructorArgsNum field must include the number of type parameters
of its inductive type.
PatternConstructorApp:
The pattern arguments must include wildcards for the implicit type
parameters passed to the constructor.
BuiltinIf:
The BuiltinIf expression is passed an implicit type argument that must
be removed when translating to Core if.
LitString:
A literal string is a function with an implcit type argument. So this
must be a translated to a lambda where the type argument is ignored.
Fixes#1714
Trying to evaluate the following via core
gives the error
The text was updated successfully, but these errors were encountered: