===
[Large] `public.projects.dataextra.main.heap`
===
unique type heap.Heap a
  = Heap.Leaf
  | Branch
      Nat
      a
      (public.projects.dataextra.main.heap.Heap a)
      (public.projects.dataextra.main.heap.Heap a)
---
(unison
    (type_declaration
        (unique_kw)
        (type_kw)
        (type_constructor
            (type_name
                (path)
                (wordy_id))
            (type_argument))
        (kw_equals)
        (path) (wordy_id)
        (pipe)
        (wordy_id) (wordy_id) (wordy_id) (parenthesized (path) (wordy_id) (wordy_id)) (parenthesized (path) (wordy_id) (wordy_id))
        ))
===
[Large]  Heap.deleteMin
===
Heap.deleteMin :
  ∀ a g1 g. (a ->{g1} a ->{g} Ordering) -> heap.Heap a ->{g1, g} heap.Heap a
Heap.deleteMin cmp = cases
  Branch size x left right -> bubbleRootDown cmp (Heap.merge cmp left right)
  Heap.Leaf                -> Heap.Leaf
---
(unison
    (term_declaration
        (type_signature
            (path) (wordy_id) (type_signature_colon)
            (forall (kw_forall) (wordy_id) (wordy_id) (wordy_id))
            (parenthesized (wordy_id) (arrow_symbol) 
            (effect (wordy_id)) (wordy_id) (arrow_symbol) 
            (effect (wordy_id)) (wordy_id)) (arrow_symbol)
            (path) (wordy_id) (wordy_id) (arrow_symbol) 
            (effect (wordy_id)) (effect (wordy_id)) (path) (wordy_id) (wordy_id)
        )
        (term_definition
            (path) (wordy_id) (wordy_id) (kw_equals)
            (cases)
            (pattern 
                (constructor_or_variable_pattern (wordy_id) 
                    (constructor_or_variable_pattern (wordy_id))
                    (constructor_or_variable_pattern (wordy_id))
                    (constructor_or_variable_pattern (wordy_id))
                    (constructor_or_variable_pattern (wordy_id)))
                (arrow_symbol)
                (function_application
                    (wordy_id)
                    (function_application
                        (wordy_id)
                        (tuple_or_parenthesized
                            (function_application
                                (path)
                                (wordy_id)
                                (wordy_id)
                                (wordy_id)
                                (wordy_id)))))
            )
            (pattern
                (constructor_or_variable_pattern (path) (wordy_id)) (arrow_symbol) (path) (wordy_id))
        )))
===
[Large] @unison/json Decoder.run
===
j =
  """
  [1, "some text", null, true, 42.0, 239489234823098234]
  """
> Decoder.run

  (array6
    Decoder.nat
    Decoder.text
    Decoder.null
    Decoder.boolean
    Decoder.float
    unparsed)
  j
---
(unison
    (term_declaration (term_definition (wordy_id) (kw_equals) (literal_text)))
    (watch_expression (function_application
        (path) (wordy_id)
        (tuple_or_parenthesized
            (function_application
                (wordy_id)
                (function_application
                    (path) (wordy_id)
                    (function_application
                        (path) (wordy_id)
                        (function_application
                            (path) (wordy_id)
                            (function_application
                                (path) (wordy_id)
                                (function_application
                                    (path) (wordy_id)
                                    (wordy_id))))))))
        (wordy_id))))
===
[Large] @unison/json Decoding sum types
===
d =
  use Decoder nat
  nested
    "tag" nat "value" (cases
      0 -> Left !(array2 nat Decoder.boolean)
      1 -> Right !Decoder.text
      t ->
        use Text ++
        Decoder.fail ("unknown tag: " ++ Nat.toText t))
> Decoder.run d "{ \"tag\" : 0, \"value\" : [1, true] }"
---
 (unison
      (term_declaration
        (term_definition
          (wordy_id)
          (kw_equals)
          (use_clause
            (use)
            (namespace)
            (wordy_id))
          (function_application
            (wordy_id)
            (literal_text)
            (wordy_id)
            (literal_text)
            (tuple_or_parenthesized
              (cases)
              (pattern
                (nat)
                (arrow_symbol)
                (function_application
                  (wordy_id)
                  (bang
                    (tuple_or_parenthesized
                      (function_application
                        (wordy_id)
                        (function_application
                          (wordy_id)
                          (path)
                          (wordy_id)))))))
              (pattern
                (nat)
                (arrow_symbol)
                (function_application
                  (wordy_id)
                  (bang
                    (path)
                    (wordy_id))))
              (pattern
                (constructor_or_variable_pattern
                  (wordy_id))
                (arrow_symbol)
                (use_clause
                  (use)
                  (namespace)
                  (operator))
                (function_application
                  (path)
                  (wordy_id)
                  (tuple_or_parenthesized
                    (function_application
                      (literal_text)
                      (operator)
                      (function_application
                        (path)
                        (wordy_id)
                        (wordy_id))))))))))
      (watch_expression
        (function_application
          (path)
          (wordy_id)
          (function_application
            (wordy_id)
            (literal_text)))))