effekt-lang / effekt

A language with lexical effect handlers and lightweight effect polymorphism
https://effekt-lang.org
MIT License
335 stars 24 forks source link

Annotate that `main` returns `unit` in MLton backend #554

Closed jiribenes closed 2 months ago

jiribenes commented 3 months ago

Regarding ML and exit, in #551 we try to enforce that main returns unit. So maybe we could annotate Unit as a type for a in the code generation of ml?

_Originally posted by @b-studios in https://github.com/effekt-lang/effekt/pull/541#discussion_r1725335520_


There's a warning coming from MLton that manifests if you try to use exit from the process module added in #541. Could we silence it by annotating the it to be unit?

Warning: <bogus> ~1.~1.
  Type of variable was not inferred and could not be generalized: it.
    type: ???
    in: val it = main_2612 (fn a => a)

Relevant code: https://github.com/effekt-lang/effekt/blob/d96a17b70f99099d9a77e7059ccde99be6511421/effekt/shared/src/main/scala/effekt/generator/ml/Transformer.scala#L609-L619

b-studios commented 2 months ago

Won't fix, we deleted the backend in #616