Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent %auto_lazy off behavior #3416

Open
spcfox opened this issue Nov 18, 2024 · 0 comments
Open

Inconsistent %auto_lazy off behavior #3416

spcfox opened this issue Nov 18, 2024 · 0 comments

Comments

@spcfox
Copy link

spcfox commented Nov 18, 2024

Steps to Reproduce

When using %auto_lazy off, type checking sometimes accepts programs where a strict value is passed instead of a lazy value and vice versa. Examples:

  1.  %auto_lazy off
     
     n : Nat
     n = 1
     
     m : Nat
     m = delay n
     
     k : Nat
     k = force n
  2.  %auto_lazy off
     
     main : IO ()
     main = putStrLn "Hello" >> putStrLn {io=IO} "world"

    The second argument of (>>) is lazy. Without delay typechecker throws
    Error: While processing right hand side of main. Can't find an implementation for HasIO ?io
    but accepts if you explicitly pass IO.

  3.  %auto_lazy off
    
     data X = A
     
     f : Lazy X -> X
     f x@A = x
     
     main : IO ()
     main = ignore $ pure $ f A

    This code successfully passes the type-check but throws an error when generating Scheme code:

    Exception: attempt to reference unbound identifier pat0C-58-0 at line 648, char 47 of /project/directory/build/exec/_tmpchez_app/_tmpchez.ss
    

Expected Behavior

Error during type checking, like

Error: While processing right hand side of m. Can't solve constraint between: Lazy Nat and Nat.

Observed Behavior

Successfully passes the type-check.

@spcfox spcfox changed the title Inconsistence %auto_lazy off behavior Inconsistent %auto_lazy off behavior Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant