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

Remove Type-in-Type #316

Open
brendanzab opened this issue Mar 25, 2022 · 1 comment
Open

Remove Type-in-Type #316

brendanzab opened this issue Mar 25, 2022 · 1 comment

Comments

@brendanzab
Copy link
Member

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 allow Type to appear on the right-hand side of the colon. This could involve adding a check_type function to the elaborator:

pub fn check_type(&mut self, surface_term: &Term<'_, ByteRange>) -> core::Term<'arena> {
    ...
}

Similarly it might also make sense to remove the Format : Type rule, instead checking that Format is a type in the check_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.

@brendanzab
Copy link
Member Author

brendanzab commented Nov 29, 2022

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 Types 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant