Skip to content

Instantly share code, notes, and snippets.

View ckoparkar's full-sized avatar

Chaitanya Koparkar ckoparkar

  • Indiana University
  • Bloomington, IN
View GitHub Profile
ckoparkar / Plugin.hs
Created November 19, 2021 14:13
Part of a GHC plugin which prints out all definitions it has access to.
installPlugin :: [GHC.CommandLineOption] -> [GHC.CoreToDo]
-> GHC.CoreM [GHC.CoreToDo]
installPlugin _ todos = return (testCoreTodo : todos)
testCoreTodo :: GHC.CoreToDo
testCoreTodo = GHC.CoreDoPluginPass "TEST" test
test :: GHC.ModGuts -> GHC.CoreM GHC.ModGuts
test mod_guts = do
hsc_env &lt- GHC.getHscEnv

Rough notes as I read and use

  • I'm using luarocks for the first time today, but what's bad about it and what is letrec trying to fix?
  • Dang, letrec should be named something else...
  • The store should slurp in modules compiled as .so/.dll files as well? Need to search under package.cpath...
  • Minor point, but all the built-in modules (table, string etc.) should be added to skip-module?.
  • "-meta" files should contain more metadata...? Maybe something like:
 + log-meta-SHA.lua
ckoparkar / A.hs
Last active April 23, 2019 13:12
-- ghc-8.6.5 -O0 -ddump-ds -ddump-simpl -ddump-to-file -fexpose-all-unfoldings -dsuppress-uniques \
-- -fforce-recomp -dsuppress-idinfo A.hs
module A where
import qualified Data.Map as M
data Foo = A Int
| B Foo Int
deriving Eq
Require Import List.
Require Import Omega.
Import ListNotations.
Definition strong_head {A : Type} : forall ls : list A, ls <> [] -> A.
refine (fun (ls : list A) =>
match ls with
| [] => fun _ => _
| a :: _ => fun _ => a
ckoparkar / pldi.patch
Created March 9, 2019 18:16
diff --git a/pldi19/ b/pldi19/
index 1bf8650..412c330 100755
--- a/pldi19/
+++ b/pldi19/
echo "Running in-memory benchmarks (Table 1)..."
echo "Sending results to $LITMUS_RESULT_FILE"
-# Some benchmarks require 100M iterations. Only used for CNF and Cap'n Proto.
#include <assert.h>
#include <stdio.h>
// #include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <alloca.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <assert.h>
#include <stdio.h>
// #include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <alloca.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
Prog {ddefs = [("Tree",
DDef {tyName = "Tree",
dataCons = [("Leaf", [(False, IntTy)]),
[(False, PackedTy "Tree" "loc92"),
(False, PackedTy "Tree" "loc93")]),
[(False, CursorTy),(False, PackedTy "Tree" "loc94"),
(False, PackedTy "Tree" "loc95")]),
("INDIRECTION159", [(False, CursorTy)])]})],
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# OPTIONS_GHC -Wno-name-shadowing #-}
module Bug where
`rts.c` has a minimal RTS I'm using to test the object file linking. It houses the `main` function.
The main function calls `main_expr`, which is provided by this LLVM module.
ckoparkar / Blade.hs
Last active February 24, 2018 21:57
module Blade where
import qualified Data.Set as S
-- Implemented the inclusion-exclusion algorithm:
-- <>
-- (∑ Aj) in the formula
-- These all the numbers we've counted more than once
doubleCounts :: [Int]