Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Type structures #29

Open
jonhue opened this issue Mar 19, 2021 · 0 comments
Open

Type structures #29

jonhue opened this issue Mar 19, 2021 · 0 comments
Labels
discussion Has not been decided upon yet proposal New proposal for the language spec

Comments

@jonhue
Copy link
Member

jonhue commented Mar 19, 2021

Type structures should allow relating types to values.

A type structure is separated into a formal definition (declaration) and instantiations much like type classes.

A type structure consists of a name, a named list of variables it will be instantiated with, and a list of properties/invariants relating the variables that have to be proven for all instantiations (or, alternatively, assumed to be true).

Each instantiation refers to a concrete type, concrete values for each of the variables, and proofs for all invariants.

Example:

structure Monoid<m>(
  e :: m,
  f :: m -> m -> m
) where
  a :: m. e `f` a = a
  a :: m. a `f` e = a
  a :: m, b :: m, c :: m. (a `f` b) `f` c = a `f` (b `f` c)

It still needs to be investigated whether it's worth including invariants in this definition.

@jonhue jonhue changed the title Type class invariants/properties Type structures Mar 19, 2021
@jonhue jonhue transferred this issue from tony-lang/tony Mar 22, 2021
@jonhue jonhue added discussion Has not been decided upon yet proposal New proposal for the language spec labels Mar 22, 2021
@jonhue jonhue added this to Core Nov 19, 2021
@jonhue jonhue moved this to Todo in Core Nov 19, 2021
@jonhue jonhue moved this from Todo to Discussion in Core Nov 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion Has not been decided upon yet proposal New proposal for the language spec
Projects
Status: Discussion
Development

No branches or pull requests

1 participant