Skip to content

Instantly share code, notes, and snippets.

@chrisdone-artificial
Created November 19, 2024 21:34
Show Gist options
  • Save chrisdone-artificial/ebcb3bbfa66ffa8024c73989afea9cc3 to your computer and use it in GitHub Desktop.
Save chrisdone-artificial/ebcb3bbfa66ffa8024c73989afea9cc3 to your computer and use it in GitHub Desktop.
CPS'd eval
eval :: env -> Term env t -> t
eval erm trm = eval erm trm id where
eval :: env -> Term env t -> (t -> r) -> r
eval env (Var v) k = k (lookp v env)
eval env (Lam e) k = k (\x -> eval (env, x) e id)
eval env (App e1 e2) k =
eval env e1 $ \f ->
eval env e2 $ \x ->
k (f x)
eval _env (Lit a) k = k a
4093
30,700,289,784 bytes allocated in the heap
264,208,480 bytes copied during GC
1,735,064 bytes maximum residency (218 sample(s))
221,208 bytes maximum slop
55 MiB total memory in use (0 MiB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 7073 colls, 7073 par 0.558s 0.582s 0.0001s 0.0011s
Gen 1 218 colls, 217 par 0.138s 0.060s 0.0003s 0.0004s
Parallel GC work balance: 25.75% (serial 0%, perfect 100%)
TASKS: 22 (1 bound, 21 peak workers (21 total), using -N10)
SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)
INIT time 0.007s ( 0.006s elapsed)
MUT time 6.766s ( 4.806s elapsed)
GC time 0.696s ( 0.642s elapsed)
EXIT time 0.001s ( 0.011s elapsed)
Total time 7.469s ( 5.465s elapsed)
Alloc rate 4,537,632,177 bytes per MUT second
Productivity 90.6% of total user, 87.9% of total elapsed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment