Elm Exactly
Results / elm /

WideRecordDecoder70Test

Tags:elm-spec

Checks, in A Standard Definition of Elm?:rule sm-typbind-recordrule dm-typbindrule d-app-basic-partialrule d-app-basic-apply

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 70-field record alias, used as a constructor function, can be filled in one
argument at a time by an `andMap` pipeline over `Maybe`.

`andMap` is defined here and applies a `Just` function to a `Just` argument. The
fields cycle through `Int`, `Float`, `Char`, `String` and `Bool`, and the test
reads back fields 0, 19, 20, 24, 25, 31, 32, 33, 62, 63, 64 and 69.
The local `mapMaybe` reads each field inside the `Maybe`.

Results

elm-0.19.1

passran in 53 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
f0000: Just 1000
f0019: Just False
f0020: Just 1020
f0024: Just True
f0025: Just 1025
f0031: Just 31.5
f0032: Just 'g'
f0033: Just "33s"
f0062: Just 'k'
f0063: Just "63s"
f0064: Just True
f0069: Just False

elm-0.19.2

passran in 71 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
f0000: Just 1000
f0019: Just False
f0020: Just 1020
f0024: Just True
f0025: Just 1025
f0031: Just 31.5
f0032: Just 'g'
f0033: Just "33s"
f0062: Just 'k'
f0063: Just "63s"
f0064: Just True
f0069: Just False

elm-0.19.3

passran in 66 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
f0069: Just False
f0064: Just True
f0063: Just "63s"
f0062: Just 'k'
f0033: Just "33s"
f0032: Just 'g'
f0031: Just 31.5
f0025: Just 1025
f0024: Just True
f0020: Just 1020
f0019: Just False
f0000: Just 1000

lamdera-1.5.0

