Skip to content

Instantly share code, notes, and snippets.

View AndrasKovacs's full-sized avatar

András Kovács AndrasKovacs

View GitHub Profile
@AndrasKovacs
AndrasKovacs / TwoStageRegion.md
Last active November 13, 2024 09:30
Lightweight region memory management in a two-stage language
@AndrasKovacs
AndrasKovacs / Elaboration.md
Last active November 13, 2024 09:33
Basic setup for formalizing elaboration

Basic setup for formalizing elaboration

First attempts

Elaboration is, broadly speaking, taking user-written syntax and converting it to "core" syntax by filling in missing information and at the same time validating that the input is well-formed.

I haven't been fully happy with formalizations that I previously used, so I make a new attempt here. I focus on a minimal dependently typed case.

@AndrasKovacs
AndrasKovacs / OneBRC.hs
Last active April 30, 2024 18:49
1brc
{-# language
BlockArguments
, CPP
, LambdaCase
, MagicHash
, PatternSynonyms
, Strict
, TypeApplications
@AndrasKovacs
AndrasKovacs / SetoidTTinTT.agda
Last active November 3, 2024 19:20
TT in TT using only induction-induction
{-# OPTIONS --without-K #-}
-- version 1, conversion is indexed over conversion
module IndexedConv where
data Con : Set
data Ty : Con → Set
data Sub : Con → Con → Set
data Tm : ∀ Γ → Ty Γ → Set
data Con~ : Con → Con → Set
{-# language
BlockArguments
, ConstraintKinds
, ImplicitParams
, LambdaCase
, OverloadedStrings
, PatternSynonyms
, Strict
, UnicodeSyntax
#-}
@AndrasKovacs
AndrasKovacs / ZeroCostGC.md
Last active September 18, 2024 04:17
Garbage collection with zero-cost at non-GC time

Garbage collection with zero cost at non-GC time

Every once in a while I investigate low-level backend options for PL-s, although so far I haven't actually written any such backend for my projects. Recently I've been looking at precise garbage collection in popular backends, and I've been (like on previous occasions) annoyed by limitations and compromises.

I was compelled to think about a system which accommodates precise relocating GC as much as possible. In one extreme configuration, described in this note, there

@AndrasKovacs
AndrasKovacs / HOASOnly.hs
Last active August 23, 2024 00:18
HOAS-only lambda calculus
{-# language BlockArguments, LambdaCase, Strict, UnicodeSyntax #-}
{-|
Minimal dependent lambda caluclus with:
- HOAS-only representation
- Lossless printing
- Bidirectional checking
- Efficient evaluation & conversion checking
Inspired by https://gist.github.com/Hirrolot/27e6b02a051df333811a23b97c375196
@AndrasKovacs
AndrasKovacs / TTinTTasSetoid.agda
Last active November 3, 2024 21:24
TT in TT using Prop + setoid fibrations
{-# OPTIONS --prop --without-K --show-irrelevant --safe #-}
{-
Challenge:
- Define a deeply embedded faithfully represented syntax of a dependently typed
TT in Agda.
- Use an Agda fragment which has canonicity. This means that the combination of
indexed inductive types & cubical equality is not allowed!
- Prove consistency.
@AndrasKovacs
AndrasKovacs / HIIRT.md
Last active October 2, 2024 09:25
Higher induction-induction-recursion

Inductive-Recursive Types, Generally

I write about inductive-recursive types here. "Generally" means "higher inductive-inductive-recursive" or "quotient inductive-inductive-recursive". This may sound quite gnarly, but fortunately the specification of signatures can be given with just a few type formers in an appropriate framework.

In particular, we'll have a theory of signatures which includes Mike Shulman's higher IR example.

@AndrasKovacs
AndrasKovacs / Or.txt
Last active December 1, 2022 07:20
Syntax proposal for or-patterns in Haskell
-- Examples
data Foo = A | B | C
foo :: Foo -> Int
foo A = 10
foo B
foo C = 20
foo :: Foo -> Int