External STG interpreter in Idris2, two level type theory based staging for Haskell
Hello! I'd like to show you an Idris2 port of my external stg interpreter that can run GHC compiled programs, now on Idris2. Also there is working two level type theory based staged metaprogramming support for MicroHs and Idris2 that can change software design. I've written a blog post about these, please read it if you are interested. You can find links to source code in my blog post: https://www.patreon.com/csaba_hruska/posts/new-compiler-176648791 Best regards, Csaba
Hello, Thanks for sharing, this looks extremely exciting. I'm glad to see that the ideas of GRIN are still floating around and that the Haskell-ish design space isn't entirely constrained by GHC's decisions. Two questions that don't appear obvious from someone with only a passing familiarity with Idris: How complicated would you describe the Gibbon and 2LTT implementations in Idris as being? (As compared to the master branch of MicroHs or the boostrapping core of Idris for example?) Would combining the Gibbon and 2LTT additions be a fairly simple composition of the two or much more involved? In my eyes a language that can express fine grained layout control with staged metaprogramming is a true holy grail, particularly if it comes in the guise of a relatively natural dependently typed style. I will be eagerly anticipating any further developements should they appear. -- Cheers, Thomas Ulmer
Hello, Gibbon is the name of the full compiler, while the interesting part of that is the Location Calculus intermediate representation which the LoCal paper describes. It took a couple iterations to explore the design space, but eventually it was quite straightforward to implement LoCal in Idris2 as an embedded domain specific language. And yes, the LoCal EDSL is compatible with 2ltt staging, but i have not tried it yet, but it is planned. Regarding the 2ltt implementations in MicroHs and Idris2 I can not say anything about the implementation complexity, because it was Claude Fable that did the implementation based on Andras Kovacs's staged demo and the corresponding papers. But in theory it should be simple because one of my colleagues has a full and self contained implementation (with zero dependency) of a dep. typed language with 2ltt staging support under 1000 SLOC in Haskell. (including the parser and type checker and reducer) Cheers, Csaba Hruska On Sat, Nov 28, 2026 at 9:40 PM Thomas Ulmer <tmu@tccq.net> wrote:
Hello,
Thanks for sharing, this looks extremely exciting. I'm glad to see that the ideas of GRIN are still floating around and that the Haskell-ish design space isn't entirely constrained by GHC's decisions.
Two questions that don't appear obvious from someone with only a passing familiarity with Idris:
How complicated would you describe the Gibbon and 2LTT implementations in Idris as being? (As compared to the master branch of MicroHs or the boostrapping core of Idris for example?)
Would combining the Gibbon and 2LTT additions be a fairly simple composition of the two or much more involved? In my eyes a language that can express fine grained layout control with staged metaprogramming is a true holy grail, particularly if it comes in the guise of a relatively natural dependently typed style.
I will be eagerly anticipating any further developements should they appear.
-- Cheers, Thomas Ulmer
participants (2)
-
Csaba Hruska -
Thomas Ulmer