purescript/purescript-record

Thoughts on replacing Proxy with VTA?

pete-murphy opened this issue · 3 comments

Is there any interest in (or objection to) updating this library to use Visible Type Application syntax in place of Proxy?

Hm, maybe Builder would still need Proxy unless I'm not seeing how to make this testBuilder compile

  let
    testBuilder =
      ( Builder.build
          :: forall r
           . Builder { | r } { x :: String, y :: String | r }
          -> { | r }
          -> { x :: String, y :: String | r }
      )
        ( Builder.insert @"x" 42
            >>> Builder.merge { y: true, z: "testing" }
            >>> Builder.delete @"y"
            >>> Builder.modify @"x" show
            >>> Builder.rename @"z" @"y"
        )
        {}

I thought adding the type annotation to build might be the best I could do to help infer the right constraints, but I get the following error on the call to Builder.insert @"x"

  An expression of polymorphic type
  with the invisible type variable l:

    forall l a r1 r2. Cons l a r1 r2 => Lacks l r1 => IsSymbol l => a -> Builder (Record r1) (Record r2)

  cannot be applied to:

    "x"

Hm, maybe Builder would still need Proxy unless I'm not seeing how to make this testBuilder compile

Oops, nevermind, I had forgot to make some of the type variables visible with @ (which is what the error is saying).

garyb commented

There's a current/active thread on the forum discussing the guidelines we're going to use for updating libraries with VTAs, might be worth chiming in there too: https://discourse.purescript.org/t/proposal-guidelines-for-vtas/3866