All Projects → polytypic → f-omega-mu

polytypic / f-omega-mu

Licence: MIT license
Fωμ type checker and compiler

Programming Languages

ocaml
1615 projects
shell
77523 projects

Projects that are alternatives of or similar to f-omega-mu

tix
[WIP] A type system for nix
Stars: ✭ 59 (+28.26%)
Mutual labels:  wip, type-system
wip
WIP & naenae: CLI utilities to easily manage Work In Progress with Git
Stars: ✭ 46 (+0%)
Mutual labels:  wip
Glass
Gui Library written in Crystal
Stars: ✭ 24 (-47.83%)
Mutual labels:  wip
layout
Graph layouting package
Stars: ✭ 19 (-58.7%)
Mutual labels:  wip
Bear-Blog-Engine
Modern blog engine made with Go and the Next.js framework
Stars: ✭ 23 (-50%)
Mutual labels:  wip
laravel-saas
📧 💵 Email activation, two-factor authentication, subscription billing, team billing, API token authentication, admin user impersonation and more.
Stars: ✭ 19 (-58.7%)
Mutual labels:  wip
rtl-everywhere
[WIP] React Testing Library everywhere
Stars: ✭ 27 (-41.3%)
Mutual labels:  wip
prometheus to clickhouse
Prometheus to Clickhouse Adapter
Stars: ✭ 14 (-69.57%)
Mutual labels:  wip
torrent
Bittorrent library implemented in pure Dart. [WIP, early development stage]
Stars: ✭ 26 (-43.48%)
Mutual labels:  wip
OpenFNaF
An Open Source Re-implementation of Scott Cawthon's Five Nights at Freddy's. Written in C. Licensed under MIT. (WiP)
Stars: ✭ 37 (-19.57%)
Mutual labels:  wip
ronin-exploits
A Ruby micro-framework for writing and running exploits
Stars: ✭ 36 (-21.74%)
Mutual labels:  wip
ng-leaflet
Angular 2 component for Leaflet 1.x (WIP - Help Wanted)
Stars: ✭ 16 (-65.22%)
Mutual labels:  wip
AminoREAPI
📱 An unofficial (and reversed enginnered!) client library for http://aminoapps.com/
Stars: ✭ 34 (-26.09%)
Mutual labels:  wip
VSCode-Bedrock-Development-Extension
An extension that provides support for files such as: .mcfunction, .json and .lang. Features include: completion, validations, formatters, diagnostics, cheat-sheets, code-actions, generation of files, and development tools to help develop Minecraft Bedrock Addons or Minecraft Education Edition.
Stars: ✭ 45 (-2.17%)
Mutual labels:  wip
diamond drops
WIP on sharding and Ethereum 2.0 with enshrined-in-consensus data availability and Rust: a fast, safe, concurrent and practical programming language
Stars: ✭ 54 (+17.39%)
Mutual labels:  wip
tnt
A 2d Game Engine written in C++20.
Stars: ✭ 30 (-34.78%)
Mutual labels:  wip
discord.v
Discord Bot Framework written in V
Stars: ✭ 83 (+80.43%)
Mutual labels:  wip
rust os
My hobby operating system microkernel written in Rust
Stars: ✭ 33 (-28.26%)
Mutual labels:  hobby-project
snk.dev-assistant
Assistant for code development with advanced machine learning features
Stars: ✭ 14 (-69.57%)
Mutual labels:  wip
dist-detect
Try to determine what Linux/Unix distribution is running on a remote host and get a hint if security updates are applied.
Stars: ✭ 14 (-69.57%)
Mutual labels:  wip

Fωμ type checker and compiler

A type checker and compiler (*, *) for Fωμ restricted to non-nested types (*). This Fωμ variant has

  • structural sum and product types (*, *),
  • join and meet type operators (*),
  • equirecursive types (*, *),
  • higher-kinded types (*), including type level lambdas and kind inference (*),
  • impredicative universal and existential types (*),
  • structural subtyping (*, *),
  • decidable type checking, and
  • phase separation.

These features make Fωμ relatively well-behaved as well as expressive (*, *, *) and also allow a compiler to make good use of untyped compilation targets (*, *) such as JavaScript.

Although this is ultimately really intended to serve as an intermediate language or elaboration target, the implementation provides both a fairly minimalistic AST and a somewhat more programmer friendly syntax with some convenience features that are elaborated into the AST.

The implementation also supports dividing a program into multiple files via an import mechanism for types and values and an include mechanism for type definitions. Value imports can be separately compiled. HTTP URLs and relative paths are allowed as references.

Please note that this is a hobby project and still very much Work-in-Progress with tons of missing features, such as

and probably more bugs than one could imagine.

Next steps

Background

This Fωμ variant is basically a generalization of the type system for Fωμ*, that is Fωμ restricted to first-order recursive types of kind *, described in the article

System F-omega with Equirecursive Types for Datatype-generic Programming
by Yufei Cai, Paolo G. Giarrusso, and Klaus Ostermann.

While Fωμ* is powerful enough to express regular datatypes, it requires type parameters to be hoisted outside of the μ. For example, the list type

μlist.λα.opt (α, list α)

needs to be rewritten as

λα.μlist_1.opt (α, list_1)

Both of the above types are allowed by this generalized system and are also considered equivalent as shown in this example.

In this generalized system, nested types are not allowed. For example,

μnested.λα.(α, nested (α, α))

is disallowed due to the argument (α, α) as demonstrated in this example.

Disallowing nested types is sufficient to keep the number of distinct subtrees finite in the infinite expansions of recursive types and to keep type equivalence decidable.

Fortunately, as conjectured in

Do we need nested datatypes?
by Stephanie Weirich

many uses of nested datatypes can also be encoded using e.g. GADTs and Fωμ is powerful enough to encode many GADTs. Consider, however, the higher-kinded nested type

λf.μloop.λx.(x, loop (f x))

that, when given an f and an x, would expand to the infinite tree

(x,
 (f x,
  (f (f x),
   (f (f (f x)),
    ...))))

illustrating a process of unbounded computation where x could be higher-rank and encode arbitrary data. It would seem that this kind of recursion pattern would allow simulating arbitrary computations, which would seem to make type equality undecidable. Thus, it would seem that disallowing nested types is not only sufficient, but also necessary to keep type equivalence decidable in the general case.

Why?

Greg Morrisett has called Fω "the workhorse of modern compilers". Fωμ adds equirecursive types to Fω bringing it closer to practical programming languages.

Typed λ-calculi, and System F in particular, are popular elaboration targets for programming languages. Here are a couple of papers using such an approach:

1ML — core and modules united
Andreas Rossberg
Elaborating Intersection and Union Types
Jana Dunfield

Perhaps a practical System Fωμ implementation could serve as a reusable building block or as a forkable boilerplate when exploring such programming language designs.

Here are a couple of papers about using a Fωμ variant as an IR:

Unraveling Recursion: Compiling an IR with Recursion to System F
Michael Peyton Jones, Vasilis Gkoumas, Roman Kireev, Kenneth MacKenzie, Chad Nester, and Philip Wadler
System F in Agda, for fun and profit
James Chapman, Roman Kireev, Chad Nester, and Philip Wadler

System Fω might also be a good language for teaching functional programming and make an interesting object of study on its own:

Lambda: the ultimate sublanguage (experience report)
Jeremy Yallop, Leo White
System Fω interpreter for use in Advanced Functional Programming course
Breaking Through the Normalization Barrier: A Self-Interpreter for F-omega
Matt Brown, Jens Palsberg
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].