Skip to content

Instantly share code, notes, and snippets.

vmMain :: VMState VMVariable
vmMain = do {
let (VMObject hello) = (VMObject 123);
return VMNull;
-- ^
-- parse error on input `return'
}
-- How do I force evaluation when working with monadic values? :(
type HeapPtr = Integer
type VMVariable = String
__fn_0 :: [VMVariable] -> VMVariable
createFunction :: ([VMVariable] -> VMVariable) -> VMState VMVariable
setProp :: HeapPtr -> VMVariable -> VMVariable -> VMState ()
vmMain = do
import Control.Monad.State
import Control.Monad.Trans
type StackState a = StateT [Integer] IO a
--type StackStateIO = StateT [Integer] IO ()
push :: Integer -> StackState ()
push a = do
modify (a:)
return ()
{-# LANGUAGE FlexibleInstances #-}
import GHC.Float
data LangVariable = LangString String | LangNumber Double | LangNull deriving Show
class LangCoercion a where
toLangVariable :: a -> LangVariable
instance LangCoercion String where
@munro
munro / facebook_messages.mcw
Created April 18, 2014 22:21
Facebook Messages designed in Macaw
@munro
munro / empty
Last active August 29, 2015 13:58
SublimeGraphvizPreview
zz
data Box = Box { box_x1 :: Integer, box_y1 :: Integer, box_x2 :: Integer, box_y2 :: Integer } deriving Show
subdivideNW Box { box_x1 = x1', box_y1 = y1', box_x2 = x2', box_y2 = y2'} = Box {
box_x1 = x1',
box_y1 = y1',
box_x2 = x1' + half_width,
box_y2 = y1' + half_height
}
where
half_width = (x2' - x1') `div` 2
import GHC.Unicode
strToTitle str = [if isSpace (fst ch) then toTitle (snd ch) else snd ch | ch <- (zip (" " ++ str) str)]
@munro
munro / setup.md
Last active December 26, 2015 20:09
Mac Configuration

here's my mac setup, it's pretty simple but works extremely well!

  • brew (apt-get for mac)
  • iTerm 2 (better terminal)
  • Alfred (goto anything, so you can open/switch windows with just your keyboard)
  • KeyRemap4Macbook (swap the fn & ctrl keys… drives me crazy)
  • create 6 workspaces, and update keyboard shortcuts so you can switch windows, also turn off
  • turn capslock into alt key, and use that as your primary modifier
  • remove every default shortcut, keep only the 5 that you use