Elm Exactly
Results / elm /

WideCtorMixedTest

Tags:elm-spec

Checks, in A Standard Definition of Elm?:rule sm-conbindrule dm-conbindrule d-app-conrule d-pat-con

Translated into Lean for the mechanisation of the book: see its Lean translation.

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
A custom type constructor with 60 fields, cycling through `Int`, `Float`,
`Char`, `String` and `Bool`, supports pattern matching, equality and printing.

The test checks:

  - Pattern matches reading fields 23, 24, 55 and 59.
  - `==` against a value built from the same input (`True`) and from a
    different input (`False`).
  - `Debug.log` printing all 60 fields in order.

Results

elm-0.19.1

passran in 67 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
field23: "23s"
field24: True
field55: 1055
field59: False
eq self: True
eq other: False
show: W 1000 1.5 'c' "3s" True 1005 6.5 'h' "8s" False 1010 11.5 'm' "13s" True 1015 16.5 'r' "18s" False 1020 21.5 'w' "23s" True 1025 26.5 'b' "28s" False 1030 31.5 'g' "33s" True 1035 36.5 'l' "38s" False 1040 41.5 'q' "43s" True 1045 46.5 'v' "48s" False 1050 51.5 'a' "53s" True 1055 56.5 'f' "58s" False

elm-0.19.2

passran in 76 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
field23: "23s"
field24: True
field55: 1055
field59: False
eq self: True
eq other: False
show: W 1000 1.5 'c' "3s" True 1005 6.5 'h' "8s" False 1010 11.5 'm' "13s" True 1015 16.5 'r' "18s" False 1020 21.5 'w' "23s" True 1025 26.5 'b' "28s" False 1030 31.5 'g' "33s" True 1035 36.5 'l' "38s" False 1040 41.5 'q' "43s" True 1045 46.5 'v' "48s" False 1050 51.5 'a' "53s" True 1055 56.5 'f' "58s" False

elm-0.19.3

passran in 67 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
show: W 1000 1.5 'c' "3s" True 1005 6.5 'h' "8s" False 1010 11.5 'm' "13s" True 1015 16.5 'r' "18s" False 1020 21.5 'w' "23s" True 1025 26.5 'b' "28s" False 1030 31.5 'g' "33s" True 1035 36.5 'l' "38s" False 1040 41.5 'q' "43s" True 1045 46.5 'v' "48s" False 1050 51.5 'a' "53s" True 1055 56.5 'f' "58s" False
eq other: False
eq self: True
field59: False
field55: 1055
field24: True
field23: "23s"

lamdera-1.5.0

passran in 67 ms
Output
show: W 1000 1.5 'c' "3s" True 1005 6.5 'h' "8s" False 1010 11.5 'm' "13s" True 1015 16.5 'r' "18s" False 1020 21.5 'w' "23s" True 1025 26.5 'b' "28s" False 1030 31.5 'g' "33s" True 1035 36.5 'l' "38s" False 1040 41.5 'q' "43s" True 1045 46.5 'v' "48s" False 1050 51.5 'a' "53s" True 1055 56.5 'f' "58s" False
eq other: False
eq self: True
field59: False
field55: 1055
field24: True
field23: "23s"

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm/WideCtorMixedTest] in its title.

Source

The -- CHECK: lines give the expected output.

