Skip to content

Instantly share code, notes, and snippets.

michaelt michaelt

Block or report user

Report or block michaelt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Main.hs
{-# LANGUAGE OverloadedStrings #-}
import Pipes
import Pipes.Group
import qualified Pipes.Prelude as P
import qualified Pipes.ByteString as PB
import qualified Pipes.Attoparsec as PA
import Data.Aeson
import Data.Aeson.Parser
import Data.Aeson.Types
import Data.Monoid
View gist:fa2c8ceb9fb8ddbe1538
data Primitive = Num
|Chr
|Str
|Cnd Bool deriving (Show)
data T = K Int | R Int
-- >>> :set -XDataKinds
-- >>> :t Num
-- Num :: Primitive
-- >>> :k Num
@michaelt
michaelt / amity.hs
Created Dec 3, 2010 — forked from DylanLukes/amity.hs
with idiom brackets in minecraft.hs
View amity.hs
import System.IO
import Network
import Minecraft
import Control.Monad
import Control.Monad.Fix
import Control.Monad.Trans
import Control.Monad.BinaryProtocol
import Control.Concurrent
import Control.Concurrent.STM
import Control.Concurrent.STM.TChan
@michaelt
michaelt / Jade.hs
Created May 6, 2012 — forked from scan/Jade.hs
Jade2.hs
View Jade.hs
{-#LANGUAGE OverloadedStrings#-}
module Jade where
import Text.Parsec
import qualified Text.Parsec.Token as L
import Text.Parsec.Language (emptyDef)
import Text.Parsec.Text (Parser)
import Data.Text (Text)
import Control.Monad (mzero)
import Control.Applicative ((<$>),(*>), (<*))
View gist:2632582
(☃) :: Int -> Int -> Int
x ☃ y = x + y
main = print $ 0 ☃ 1 ☃ 2
@michaelt
michaelt / UninstallHS.hs
Created May 22, 2012 — forked from mzero/UninstallHS.hs
Mac OS X Haskell Uninstaller preview
View UninstallHS.hs
#!/usr/bin/env runghc
module Main where
{-
Uninstall.hs - a Haskell uninstaller for Mac OS X
This program is really far too big to be in a single file. However, I
wanted it to be easily distributable and runnable, and so have kept it all
together.
@michaelt
michaelt / asyncidiom.hs
Created Jun 23, 2012 — forked from sjoerdvisscher/asyncidiom.hs
Applicative async programming
View asyncidiom.hs
import Control.Concurrent
import Control.Concurrent.Async
import Control.Applicative
import Control.Monad
import Data.Traversable
newtype Concurrently a = Concurrently { runConcurrently :: IO a }
instance Functor Concurrently where
@michaelt
michaelt / asyncidiom.hs
Created Jun 23, 2012 — forked from sjoerdvisscher/asyncidiom.hs
Applicative async programming
View asyncidiom.hs
{-# LANGUAGE ImplicitParams, ParallelListComp,MonadComprehensions #-}
import Control.Monad
import Control.Monad.Fix
import Control.Monad.Zip
import Control.Applicative
import Control.Concurrent
import Control.Concurrent.MVar
import Control.Exception
import Prelude -- hiding (catch)
import Data.IORef
View html.hs
module HTML where
class Tag a where
toHTML :: a -> String
data Attribute = Attribute {
key :: String,
value :: String
} deriving Show
View gist:3847032
countPackets p =
let v = AL.parse (CA.many packetValue) p
r = fromMaybe [] $ AL.maybeResult v
in r
You can’t perform that action at this time.