Skip to content

Instantly share code, notes, and snippets.

View nominolo's full-sized avatar

Thomas Schilling nominolo

  • Zürich, Switzerland
View GitHub Profile
> {-# OPTIONS_GHC -fdicts-cheap -fbang-patterns #-}
> {-# LANGUAGE Rank2Types, ExistentialQuantification#-}
> module StreamCont where
> data Stream a = forall s. Stream (s -> Step a s) s
> data Step a s = Done
> | Yield a s
> | Skip s
> data Stream' a
{-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Rank2Types #-}
import Control.Applicative
------------------------------------------------------------------------
newtype Identity a = Identity { runIdentity :: a }
instance Functor Identity where
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE MultiParamTypeClasses #-}
import Control.Applicative
------------------------------------------------------------------------
newtype Identity a = Identity { runIdentity :: a }
instance Functor Identity where
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Rank2Types #-}
data Exp = Var String | Lit Int | Add Exp Exp
| Mul Exp Exp | Neg Exp
| Do Stm
deriving Show
data Stm = Decl Typ String | Assign String Exp | Return Exp | Block [Stm]
deriving Show
/Users/nominolo/code/ghc/parallel/inplace/lib/ghc-stage2 -B/Users/nominolo/code/ghc/parallel/inplace/lib --make Setup.hs -j2 -o blu1 +RTS -s -N2
[ 2 of 58] Compiling[ D1i sotfr i5b8u]t iCoonm.pCiolmipnagt .DRiesatdrPi b(u tDiiosnt.rSiibmuptlieo.nP/rCeoPmrpoacte/sRse.aUdnPl.ihts ,( DDiissttrriibbuuttiioonn//CSoimmppalte//RPeraedPPr.ooc e)s
s/Unlit.hs, Distribution/Simple/PreProcess/Unlit.o )
Loading iface base:Prelude
Loading iface base:Data.Char
Loading iface base:Control.Monad
Loading iface base:Data.List
2173 expected passes
72 expected failures
15 unexpected passes
1 unexpected failures
Unexpected passes:
ClassEqContext(normal)
ClassEqContext2(normal)
ClassEqContext3(normal)
GADT10(normal)
@nominolo
nominolo / murmur-bench.hs
Created October 27, 2010 16:21
murmur bench
{-# LANGUAGE BangPatterns #-}
import Criterion.Main
import Data.Int
import Data.Word
import Data.List
import Data.Digest.Murmur32
main = defaultMain $
@nominolo
nominolo / Murmur3.hs
Created November 27, 2010 01:59
Preliminary Hs interface to MurmurHash3
{-# LANGUAGE BangPatterns #-}
module Murmur3 where
import Data.Word ( Word32 )
import Data.Bits ( rotateL, xor, shiftR )
-- Same associativity as the proposed `mappend` operator for Data.Monoid
infixr 6 <>
-- MurmurHash3 uses 3 state variables, h1, c1, c2
@nominolo
nominolo / gist:898173
Created April 1, 2011 13:51
add this to your $HOME/.gitconfig
[alias]
co = checkout
st = status
hist = log --pretty=format:\"%C(yellow)%h%Creset %ad | %s%Cgreen%d%Creset [%C(blue)%an%Creset]\" --graph --date=short
Example output (coloured)
@nominolo
nominolo / gist:983312
Created May 20, 2011 16:54
Fullscreen on Mac Emacs
;; This works with Carbon Emacs 2010
(defun mac-toggle-max-window ()
(interactive)
(set-frame-parameter nil 'fullscreen
(if (frame-parameter nil 'fullscreen)
nil
'fullboth)))
;; Now bind it to a key (e.g., Mac+Meta+Return)