Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructors === id #256

Merged
merged 6 commits into from Nov 21, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 6 additions & 10 deletions standard/semantics.md
Expand Up @@ -2796,25 +2796,21 @@ union literal:
merge t₀ u₀ ⇥ merge t₁ u₁


`constructors` converts a union type literal to a record of constructors for
each alternative:
`[DEPRECATED]` Union construction should be done through the `.` operator.
`constructors` is equivalent to the identity operation and thus, returns
the union type:


u<>
t₀t₁
────────────────────
constructors u ⇥ {=}


u ⇥ < x₀ : T₀ | x₁ : T₁ | xs… >
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
constructors u ⇥ { x₀ = λ(x₀ : T₀) → < x₀ = x₀ | x₁ : T₁ | xs… >, x₁ = λ(x₁ : T₁) → < x₀ : T₀ | x₁ = x₁ | xs… >, … }
constructors t₀ ⇥ t₁


u₀ ⇥ u₁
───────────────────────────────── ; If no other rule matches
constructors u₀ ⇥ constructors u₁

You can also project out a union constructor to a function to the union literal:
You can project out a union constructor to a function to the union literal:


u ⇥ < x₀ : T₀ | x₁ : T₁ | xs… >
Expand Down