mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-23 16:28:02 +03:00
72832815eb
implement added Lens.Cons and Lens.Snoc instances (closes #1200): instance Cons Path Path NameSegment NameSegment instance Snoc Relative Relative NameSegment NameSegment instance Snoc Absolute Absolute NameSegment NameSegment instance Snoc Path Path NameSegment NameSegment instance Snoc Path' Path' NameSegment NameSegment and class Path.Resolve l r where resolve :: l -> r -> l with instance Resolve Path Path instance Resolve Relative Relative instance Resolve Absolute Relative instance Resolve Path' Path' instance Resolve Path' Split' instance Resolve Absolute Path'
4.9 KiB
4.9 KiB
Delete
The delete command can delete both terms and types, as long as it's given an unambiguous name.
First, let's make sure it complains when we try to delete a name that doesn't exist.
.> delete foo
⚠️
I don't know about that name.
Now for some easy cases. Deleting an unambiguous term, then deleting an unambiguous type.
foo = 1
type Foo = Foo Nat
.> add
⍟ I've added these definitions:
type Foo
foo : Nat
.> delete foo
Removed definitions:
1. foo : Nat
Tip: You can use `undo` or `reflog` to undo this change.
.> delete Foo
Removed definitions:
1. type Foo
Tip: You can use `undo` or `reflog` to undo this change.
.> delete Foo.Foo
Removed definitions:
1. Foo.Foo : Nat -> #d97e0jhkmd
Tip: You can use `undo` or `reflog` to undo this change.
How about an ambiguous term?
foo = 1
☝️ The namespace .a is empty.
.a> add
⍟ I've added these definitions:
foo : Nat
foo = 2
☝️ The namespace .b is empty.
.b> add
⍟ I've added these definitions:
foo : Nat
.a> merge .b
Here's what's changed in the current namespace after the
merge:
New name conflicts:
1. foo#jk19sm5bf8 : Nat
↓
2. ┌ foo#0ja1qfpej6 : Nat
3. └ foo#jk19sm5bf8 : Nat
Tip: You can use `todo` to see if this generated any work to
do in this namespace and `test` to run the tests. Or you
can use `undo` or `reflog` to undo the results of this
merge.
.a> delete foo
🤔
That name is ambiguous. It could refer to any of the following
definitions:
foo#0ja1qfpej6
foo#jk19sm5bf8
You may:
* Delete one by an unambiguous name, given above.
* Delete them all by re-issuing the previous command.
I can force my delete through by re-issuing the command.
.a> delete foo
Removed definitions:
1. a.foo#jk19sm5bf8 : Nat
Name changes:
Original Changes
2. b.foo ┐ 3. a.foo#0ja1qfpej6 (removed)
4. a.foo#0ja1qfpej6 ┘
Tip: You can use `undo` or `reflog` to undo this change.
Let's repeat all that on a type, for completeness.
type Foo = Foo Nat
.a> add
⍟ I've added these definitions:
type Foo
type Foo = Foo Boolean
.b> add
⍟ I've added these definitions:
type Foo
.a> merge .b
Here's what's changed in the current namespace after the
merge:
New name conflicts:
1. type Foo#d97e0jhkmd
↓
2. ┌ type Foo#d97e0jhkmd
3. └ type Foo#gq9inhvg9h
4. Foo.Foo#d97e0jhkmd#0 : Nat -> Foo
↓
5. ┌ Foo.Foo#d97e0jhkmd#0 : Nat -> Foo
6. └ Foo.Foo#gq9inhvg9h#0 : Boolean -> b.Foo
Added definitions:
7. foo : Nat
Tip: You can use `todo` to see if this generated any work to
do in this namespace and `test` to run the tests. Or you
can use `undo` or `reflog` to undo the results of this
merge.
.a> delete Foo
🤔
That name is ambiguous. It could refer to any of the following
definitions:
Foo#d97e0jhkmd
Foo#gq9inhvg9h
You may:
* Delete one by an unambiguous name, given above.
* Delete them all by re-issuing the previous command.
.a> delete Foo
Removed definitions:
1. type a.Foo#d97e0jhkmd
Name changes:
Original Changes
2. b.Foo ┐ 3. a.Foo#gq9inhvg9h (removed)
4. a.Foo#gq9inhvg9h ┘
Tip: You can use `undo` or `reflog` to undo this change.
.a> delete Foo.Foo
🤔
That name is ambiguous. It could refer to any of the following
definitions:
Foo.Foo#d97e0jhkmd#0
Foo.Foo#gq9inhvg9h#0
You may:
* Delete one by an unambiguous name, given above.
* Delete them all by re-issuing the previous command.
.a> delete Foo.Foo
Removed definitions:
1. a.Foo.Foo#d97e0jhkmd#0 : Nat -> #d97e0jhkmd
Name changes:
Original Changes
2. b.Foo.Foo ┐ 3. a.Foo.Foo#gq9inhvg9h#0 (removed)
4. a.Foo.Foo#gq9inhvg9h#0 ┘
Tip: You can use `undo` or `reflog` to undo this change.
Finally, let's try to delete a term and a type with the same name.
foo = 1
type foo = Foo Nat
.> add
⍟ I've added these definitions:
type foo
foo : Nat
.> delete foo
🤔
That name is ambiguous. It could refer to any of the following
definitions:
foo#jk19sm5bf8
foo#d97e0jhkmd
You may:
* Delete one by an unambiguous name, given above.
* Delete them all by re-issuing the previous command.
.> delete foo
Removed definitions:
1. type foo
2. foo : Nat
Tip: You can use `undo` or `reflog` to undo this change.