unison icon indicating copy to clipboard operation
unison copied to clipboard

view individual ability constructor

Open ceedubs opened this issue 2 years ago • 2 comments

Problem

Currently when you view an ability constructor, it pretty-prints the entire ability. This is fine for a small ability like Abort:

.> view abort
 
  structural ability lib.base.abilities.Abort where abort : {lib.base.abilities.Abort} a

But for a large ability like Remote this results in a lot of noise:

.> view Remote.Promise.tryDelete
 
  unique ability lib.distributed.Remote where
    Promise.tryWrite : Remote.Promise a -> a ->{lib.distributed.Remote} Either Failure Boolean
    Ref.tryDelete : distributed.Remote.Ref a ->{lib.distributed.Remote} Either Failure ()
    distributed.Remote.fail : Failure ->{lib.distributed.Remote} x
    Promise.empty! : {lib.distributed.Remote} (Remote.Promise a)
    distributed.Remote.here! : {lib.distributed.Remote} (Remote.Location {})
    distributed.Remote.region! : {lib.distributed.Remote} (Remote.Location {})
    addFinalizer : (Outcome ->{lib.distributed.Remote} ()) ->{lib.distributed.Remote} ()
    distributed.Remote.Ref.new : a ->{lib.distributed.Remote} distributed.Remote.Ref a
    Remote.Promise.tryRead : Remote.Promise a ->{lib.distributed.Remote} Either Failure a
    distributed.Remote.sleepMicroseconds : Nat ->{lib.distributed.Remote} ()
    Ref.tryWrite : distributed.Remote.Ref a -> a ->{lib.distributed.Remote} Either Failure ()
    tryScope : '{lib.distributed.Remote} a ->{lib.distributed.Remote} Either Failure a
    distributed.Remote.tryNear :
      Remote.Location g
      -> Remote.Location g2
      ->{lib.distributed.Remote} Either Failure (Remote.Location g)
    distributed.Remote.tryFar :
      Remote.Location g
      -> Remote.Location g2
      ->{lib.distributed.Remote} Either Failure (Remote.Location g)
    allowCancel! : {lib.distributed.Remote} ()
    Ref.tryCas :
      distributed.Remote.Ref a
      -> Remote.Ref.Ticket a
      -> a
      ->{lib.distributed.Remote} Either Failure Boolean
    monotonic! : {lib.distributed.Remote} Duration
    distributed.Remote.tryCancel : Thread ->{lib.distributed.Remote} Either Failure ()
    Promise.tryDelete : Remote.Promise a ->{lib.distributed.Remote} Either Failure ()
    now! : {lib.distributed.Remote} Instant
    Ref.tryReadForCas :
      distributed.Remote.Ref a ->{lib.distributed.Remote} Either Failure (Remote.Ref.Ticket a, a)
    tryReadNow : Remote.Promise a ->{lib.distributed.Remote} Either Failure (Optional a)
    tryDetachAt :
      Remote.Location g
      -> '{g, Exception, lib.distributed.Remote} a
      ->{lib.distributed.Remote} Either Failure Thread
    distributed.Remote.randomBytes : Nat ->{lib.distributed.Remote} Bytes

If all you want to figure out is the type signature of the constructor, you still have to spend a minute hunting down the right line.

Proposal

Make view on an ability constructor just show the type signature of the constructor being viewed. Running view on the ability itself can retain its current behavior.

ceedubs avatar Jun 21 '23 13:06 ceedubs