mlscript icon indicating copy to clipboard operation
mlscript copied to clipboard

Resolver & Type Classes Tracking Issue

Open FlandiaYingman opened this issue 11 months ago • 0 comments

This issue tracks the problems that are neither urgent nor pressing related to the resolver & type classes feature.

Summer UROP

  • [x] Unsoundness of partial application.
  • [x] Support explicitly specifying contextual argument.
  • [x] Change use keyword into a predef function.
  • [x] Reused mutable terms, mostly of UCS normalization. (see https://github.com/hkust-taco/mlscript/pull/297#discussion_r2060561339).

  • [ ] Separate Value.Ref into two cases to make fewer illegal states representable.
  • [ ] https://github.com/hkust-taco/mlscript/pull/343#discussion_r2522287364

Later

  • [ ] Handle cyclic resolution

    M.List.map
    
    module M with
      val List: M2.List = M2.List
    
    module M2 with
      val List: M.List = M.List
    
  • [ ] Move selections' symbol resolution to the resolution phase and refactor the resolvedSymbol part.

    • [x] Before that, move UCS normalization to/after the resolution phase.

Completed Tasks

- [x] Resolution possibly leading to more symbol resolution. ```fs fun foo[A](using foo: Foo[A]): A

use Foo[List] foo.map


- [x] Local functions as module methods (as their definitions always exist).

- [x] It resolves implicit application through `Sel` and `SynthSel` (because they may lead to an implicit module method call), but `Ref`.
```fs
Sel(M, f) // is resolved to App(Sel(M, f), CtxArgs)
SynthSel(M, f) // is resolved to App(SynthSel(M, f), CtxArgs)
Ref(M.f) // is not, and is expected to be, resolved to App(Ref(M.f), CtxArgs)
  • [x] Module information of definitions that returns a module

    module A with
      fun f() = 2
    
    module B with
      val a: module A = A
    
    print(B.a) // B.a should be a module, and should be rejected passing to a regular parameter
    
  • [x] #274

  • [x] #294

  • [x] Add symbols to all possibly moduleful terms. (https://github.com/hkust-taco/mlscript/issues/294#issuecomment-2745300607)

  • [x] Support use[...] syntax as in (see https://github.com/hkust-taco/mlscript/pull/282#issuecomment-2676133410)

    fun fib(using Yield[Int]) =
      fun inner(a, b) =
        use[Yield].yield(a)
        inner(b, a + b)
      inner(0, 1)
    

FlandiaYingman avatar Feb 07 '25 02:02 FlandiaYingman