module WideCtorMixedTest exposing (main)
{-| A custom type constructor with 60 fields, cycling through `Int`, `Float`,
`Char`, `String` and `Bool`, supports pattern matching, equality and printing.
The test checks:
- Pattern matches reading fields 23, 24, 55 and 59.
- `==` against a value built from the same input (`True`) and from a
different input (`False`).
- `Debug.log` printing all 60 fields in order.
-}
-- TAGS: elm-spec, sm-conbind, dm-conbind, d-app-con, d-pat-con
-- CHECK: field23: "23s"
-- CHECK: field24: True
-- CHECK: field55: 1055
-- CHECK: field59: False
-- CHECK: eq self: True
-- CHECK: eq other: False
-- CHECK: show: W 1000 1.5 'c' "3s" True 1005 6.5 'h' "8s" False 1010 11.5 'm' "13s" True 1015 16.5 'r' "18s" False 1020 21.5 'w' "23s" True 1025 26.5 'b' "28s" False 1030 31.5 'g' "33s" True 1035 36.5 'l' "38s" False 1040 41.5 'q' "43s" True 1045 46.5 'v' "48s" False 1050 51.5 'a' "53s" True 1055 56.5 'f' "58s" False
import Html exposing (text)
type W
= W Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool Int Float Char String Bool
make : Int -> W
make base =
W (base + 999) (toFloat base + 1.5 - 1) ((if base == 1 then 'c' else '?')) ((if base == 1 then "3s" else "?")) (modBy 2 (base + 3) == 0) (base + 1004) (toFloat base + 6.5 - 1) ((if base == 1 then 'h' else '?')) ((if base == 1 then "8s" else "?")) (modBy 2 (base + 8) == 0) (base + 1009) (toFloat base + 11.5 - 1) ((if base == 1 then 'm' else '?')) ((if base == 1 then "13s" else "?")) (modBy 2 (base + 13) == 0) (base + 1014) (toFloat base + 16.5 - 1) ((if base == 1 then 'r' else '?')) ((if base == 1 then "18s" else "?")) (modBy 2 (base + 18) == 0) (base + 1019) (toFloat base + 21.5 - 1) ((if base == 1 then 'w' else '?')) ((if base == 1 then "23s" else "?")) (modBy 2 (base + 23) == 0) (base + 1024) (toFloat base + 26.5 - 1) ((if base == 1 then 'b' else '?')) ((if base == 1 then "28s" else "?")) (modBy 2 (base + 28) == 0) (base + 1029) (toFloat base + 31.5 - 1) ((if base == 1 then 'g' else '?')) ((if base == 1 then "33s" else "?")) (modBy 2 (base + 33) == 0) (base + 1034) (toFloat base + 36.5 - 1) ((if base == 1 then 'l' else '?')) ((if base == 1 then "38s" else "?")) (modBy 2 (base + 38) == 0) (base + 1039) (toFloat base + 41.5 - 1) ((if base == 1 then 'q' else '?')) ((if base == 1 then "43s" else "?")) (modBy 2 (base + 43) == 0) (base + 1044) (toFloat base + 46.5 - 1) ((if base == 1 then 'v' else '?')) ((if base == 1 then "48s" else "?")) (modBy 2 (base + 48) == 0) (base + 1049) (toFloat base + 51.5 - 1) ((if base == 1 then 'a' else '?')) ((if base == 1 then "53s" else "?")) (modBy 2 (base + 53) == 0) (base + 1054) (toFloat base + 56.5 - 1) ((if base == 1 then 'f' else '?')) ((if base == 1 then "58s" else "?")) (modBy 2 (base + 58) == 0)
get23 : W -> String
get23 w =
case w of
W x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 ->
x23
get24 : W -> Bool
get24 w =
case w of
W x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 ->
x24
get55 : W -> Int
get55 w =
case w of
W x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 ->
x55
get59 : W -> Bool
get59 w =
case w of
W x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42 x43 x44 x45 x46 x47 x48 x49 x50 x51 x52 x53 x54 x55 x56 x57 x58 x59 ->
x59
main =
let
base =
1 + (Char.toCode 'b' - Char.toCode 'a') - 1
w =
make base
_ =
Debug.log "field23" (get23 w)
_ =
Debug.log "field24" (get24 w)
_ =
Debug.log "field55" (get55 w)
_ =
Debug.log "field59" (get59 w)
_ =
Debug.log "eq self" (w == make base)
_ =
Debug.log "eq other" (w == make (base + 1))
_ =
Debug.log "show" (w)
in
text "done"

Lean translation

This program is translated into Lean by the translator of the Lean mechanisation of A Standard Definition of Elm?: the program it is, its modules in the reduced syntax of Chapter 7 with every integer constant at Int or Float by number specialisation, and its CHECK lines as written (g_elm_WideCtorMixedTest, in StandardElmMech/Generated/Elm_TailRecT.lean). Lean's evaluator runs the program by the rules of Chapters 7 and 9, and its checks become one generated theorem: some derivation of the program has a log that meets every check, or, for a test that stops at Debug.todo, the program has no meaning.

