Skip to content

Behavior of inferred effect arguments without val #581

@s-zanella

Description

@s-zanella

I was surprised to see that giving no val declaration isn't equivalent to giving one without refinements or effects, as illustrated in the example below.

module M

#set-options "--log_types --print_effect_args"

assume new type p: int -> Type0

assume val f: n:int{p n} -> int

//The three declarations below are equivalent and with all of them g fails to typecheck 
//val g: unit -> int
//val g: unit -> ML int
//val g: unit -> ALL int (fun post _ -> forall a h. post a h)

//Inferred type and effect when no declaration is given; with it g typechecks
//val g: unit -> ALL int (fun post _ -> p 0 /\ (forall a h. post a h))

let g () = f 0

This isn't the case with --stratified. It was confusing for me and at least one other person run into this problem when playing with ex1a-safe-read-write.fst in the tutorial.

Is this really the behaviour we want?
If we prefer to have a consistent behaviour, which one to choose?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions