Open
Description
Fathom currently has anonymous product types (records), but no (convenient) way of expressing sum types.
Potential solutions
- Do nothing. Encode sum types as dependent records (eg
let Option : Type -> Type = fun T => {tag : Bool, value : if tag then T else {}
) - Anonymous sum types, dual to records: (eg
let Option : Type -> Type = fun T => sum {None : {}, Some : T}
) - Algebraic data types a la Haskell, ML, Rust etc
- Polymorphic variants
Design considerations
- Are they ergonomic to use?
- Can they express recursion?
- Can they be compiled efficiently?
- Nominal or structural?
- Row polymorphism?
- First class labels?
Prior Art
- (Generalized) Algebraic data types: Haskell, Agda, Coq, Idris, Ocaml
- Anonymous sum types: Haskell, Dhall
- Polymorphic variants: Ocaml
Metadata
Metadata
Assignees
Labels
No labels