CheckExpected (CHECK)Lean evaluatorProved by
field23"23s""23s"t_elm_WideCtorMixedTest
field24TrueTruet_elm_WideCtorMixedTest
field5510551055t_elm_WideCtorMixedTest
field59FalseFalset_elm_WideCtorMixedTest
eq selfTrueTruet_elm_WideCtorMixedTest
eq otherFalseFalset_elm_WideCtorMixedTest
showW 1000 1.5 'c' "3s" True 1005 6.5 'h' "8s" False 1010 11.5 'm' "13s" True 1015 16.5 'r' "18s" False 1020 21.5 'w' "23s" True 1025 26.5 'b' "28s" False 1030 31.5 'g' "33s" True 1035 36.5 'l' "38s" False 1040 41.5 'q' "43s" True 1045 46.5 'v' "48s" False 1050 51.5 'a' "53s" True 1055 56.5 'f' "58s" FalseW 1000 1.5 'c' "3s" True 1005 6.5 'h' "8s" False 1010 11.5 'm' "13s" True 1015 16.5 'r' "18s" False 1020 21.5 'w' "23s" True 1025 26.5 'b' "28s" False 1030 31.5 'g' "33s" True 1035 36.5 'l' "38s" False 1040 41.5 'q' "43s" True 1045 46.5 'v' "48s" False 1050 51.5 'a' "53s" True 1055 56.5 'f' "58s" Falset_elm_WideCtorMixedTest
/-- tests/elm/src/WideCtorMixedTest.elm -/
def g_elm_WideCtorMixedTest : Program := {
  name := "WideCtorMixedTest", source := "tests/elm/src",
  exposing := (.items [.var "main"]), imports := [⟨"Html", "Html", some (.items [.var "text"])⟩],
  types := [("W", [("W", 60)])],
  aliases := [],
  defs := [
    .fn "make" [pv "base"] (ap (c "W") [.atexp (.paren (bin "+" (v "base") (i 999))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 15 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'c')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "3s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 3)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1004))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 65 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'h')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "8s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 8)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1009))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 115 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'm')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "13s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 13)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1014))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 165 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'r')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "18s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 18)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1019))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 215 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'w')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "23s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 23)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1024))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 265 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'b')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "28s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 28)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1029))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 315 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'g')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "33s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 33)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1034))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 365 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'l')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "38s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 38)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1039))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 415 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'q')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "43s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 43)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1044))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 465 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'v')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "48s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 48)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1049))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 515 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'a')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "53s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 53)))]) (i 0))), .atexp (.paren (bin "+" (v "base") (i 1054))), .atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "base"]) (.atexp (.scon (.float 565 (-1))))) (.atexp (.scon (.intF 1))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (.atexp (chA 'f')) (.atexp (chA '?')))))), .atexp (.paren (.atexp (.paren (ifte (bin "==" (v "base") (i 1)) (str "58s") (str "?"))))), .atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "base") (i 58)))]) (i 0)))]),
    .fn "get23" [pv "w"] (caseOf (v "w") [(pcon "W" [pv "x0", pv "x1", pv "x2", pv "x3", pv "x4", pv "x5", pv "x6", pv "x7", pv "x8", pv "x9", pv "x10", pv "x11", pv "x12", pv "x13", pv "x14", pv "x15", pv "x16", pv "x17", pv "x18", pv "x19", pv "x20", pv "x21", pv "x22", pv "x23", pv "x24", pv "x25", pv "x26", pv "x27", pv "x28", pv "x29", pv "x30", pv "x31", pv "x32", pv "x33", pv "x34", pv "x35", pv "x36", pv "x37", pv "x38", pv "x39", pv "x40", pv "x41", pv "x42", pv "x43", pv "x44", pv "x45", pv "x46", pv "x47", pv "x48", pv "x49", pv "x50", pv "x51", pv "x52", pv "x53", pv "x54", pv "x55", pv "x56", pv "x57", pv "x58", pv "x59"], v "x23")]),
    .fn "get24" [pv "w"] (caseOf (v "w") [(pcon "W" [pv "x0", pv "x1", pv "x2", pv "x3", pv "x4", pv "x5", pv "x6", pv "x7", pv "x8", pv "x9", pv "x10", pv "x11", pv "x12", pv "x13", pv "x14", pv "x15", pv "x16", pv "x17", pv "x18", pv "x19", pv "x20", pv "x21", pv "x22", pv "x23", pv "x24", pv "x25", pv "x26", pv "x27", pv "x28", pv "x29", pv "x30", pv "x31", pv "x32", pv "x33", pv "x34", pv "x35", pv "x36", pv "x37", pv "x38", pv "x39", pv "x40", pv "x41", pv "x42", pv "x43", pv "x44", pv "x45", pv "x46", pv "x47", pv "x48", pv "x49", pv "x50", pv "x51", pv "x52", pv "x53", pv "x54", pv "x55", pv "x56", pv "x57", pv "x58", pv "x59"], v "x24")]),
    .fn "get55" [pv "w"] (caseOf (v "w") [(pcon "W" [pv "x0", pv "x1", pv "x2", pv "x3", pv "x4", pv "x5", pv "x6", pv "x7", pv "x8", pv "x9", pv "x10", pv "x11", pv "x12", pv "x13", pv "x14", pv "x15", pv "x16", pv "x17", pv "x18", pv "x19", pv "x20", pv "x21", pv "x22", pv "x23", pv "x24", pv "x25", pv "x26", pv "x27", pv "x28", pv "x29", pv "x30", pv "x31", pv "x32", pv "x33", pv "x34", pv "x35", pv "x36", pv "x37", pv "x38", pv "x39", pv "x40", pv "x41", pv "x42", pv "x43", pv "x44", pv "x45", pv "x46", pv "x47", pv "x48", pv "x49", pv "x50", pv "x51", pv "x52", pv "x53", pv "x54", pv "x55", pv "x56", pv "x57", pv "x58", pv "x59"], v "x55")]),
    .fn "get59" [pv "w"] (caseOf (v "w") [(pcon "W" [pv "x0", pv "x1", pv "x2", pv "x3", pv "x4", pv "x5", pv "x6", pv "x7", pv "x8", pv "x9", pv "x10", pv "x11", pv "x12", pv "x13", pv "x14", pv "x15", pv "x16", pv "x17", pv "x18", pv "x19", pv "x20", pv "x21", pv "x22", pv "x23", pv "x24", pv "x25", pv "x26", pv "x27", pv "x28", pv "x29", pv "x30", pv "x31", pv "x32", pv "x33", pv "x34", pv "x35", pv "x36", pv "x37", pv "x38", pv "x39", pv "x40", pv "x41", pv "x42", pv "x43", pv "x44", pv "x45", pv "x46", pv "x47", pv "x48", pv "x49", pv "x50", pv "x51", pv "x52", pv "x53", pv "x54", pv "x55", pv "x56", pv "x57", pv "x58", pv "x59"], v "x59")]),
    .fn "main" [] (letDefs [.fn "base" [] (bin "-" (bin "+" (i 1) (.atexp (.paren (bin "-" (ap (qv "Char" "toCode") [.atexp (chA 'b')]) (ap (qv "Char" "toCode") [.atexp (chA 'a')]))))) (i 1)), .fn "w" [] (ap (v "make") [v "base"]), .pat pw (ap (qv "Debug" "log") [str "field23", .atexp (.paren (ap (v "get23") [v "w"]))]), .pat pw (ap (qv "Debug" "log") [str "field24", .atexp (.paren (ap (v "get24") [v "w"]))]), .pat pw (ap (qv "Debug" "log") [str "field55", .atexp (.paren (ap (v "get55") [v "w"]))]), .pat pw (ap (qv "Debug" "log") [str "field59", .atexp (.paren (ap (v "get59") [v "w"]))]), .pat pw (ap (qv "Debug" "log") [str "eq self", .atexp (.paren (bin "==" (v "w") (ap (v "make") [v "base"])))]), .pat pw (ap (qv "Debug" "log") [str "eq other", .atexp (.paren (bin "==" (v "w") (ap (v "make") [.atexp (.paren (bin "+" (v "base") (i 1)))])))]), .pat pw (ap (qv "Debug" "log") [str "show", .atexp (.paren (v "w"))])] (ap (v "text") [str "done"])) ],
  checks := [
    chk .check "field23: \"23s\"" .string,
    chk .check "field24: True" .data,
    chk .check "field55: 1055" .int,
    chk .check "field59: False" .data,
    chk .check "eq self: True" .data,
    chk .check "eq other: False" .data,
    chk .check "show: W 1000 1.5 'c' \"3s\" True 1005 6.5 'h' \"8s\" False 1010 11.5 'm' \"13s\" True 1015 16.5 'r' \"18s\" False 1020 21.5 'w' \"23s\" True 1025 26.5 'b' \"28s\" False 1030 31.5 'g' \"33s\" True 1035 36.5 'l' \"38s\" False 1040 41.5 'q' \"43s\" True 1045 46.5 'v' \"48s\" False 1050 51.5 'a' \"53s\" True 1055 56.5 'f' \"58s\" False" .data ] }

