unison/unison-src/transcripts/fix845.output.md
Greg Pfeil 0031542faf
Add a space before code block info strings
This is for consistency with the `cmark` style. Now the blocks we still
pretty-print ourselves will match the bulk of them that `cmark`
produces.
2024-07-10 13:56:07 -06:00

3.0 KiB

Add List.zonk to the codebase:

List.zonk : [a] -> [a]
List.zonk xs = xs

Text.zonk : Text -> Text
Text.zonk txt = txt ++ "!! "

  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`:
    
      List.zonk : [a] -> [a]
      Text.zonk : Text -> Text

Now, typecheck a file with a reference to Blah.zonk (which doesn't exist in the codebase). This should fail:

-- should not typecheck as there's no `Blah.zonk` in the codebase
> Blah.zonk [1,2,3]

  Loading changes detected in scratch.u.

  I couldn't figure out what Blah.zonk refers to here:
  
      2 | > Blah.zonk [1,2,3]
  
  I think its type should be:
  
      [Nat] -> o
  
  Some common causes of this error include:
    * Your current namespace is too deep to contain the
      definition in its subtree
    * The definition is part of a library which hasn't been
      added to this project
    * You have a typo in the name

Here's another example, just checking that TDNR works for definitions in the same file:

foo.bar.baz = 42

qux.baz = "hello"

ex = baz ++ ", world!"

> ex

  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`:
    
      ex          : Text
      foo.bar.baz : Nat
      qux.baz     : Text
  
  Now evaluating any watch expressions (lines starting with
  `>`)... Ctrl+C cancels.

    7 | > ex
          ⧩
          "hello, world!"

Here's another example, checking that TDNR works when multiple codebase definitions have matching names:

ex = zonk "hi"

> ex

  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`:
    
      ex : Text
  
  Now evaluating any watch expressions (lines starting with
  `>`)... Ctrl+C cancels.

    3 | > ex
          ⧩
          "hi!! "

Last example, showing that TDNR works when there are multiple matching names in both the file and the codebase:

woot.zonk = "woot"
woot2.zonk = 9384

ex = zonk "hi" -- should resolve to Text.zonk, from the codebase
      ++ zonk   -- should resolve to the local `woot.zonk` from this file

> ex

  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`:
    
      ex         : Text
      woot.zonk  : Text
      woot2.zonk : Nat
  
  Now evaluating any watch expressions (lines starting with
  `>`)... Ctrl+C cancels.

    7 | > ex
          ⧩
          "hi!! woot"