Skip to content

Instantly share code, notes, and snippets.

import scala.reflect.runtime.universe._
import scala.tools.reflect.Eval
object O {
type A = {
type B = {
type C = O.type
}
}
}
{-# Language TemplateHaskell, QuasiQuotes, FlexibleContexts #-}
module Main where
import Text.Peggy hiding ( Expr, parse )
import Text.Peggy.LeftRec
import Prelude
type Id = String
data Prog = Prog Id [Decl] Stmt deriving (Show)
data T = SymT Id
| StrT String
| IntT Integer
| ChrT Char
| LisT [T]
| CloT Env Id T
-------------------------------------------------------------------------
(~|~) = (() <$) .: (<|>)
@apskii
apskii / gist:1787071
Created February 10, 2012 06:00
cl-hacking with macroexpand-hook
(defvar *source-storage* (make-hash-table))
(defun source-of (name)
(gethash name *source-storage*))
(defun source-save-hook (expander form env)
(when (eq (car form) 'defun)
(setf (gethash (cadr form) *source-storage*)
form))
(funcall expander form env))