Reading the translation: v "x" is the variable x, c "K" the constructor K, i 42 the integer 42 at Int, .scon (.intF 2) the integer 2 at Float, and str "s" a string; ap f [a, b] applies f to a and then b, and bin "+" a b is a + b. lams, caseOf, ifte, listE, tup2 and recE build lambdas, case, if, lists, pairs and records by the book's derived forms; pv, pw and pcon are variable, wildcard and constructor patterns. defs are the program's top-level definitions and locals the other declarations of main's let, placed in a let around each check; ckk label value kind exp is one check. A name with $ (incF$Float) is a copy number specialisation made.

Static semantics (Chapters 4, 5 and 9): legal_elm_WideCtorMixedTest states that the program as written is legal, with no hypothesis: the proved inference W gives each module a principal derivation, which meets the syntactic restrictions and the further restrictions, with a type of main Chapter 9 allows. End to end: spec_elm_WideCtorMixedTest states that Lean computes the reduced program above from the source (derived forms, inference, the proved checker, number specialisation, type erasure), so the theorems about it do not trust the translator's elaboration ([elab]); mean_elm_WideCtorMixedTest states that the program has a meaning by r:p-program, with both premises, and ident_elm_WideCtorMixedTest that its specialisation is unique and is the reduced program above, both with no hypothesis about principality. One of these theorems is proved by native_decide ([native]).