Skip to content

Instantly share code, notes, and snippets.

import Data.AttoLisp
import Language.Haskell.Exts
main = interact (result (error . show) (encode . transform) . parseExp)
result _ g (ParseOk o) = g o
result f _ fail@ParseFailed{} = f fail
transform = undefined
import Data.Aeson
import Data.Attoparsec.Number
import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as Bytes
import qualified Data.ByteString as Strict
import Data.Function
import qualified Data.HashMap.Lazy as Map
import Data.Int
import Data.List
import Data.Maybe
chris@midnight:~/Projects/me/fay$ dist/build/fay/fay src/Benchmarks.hs --no-ghc && node src/Benchmarks.js && echo "- With optimizations- " && echo && dist/build/fay/fay src/Benchmarks.hs --no-ghc -O && node src/Benchmarks.js
Running benchmark “sum 1000000 0” ...
Recording ...
Results: 534ms 535ms 534ms 535ms 566ms
Mean 540.8ms, Min 534ms, Max 566ms, Stddev 12.607934009979589
Forcing the list ...
Running benchmark “length [1..1000000]” ...
Recording ...
{-# OPTIONS -Wall -fno-warn-orphans #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
-- | Lookup the documentation of a name in a module (and in a specific
-- package in the case of ambiguity).
--
-- To build:
--
-- $ ghc --make HaskellDocs.hs -package ghc -o haskell-docs
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Applicative
import Control.Monad.State
import Data.List hiding (or)
import Data.Map (Map)
import qualified Data.Map as M
import Data.Maybe
import Language.ECMAScript3
import Language.ECMAScript3.Syntax.Annotations
-- Examples:
-- λ> analyze "1"
-- 1 :: Int
-- λ> analyze "(function(){})"
-- (function(){}) :: ? -> Undefined
-- λ> analyze "(function(){ var x = 1; })"
-- (function(){ var x = 1; }) :: ? -> Undefined
-- λ> analyze "(function(){ var x = 1; return x })"
-- (function(){ var x = 1; return x}) :: ? -> Int
char jhc_c_compile[] = "gcc tmp_files/rts/profile.c tmp_files/rts/rts_support.c tmp_files/rts/gc_none.c tmp_files/rts/jhc_rts.c tmp_files/lib/lib_cbits.c tmp_files/rts/gc_jgc.c tmp_files/rts/stableptr.c -Itmp_files/cbits -Itmp_files tmp_files/main_code.c -o fib-ajhc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math -Wextra -Wall -Wno-unused-parameter -fno-strict-aliasing -DNDEBUG -O3 '-D_JHC_GC=_JHC_GC_JGC'";
char jhc_command[] = "ajhc -o fib-ajhc fib.hs --tdir tmp_files";
char jhc_version[] = "ajhc 0.8.0.1 (46ba77fa0f2ed1fa16acdedae737deab365c9c25)";
#include "jhc_rts_header.h"
static struct s_cache *cCJhc_Prim_Prim_$x3a;
static struct s_cache *cFW$__fJhc_Inst_Show_showWord;
#include <stdio.h>
enum {
(require 'comint)
(require 'notify)
(defcustom yesod-devel-directory
nil
"Default directory to prompt for for yesod devel'ing.")
(defcustom yesod-devel-command
"yesod devel"
"Default command to run for yesod devel'ing.")
@chrisdone
chrisdone / gist:dec52a5995290bab5d27
Created September 11, 2014 12:32
grooveshark broadcast tracks
// ==UserScript==
// @name Grooveshark broadcast tracks
// @namespace chrisdone
// @description Grooveshark broadcast tracks
// @include http://grooveshark.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @version 1
// @grant none
// ==/UserScript==
@chrisdone
chrisdone / 0-PHOAS-total-evaluator.hs
Last active March 24, 2024 16:55
Various lambda-calculus implementations
-- λ> eval (A (L (\(C i) -> C (i * 2))) (C 2))
-- 4
{-# LANGUAGE GADTs #-}
data E a where
C :: a -> E a
L :: (E a -> E b) -> E (a -> b)
A :: E (a -> b) -> E a -> E b