Open brendanzab opened 2 years ago
I was looking into restricting fathom to only allow us to talk about “small types” (The Little Typer does this in its Pie language). I was running into issues with unification introducing Type
s however.
I think that we could introduce a restricted universe hierarchy with just a universe of small types (Type
), and a universe of large types (Type 1
). This is what XML does (a core language for SML by Harper and Mitchell). 1ML does something similar (but has not dependent types). As in Idris there would be no syntax to introduce Type 1
universes, but we also would not attempt to ‘solve’ universe levels to keep things simpler. Formats would be considered ‘large types’ (as they can contain types). I also think records should only be permitted to contain small types for the time being for simplicity. I’ve implemented a simple approach to checking universes in wip-compile-stratify/Core.ml.
Currently Fathom implements
Type : Type
. This is a common approach for making prototype implementations of dependently typed languages, but it's far too expressive for a binary data description language. It also introduces well-known paradoxes that can lead to non-termination. Instead we should only ever allowType
to appear on the right-hand side of the colon. This could involve adding acheck_type
function to the elaborator:Similarly it might also make sense to remove the
Format : Type
rule, instead checking thatFormat
is a type in thecheck_type
function. This prevent us from defining binary formats that describe other binary formats, but these are probably exceedingly rare, and it's probably good to be more conservative at this point.