Idris2 icon indicating copy to clipboard operation
Idris2 copied to clipboard

`Lazy` allows for the construction of `Void`

Open 42triangles opened this issue 2 years ago • 3 comments

Steps to Reproduce

Compile the following:

https://gist.github.com/42triangles/40052a0e58b0a8396943a1f28cc62352 (the same as the code below)

%default total

data Recursive : (Lazy Type -> Type) -> Type where
  Recursing : t (delay (Recursive t)) -> Recursive t

F : Type
F = Recursive (\x => Not x)

notF : Not F
notF f@(Recursing nF) = nF f

f : F
f = Recursing notF

argh : Void
argh = notF f

(adapted from gallais' example for data Recursive : (Type -> Type) -> Type where Recursing : t (Recursive t) -> Recursive t (which is not accepted) allowing Void to be derived)

Expected Behavior

Does not compile

Observed Behavior

Does compile

42triangles avatar Jun 16 '22 19:06 42triangles

Humble observer here.. Isn't this expected? Isn't a nonterminating value bottom?

ProofOfKeags avatar Jun 27 '22 16:06 ProofOfKeags

Lazy should not allow non termination. Its only impact should be the evaluation strategy being used.

gallais avatar Jun 27 '22 20:06 gallais

Specifically the issue is that argh is marked as total thanks to %default total, which means it shouldn't be able to be Void

42triangles avatar Jul 28 '22 22:07 42triangles