unison/unison-src/transcripts/fix1356.output.md
2021-09-27 17:25:23 -04:00

1.7 KiB

Step 1: code a term and documentation for it

x = 1
x.doc = [: I am the documentation for x:]

  I found and typechecked these definitions in scratch.u. If you
  do an `add` or `update`, here's how your codebase would
  change:
  
    ⍟ These new definitions are ok to `add`:
    
      x     : Nat
      x.doc : Doc

Step 2: add term and documentation, link, and check the documentation

  ☝️  The namespace .trunk is empty.

.trunk> add

  ⍟ I've added these definitions:
  
    x     : Nat
    x.doc : Doc

.trunk> link x.doc x

  Updates:
  
    1. trunk.x : Nat
       + 2. doc : Doc

.trunk> docs x

  I am the documentation for x

Step 2.5: We'll save this for later for some reason.

.trunk> alias.term x.doc .backup.x.doc

  Done.

Step 3: Oops I don't like the doc, so I will re-code it!

x.doc = [: I am the documentation for x, and I now look better:]

  I found and typechecked these definitions in scratch.u. If you
  do an `add` or `update`, here's how your codebase would
  change:
  
    ⍟ These names already exist. You can `update` them to your
      new definition:
    
      x.doc : Doc

Step 4: I add it and expect to see it

.trunk> update

  ⍟ I've updated these names to your new definition:
  
    x.doc : Doc

.trunk> docs x

  I am the documentation for x, and I now look better

That works great. Let's relink the old doc too.

.trunk> link .backup.x.doc x

  Updates:
  
    1. trunk.x : Nat
       + 2. backup.x.doc : Doc

Let's check that we see both docs:

.trunk> docs x

  I am the documentation for x, and I now look better