emdash / udlang

A practical, functional language for stream processing.
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Some ideas on type-theory. #12

Open emdash opened 3 years ago

emdash commented 3 years ago

Note What follows may be completely bogus! I wrote it late at night, and have moved it here so as not to lose it in case it ends up being useful, but it definitely does not belong in the code.

basic type is the "value set"

List and Map are implicitly List<Any>, Map<Any>, so we can model them as primitive values.

Two ways to define a primitive value set: explicit: {a, b, c} implicit, with predicate: {x: Int | 0 < x and x < a}, {x: String | x.startswith("x")}

higher kinded types: types can be bound to names with typedef type-level functions: take type arguments, return a type constructor x: [Int] => x: {x: List | i: Int for i in x}

all types model a set of values record types are just a set of "fields", same runtime representation as map. record types can be widened with +, extension syntax is just sugar for this. record types can have methods defined on them, these are compiled and resolved statically.