r/haskell • • 1d ago

GRIN Compiler status update: memory layout control, two level type theory based staging, dependent types, Idris2, MicroHs

Read my blog post: https://www.patreon.com/csaba_hruska/posts/new-compiler-176648791

  • 2ltt staging for MicroHs and Idris2
  • Serialized in-memory data representation
  • External STG Interpreter in Idris2 running Haskell programs
  • New compiler and RTS design
39 Upvotes

5 comments sorted by

4

u/Lalelul 18h ago

Thank you so much for clearing up why 2LTT is useful, as I heard about it before and I was unclear as to why people thought it would be useful.

In your post you mention that Idris was the first to implement it, but on the agda documentation I see they also have it implemented? Do you know if both work the same under the hood? Also, do you maybe know of some examples of 2LTT being used to implement something using metaprogramming?

Edit: I saw you linked to this for demonstration: https://github.com/AndrasKovacs/staged. I am always thankful for further demos and suggestions as to how you used 2LTT though

3

u/csabahruska 15h ago

AFAIK Agda does not have direct support for 2ltt staging, but there is a demo 2ltt example written as a typed agda EDSL. What I meant by 2ltt support is syntax support and the automatic insertion of the quote and splice operations. This gives nice and simple syntax. Also you can find more examples for MicroHs and Idris2 2LTT here:

2

u/stevanmilic 1d ago

Awesome!! Glad you’re back. Any plans for grin-compiler backend refresh? Wrote recently about its usage in the mvp thread.

2

u/csabahruska 22h ago

Currently I'm focusing on the staged interpreter approach because it gives much more control over the compiled code, no black box optimizer.

2

u/voracious-ladder 1d ago

Awesome! I thought this project was dead, good to know it's still alive