Skip to content

Instantly share code, notes, and snippets.

@adamw
Created May 26, 2023 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamw/9ce156f7a74fe0fdcde37d13f47a13db to your computer and use it in GitHub Desktop.
Save adamw/9ce156f7a74fe0fdcde37d13f47a13db to your computer and use it in GitHub Desktop.
.libv1> builtins.merge
test1: Nat -> Nat
test1 n = n + n
.libv1> add test1

Preparing v2, changing the signature of test1:

.> fork libv1 libv2
test1: Nat -> Nat -> Nat
test1 n m = n + n + m
.libv2> update

Using v1:

.myapp> builtins.merge
.myapp> fork .libv1 libv1
work: 'Nat
work _ = test1 10

> !work
.myapp> add work

Updating to v2:

.myapp> builtins.merge
.myapp> fork .libv2 libv2
.myapp> view.patch libv2.patch
.myapp> patch libv2.patch
.myapp> display work
.myapp> todo
@ceedubs
Copy link

ceedubs commented May 26, 2023

Here is the output of the transcript with a bit of additional prose:

test1: Nat -> Nat
test1 n = n + n
.libv1> add test1

  ⍟ I've added these definitions:
  
    test1 : Nat -> Nat

Preparing v2, changing the signature of test1:

test1: Nat -> Nat -> Nat
test1 n m = n + n + m
.libv2> update

  ⍟ I've updated these names to your new definition:
  
    test1 : Nat -> Nat -> Nat

Using v1:

  ☝️  The namespace .myapp is empty.

.myapp> builtins.merge

  Done.

.myapp> fork .libv1 libv1

  Done.

work: 'Nat
work _ = test1 10

> !work

Updating to v2:

.myapp> builtins.merge

  Done.

.myapp> fork .libv2 libv2

  Done.

.myapp> view.patch libv2.patch

  Edited Terms: 1. libv1.test1 -> 2. libv2.test1
  
  Tip: To remove entries from a patch, use
       delete.term-replacement or delete.type-replacement, as
       appropriate.

We see that there is a libv1.test1 -> libv2.test1 item in the patch, so we expect it to either automatically patch (which isn't really possible with the type signature change) or to result in a todo item. But the todo list is empty and work hasn't been updated to reference libv2.test1.

.myapp> patch libv2.patch

.myapp> display work

  '(.libv1.test1 10)

.myapp> todo

  ✅
  
  No conflicts or edits in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment