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

dm4f: Cannot define continuations #713

Closed
mtzguido opened this issue Oct 9, 2016 · 4 comments
Closed

dm4f: Cannot define continuations #713

mtzguido opened this issue Oct 9, 2016 · 4 comments

Comments

@mtzguido
Copy link
Member

mtzguido commented Oct 9, 2016

The following code

module Bug713

let r = int
let cont (a:Type0) : Type = (a -> M r) -> M r

let return (a:Type0) (x:a) (p : a -> M r) : M r = p x

let bind (a:Type0) (b:Type0)
         (m : cont a) (f : a -> Tot (cont b)) (k : b -> M r) : M r =
         m (fun (x:a) -> f x k)

reifiable new_effect_for_free {
  CONT: Type -> Effect
  with repr = cont
     ; return = return
     ; bind = bind
}

Fails with

Error: Tm_ascribed is outside of the definition language: ((uu___:(uu___:a -> M (Prims.int)) -> M (Prims.int)) : Type)

Without annotating the type of cont, the error one gets is:

unknown(0,0-0,0) : Error
Variable "uu___#1870" not found

which might be a separate problem.

mtzguido added a commit that referenced this issue Oct 9, 2016
@msprotz
Copy link
Collaborator

msprotz commented Oct 10, 2016

I started looking at this specific example and then realized that you had made further progress on your branch. In particular, I suspect this example is broken because you did not provide M-style return type annotations for your combinators.

Can you let me know what the current status of this bug is?

mtzguido added a commit that referenced this issue Oct 10, 2016
@catalin-hritcu
Copy link
Member

catalin-hritcu commented Oct 10, 2016

Here's the current status (pre artifact evaluation). With let mm:

[debug] mm#3033 is NOT a monadic let-binding
[debug] type of [head] is (uu___:(uu___:a -> M (Type)) -> M (Type))
[debug] length binders=1, length args=1
[debug]: final type of application is M[Type]
[debug] type of [head] is (uu___:a -> Tot (uu___:(uu___:b -> M (Type)) -> M (Type)))
[debug] length binders=2, length args=1
[debug]: final type of application is N[(uu___:(uu___:b -> M (Type)) -> M (Type))]
[debug] fx#3037 is NOT a monadic let-binding
[debug] type of [head] is (uu___:(uu___:b -> M (Type)) -> M (Type))
[debug] length binders=1, length args=1
[debug]: final type of application is M[Type]
./examples/bug-reports/bug715.fst(13,20-13,21) : Error
Expected expression of type "(uu___:(uu___:a -> M (Type)) -> M (Type))";
got expression "m" of type "(uu___:(uu___:a -> uu___:(uu___:Type -> Type) -> Type) -> uu___:(uu___:Type -> Type) -> Type)"

without let mm:

[debug] type of [head] is (uu___:(uu___:a -> M (Type)) -> M (Type))
[debug] length binders=1, length args=1
[debug]: final type of application is M[Type]
[debug] type of [head] is (uu___:a -> Tot (uu___:(uu___:b -> M (Type)) -> M (Type)))
[debug] length binders=2, length args=2
[debug]: final type of application is M[Type]
unknown(0,0-0,0) : Error
Variable "uu___#2279" not found

@msprotz
Copy link
Collaborator

msprotz commented Oct 10, 2016

Correct, this is the current status. Not sure I'll have the bandwidth to debug this before the artifact evaluation deadline, so I'm going to try to make the lift effect work instead before I go to bed.

@catalin-hritcu catalin-hritcu mentioned this issue Oct 28, 2016
27 tasks
@kyoDralliam
Copy link
Contributor

Now working if you write it the exact way FStar expects it... There are still some issues if you don't add enough type annotations.

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

No branches or pull requests

4 participants