mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-26 11:07:48 +03:00
56 lines
1.0 KiB
Markdown
56 lines
1.0 KiB
Markdown
```unison
|
|
unique type Map k v = Tip | Bin Nat k v (Map k v) (Map k v)
|
|
|
|
mapWithKey : (k ->{e} a ->{e} b) -> Map k a ->{e} Map k b
|
|
mapWithKey f m = Tip
|
|
```
|
|
|
|
```ucm
|
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
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`:
|
|
|
|
type Map k v
|
|
mapWithKey : (k ->{e} a ->{e} b) -> Map k a ->{e} Map k b
|
|
|
|
```
|
|
```ucm
|
|
scratch/main> add
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
type Map k v
|
|
mapWithKey : (k ->{e} a ->{e} b) -> Map k a ->{e} Map k b
|
|
|
|
```
|
|
```unison
|
|
naiomi =
|
|
susan: Nat -> Nat -> ()
|
|
susan a b = ()
|
|
|
|
pam: Map Nat Nat
|
|
pam = Tip
|
|
|
|
mapWithKey susan pam
|
|
|
|
```
|
|
|
|
```ucm
|
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
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`:
|
|
|
|
naiomi : Map Nat ()
|
|
|
|
```
|