Skip to content

Instantly share code, notes, and snippets.

@ceedubs
Created September 13, 2021 14:04
Show Gist options
  • Select an option

  • Save ceedubs/3bd3a09edc6b3a2bf0819f6d07398d6c to your computer and use it in GitHub Desktop.

Select an option

Save ceedubs/3bd3a09edc6b3a2bf0819f6d07398d6c to your computer and use it in GitHub Desktop.

Revisions

  1. ceedubs created this gist Sep 13, 2021.
    27 changes: 27 additions & 0 deletions constructor-unit-printing-bug.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # pretty printer: Unit applied to type constructor is printed with !

    `Some 3` is printed as `Some 3`, but `Some ()` is printed as `!Some`.

    I'm guessing that there's some logic to pretty-print unit being applied to a thunk (a _function_) that is also being applied to type constructors.

    ```unison
    > Some 3
    > Some ()
    ```

    You can also see this applied to custom type constructors.

    ```unison
    structural type Wrapper a = Wrapper a
    ```

    ```ucm:hide
    .> add
    ```

    ```unison
    > Wrapper 3
    > Wrapper ()
    ```