passran in 48 ms
Output
f0069: Just False
f0064: Just True
f0063: Just "63s"
f0062: Just 'k'
f0033: Just "33s"
f0032: Just 'g'
f0031: Just 31.5
f0025: Just 1025
f0024: Just True
f0020: Just 1020
f0019: Just False
f0000: Just 1000

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module WideRecordDecoder70Test exposing (main)
{-| A 70-field record alias, used as a constructor function, can be filled in one
argument at a time by an `andMap` pipeline over `Maybe`.
`andMap` is defined here and applies a `Just` function to a `Just` argument. The
fields cycle through `Int`, `Float`, `Char`, `String` and `Bool`, and the test
reads back fields 0, 19, 20, 24, 25, 31, 32, 33, 62, 63, 64 and 69.
The local `mapMaybe` reads each field inside the `Maybe`.
-}
-- TAGS: elm-spec, sm-typbind-record, dm-typbind, d-app-basic-partial, d-app-basic-apply
-- CHECK: f0000: Just 1000
-- CHECK: f0019: Just False
-- CHECK: f0020: Just 1020
-- CHECK: f0024: Just True
-- CHECK: f0025: Just 1025
-- CHECK: f0031: Just 31.5
-- CHECK: f0032: Just 'g'
-- CHECK: f0033: Just "33s"
-- CHECK: f0062: Just 'k'
-- CHECK: f0063: Just "63s"
-- CHECK: f0064: Just True
-- CHECK: f0069: Just False
import Html exposing (text)
type alias R =
{ f0000 : Int
, f0001 : Float
, f0002 : Char
, f0003 : String
, f0004 : Bool
, f0005 : Int
, f0006 : Float
, f0007 : Char
, f0008 : String
, f0009 : Bool
, f0010 : Int
, f0011 : Float
, f0012 : Char
, f0013 : String
, f0014 : Bool
, f0015 : Int
, f0016 : Float
, f0017 : Char
, f0018 : String
, f0019 : Bool
, f0020 : Int
, f0021 : Float
, f0022 : Char
, f0023 : String
, f0024 : Bool
, f0025 : Int
, f0026 : Float
, f0027 : Char
, f0028 : String
, f0029 : Bool
, f0030 : Int
, f0031 : Float
, f0032 : Char
, f0033 : String
, f0034 : Bool
, f0035 : Int
, f0036 : Float
, f0037 : Char
, f0038 : String
, f0039 : Bool
, f0040 : Int
, f0041 : Float
, f0042 : Char
, f0043 : String
, f0044 : Bool
, f0045 : Int
, f0046 : Float
, f0047 : Char
, f0048 : String
, f0049 : Bool
, f0050 : Int
, f0051 : Float
, f0052 : Char
, f0053 : String
, f0054 : Bool
, f0055 : Int
, f0056 : Float
, f0057 : Char
, f0058 : String
, f0059 : Bool
, f0060 : Int
, f0061 : Float
, f0062 : Char
, f0063 : String
, f0064 : Bool
, f0065 : Int
, f0066 : Float
, f0067 : Char
, f0068 : String
, f0069 : Bool
}
andMap : Maybe a -> Maybe (a -> b) -> Maybe b
andMap ma mf =
case ( mf, ma ) of
( Just f, Just a ) ->
Just (f a)
_ ->
Nothing
mapMaybe : (a -> b) -> Maybe a -> Maybe b
mapMaybe f ma =
case ma of
Just a ->
Just (f a)
Nothing ->
Nothing
build : Int -> Maybe R
build b =
Just R
|> andMap (Just (b + 999))
|> andMap (Just (toFloat b + 1.5 - 1))
|> andMap (Just ((if b == 1 then 'c' else '?')))
|> andMap (Just ((if b == 1 then "3s" else "?")))
|> andMap (Just (modBy 2 (b + 3) == 0))
|> andMap (Just (b + 1004))
|> andMap (Just (toFloat b + 6.5 - 1))
|> andMap (Just ((if b == 1 then 'h' else '?')))
|> andMap (Just ((if b == 1 then "8s" else "?")))
|> andMap (Just (modBy 2 (b + 8) == 0))
|> andMap (Just (b + 1009))
|> andMap (Just (toFloat b + 11.5 - 1))
|> andMap (Just ((if b == 1 then 'm' else '?')))
|> andMap (Just ((if b == 1 then "13s" else "?")))
|> andMap (Just (modBy 2 (b + 13) == 0))
|> andMap (Just (b + 1014))
|> andMap (Just (toFloat b + 16.5 - 1))
|> andMap (Just ((if b == 1 then 'r' else '?')))
|> andMap (Just ((if b == 1 then "18s" else "?")))
|> andMap (Just (modBy 2 (b + 18) == 0))
|> andMap (Just (b + 1019))
|> andMap (Just (toFloat b + 21.5 - 1))
|> andMap (Just ((if b == 1 then 'w' else '?')))
|> andMap (Just ((if b == 1 then "23s" else "?")))
|> andMap (Just (modBy 2 (b + 23) == 0))
|> andMap (Just (b + 1024))
|> andMap (Just (toFloat b + 26.5 - 1))
|> andMap (Just ((if b == 1 then 'b' else '?')))
|> andMap (Just ((if b == 1 then "28s" else "?")))
|> andMap (Just (modBy 2 (b + 28) == 0))
|> andMap (Just (b + 1029))
|> andMap (Just (toFloat b + 31.5 - 1))
|> andMap (Just ((if b == 1 then 'g' else '?')))
|> andMap (Just ((if b == 1 then "33s" else "?")))
|> andMap (Just (modBy 2 (b + 33) == 0))
|> andMap (Just (b + 1034))
|> andMap (Just (toFloat b + 36.5 - 1))
|> andMap (Just ((if b == 1 then 'l' else '?')))
|> andMap (Just ((if b == 1 then "38s" else "?")))
|> andMap (Just (modBy 2 (b + 38) == 0))
|> andMap (Just (b + 1039))
|> andMap (Just (toFloat b + 41.5 - 1))
|> andMap (Just ((if b == 1 then 'q' else '?')))
|> andMap (Just ((if b == 1 then "43s" else "?")))
|> andMap (Just (modBy 2 (b + 43) == 0))
|> andMap (Just (b + 1044))
|> andMap (Just (toFloat b + 46.5 - 1))
|> andMap (Just ((if b == 1 then 'v' else '?')))
|> andMap (Just ((if b == 1 then "48s" else "?")))
|> andMap (Just (modBy 2 (b + 48) == 0))
|> andMap (Just (b + 1049))
|> andMap (Just (toFloat b + 51.5 - 1))
|> andMap (Just ((if b == 1 then 'a' else '?')))
|> andMap (Just ((if b == 1 then "53s" else "?")))
|> andMap (Just (modBy 2 (b + 53) == 0))
|> andMap (Just (b + 1054))
|> andMap (Just (toFloat b + 56.5 - 1))
|> andMap (Just ((if b == 1 then 'f' else '?')))
|> andMap (Just ((if b == 1 then "58s" else "?")))
|> andMap (Just (modBy 2 (b + 58) == 0))
|> andMap (Just (b + 1059))
|> andMap (Just (toFloat b + 61.5 - 1))
|> andMap (Just ((if b == 1 then 'k' else '?')))
|> andMap (Just ((if b == 1 then "63s" else "?")))
|> andMap (Just (modBy 2 (b + 63) == 0))
|> andMap (Just (b + 1064))
|> andMap (Just (toFloat b + 66.5 - 1))
|> andMap (Just ((if b == 1 then 'p' else '?')))
|> andMap (Just ((if b == 1 then "68s" else "?")))
|> andMap (Just (modBy 2 (b + 68) == 0))
main =
let
base =
1 + (Char.toCode 'b' - Char.toCode 'a') - 1
r =
build base
_ =
Debug.log "f0000" (mapMaybe .f0000 r)
_ =
Debug.log "f0019" (mapMaybe .f0019 r)
_ =
Debug.log "f0020" (mapMaybe .f0020 r)
_ =
Debug.log "f0024" (mapMaybe .f0024 r)
_ =
Debug.log "f0025" (mapMaybe .f0025 r)
_ =
Debug.log "f0031" (mapMaybe .f0031 r)
_ =
Debug.log "f0032" (mapMaybe .f0032 r)
_ =
Debug.log "f0033" (mapMaybe .f0033 r)
_ =
Debug.log "f0062" (mapMaybe .f0062 r)
_ =
Debug.log "f0063" (mapMaybe .f0063 r)
_ =
Debug.log "f0064" (mapMaybe .f0064 r)
_ =
Debug.log "f0069" (mapMaybe .f0069 r)
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_WideRecordDecoder70Test, 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
f0000Just 1000Just 1000t_elm_WideRecordDecoder70Test
f0019Just FalseJust Falset_elm_WideRecordDecoder70Test
f0020Just 1020Just 1020t_elm_WideRecordDecoder70Test
f0024Just TrueJust Truet_elm_WideRecordDecoder70Test
f0025Just 1025Just 1025t_elm_WideRecordDecoder70Test
f0031Just 31.5Just 31.5t_elm_WideRecordDecoder70Test
f0032Just 'g'Just 'g't_elm_WideRecordDecoder70Test
f0033Just "33s"Just "33s"t_elm_WideRecordDecoder70Test
f0062Just 'k'Just 'k't_elm_WideRecordDecoder70Test
f0063Just "63s"Just "63s"t_elm_WideRecordDecoder70Test
f0064Just TrueJust Truet_elm_WideRecordDecoder70Test
f0069Just FalseJust Falset_elm_WideRecordDecoder70Test
/-- tests/elm/src/WideRecordDecoder70Test.elm -/
def g_elm_WideRecordDecoder70Test : Program := {
  name := "WideRecordDecoder70Test", source := "tests/elm/src",
  exposing := (.items [.var "main"]), imports := [⟨"Html", "Html", some (.items [.var "text"])⟩],
  types := [],
  aliases := [("R", some ["f0000", "f0001", "f0002", "f0003", "f0004", "f0005", "f0006", "f0007", "f0008", "f0009", "f0010", "f0011", "f0012", "f0013", "f0014", "f0015", "f0016", "f0017", "f0018", "f0019", "f0020", "f0021", "f0022", "f0023", "f0024", "f0025", "f0026", "f0027", "f0028", "f0029", "f0030", "f0031", "f0032", "f0033", "f0034", "f0035", "f0036", "f0037", "f0038", "f0039", "f0040", "f0041", "f0042", "f0043", "f0044", "f0045", "f0046", "f0047", "f0048", "f0049", "f0050", "f0051", "f0052", "f0053", "f0054", "f0055", "f0056", "f0057", "f0058", "f0059", "f0060", "f0061", "f0062", "f0063", "f0064", "f0065", "f0066", "f0067", "f0068", "f0069"])],
  defs := [
    .fn "andMap" [pv "ma", pv "mf"] (caseOf (tup2 (v "mf") (v "ma")) [(P (ptup2 (pcon "Just" [pv "f"]) (pcon "Just" [pv "a"])), ap (c "Just") [.atexp (.paren (ap (v "f") [v "a"]))]), (P pw, c "Nothing")]),
    .fn "mapMaybe" [pv "f", pv "ma"] (caseOf (v "ma") [(pcon "Just" [pv "a"], ap (c "Just") [.atexp (.paren (ap (v "f") [v "a"]))]), (P (pcA "Nothing"), c "Nothing")]),
    .fn "build" [pv "b"] (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (bin "|>" (ap (c "Just") [c "R"]) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 999)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 15 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'c')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "3s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 3)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1004)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 65 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'h')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "8s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 8)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1009)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 115 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'm')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "13s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 13)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1014)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 165 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'r')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "18s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 18)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1019)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 215 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'w')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "23s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 23)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1024)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 265 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'b')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "28s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 28)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1029)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 315 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'g')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "33s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 33)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1034)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 365 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'l')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "38s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 38)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1039)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 415 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'q')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "43s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 43)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1044)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 465 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'v')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "48s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 48)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1049)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 515 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'a')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "53s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 53)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1054)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 565 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'f')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "58s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 58)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1059)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 615 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'k')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "63s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 63)))]) (i 0)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "+" (v "b") (i 1064)))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "-" (bin "+" (ap (v "toFloat") [v "b"]) (.atexp (.scon (.float 665 (-1))))) (.atexp (.scon (.intF 1)))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (.atexp (chA 'p')) (.atexp (chA '?'))))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (.atexp (.paren (ifte (bin "==" (v "b") (i 1)) (str "68s") (str "?")))))]))])) (ap (v "andMap") [.atexp (.paren (ap (c "Just") [.atexp (.paren (bin "==" (ap (v "modBy") [i 2, .atexp (.paren (bin "+" (v "b") (i 68)))]) (i 0)))]))])),
    .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 "r" [] (ap (v "build") [v "base"]), .pat pw (ap (qv "Debug" "log") [str "f0000", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0000"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0019", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0019"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0020", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0020"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0024", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0024"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0025", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0025"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0031", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0031"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0032", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0032"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0033", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0033"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0062", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0062"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0063", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0063"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0064", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0064"), v "r"]))]), .pat pw (ap (qv "Debug" "log") [str "f0069", .atexp (.paren (ap (v "mapMaybe") [.atexp (accessor "f0069"), v "r"]))])] (ap (v "text") [str "done"])) ],
  checks := [
    chk .check "f0000: Just 1000" .data,
    chk .check "f0019: Just False" .data,
    chk .check "f0020: Just 1020" .data,
    chk .check "f0024: Just True" .data,
    chk .check "f0025: Just 1025" .data,
    chk .check "f0031: Just 31.5" .data,
    chk .check "f0032: Just 'g'" .data,
    chk .check "f0033: Just \"33s\"" .data,
    chk .check "f0062: Just 'k'" .data,
    chk .check "f0063: Just \"63s\"" .data,
    chk .check "f0064: Just True" .data,
    chk .check "f0069: Just 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_WideRecordDecoder70Test 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_WideRecordDecoder70Test 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_WideRecordDecoder70Test states that the program has a meaning by r:p-program, with both premises, and ident_elm_WideRecordDecoder70Test 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]).