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

Parameters on actions sometimes cause a crash #1621

Closed
mtzguido opened this Issue Jan 3, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@mtzguido
Copy link
Contributor

mtzguido commented Jan 3, 2019

let st (s:Type) (a:Type) = s -> M (a * s)
let return_st (s:Type) (a:Type) (x:a) : st s a = fun s0 -> x, s0

let bind_st (s:Type) (a:Type) (b:Type) (f:st s a) (g:a -> st s b) : st s b
  = fun (s0:s) -> let (x,s) = f s0 in g x s

(* Actions *)
let get (s:Type) () : st s s = fun s0 -> s0, s0

total reifiable reflectable new_effect {
  STATE_h (s:Type0) : a:Type -> Effect
  with repr     = st s
     ; bind     = bind_st s
     ; return   = return_st s
     ; get (i:int) = get s
}

new_effect STATE_int = STATE_h int

gives:

Unexpected error; please file a bug report, ideally with a minimized version of the source program that triggered the error.
Failure("Impossible: Violation of locally nameless convention: s@1:(Tm_unknown)")

Without defining STATE_int, there is no crash, but after checking the type of get it seems the i : int parameter is somehow lost. Nevermind, I was checking get instead of STATE_h?.get.

Possibly related: #885 and #714

@catalin-hritcu

This comment has been minimized.

Copy link
Member

catalin-hritcu commented Jan 10, 2019

mtzguido added a commit that referenced this issue Jan 10, 2019

@mtzguido

This comment has been minimized.

Copy link
Contributor

mtzguido commented Jan 10, 2019

I got a fix for this.

@mtzguido mtzguido closed this in e138156 Jan 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment