Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am johnlato on github.
  • I am jwlato (https://keybase.io/jwlato) on keybase.
  • I have a public key ASAFwO4dXev3vUb-xQAknQYyOLm4TWCDGP0dFdntQAoBLQo

To claim this, I am signing this object:

@JohnLato
JohnLato / LvarAnd.hs
Last active January 1, 2016 10:09
lvar and
data AndBool = ATrue | AFalse deriving Eq
joinAndBool :: AndBool -> AndBool -> AndBool
joinAndBool ATrue ATrue = ATrue
joinAndBool _ _ = AFalse
instance JoinSemiLattice AndBool where
join = joinAndBool
data AndNum = Bot | One | Two | OneTwo deriving Eq
@JohnLato
JohnLato / GenFoo.hs
Created October 29, 2013 06:01
simple collection of meta information via Data/Generics
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
module Foo where
import GHC.Generics
import Data.Data
@JohnLato
JohnLato / gist:4069897
Created November 14, 2012 02:27
reactive-banana perf test 1
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE RankNTypes #-}
{-# OPTIONS_GHC -Wall -fno-warn-unused-binds #-}
module Benchmark.Banana (
benchmark1
, benchmark2
, main
) where
import Reactive.Banana
@JohnLato
JohnLato / IoState.hs
Created September 4, 2012 05:02
MonadState instance for IO (not sound!)
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ExtendedDefaultRules #-}
module IoState where
import Control.Monad.State.Class
import Data.IORef
import System.IO.Unsafe
@JohnLato
JohnLato / EteeArr.hs
Created July 5, 2012 03:50
arrow-like functions for enumeratees
{-# LANGUAGE RankNTypes, ScopedTypeVariables, NoMonomorphismRestriction,
TupleSections #-}
-- | A couple arrow-like functions for enumeratees. Consider this example:
--
-- Suppose you have the following
--
-- 1. Consumer :: Iteratee [(Int,Char)] m a
-- 2. Mapper :: Enumeratee Int Char m a
-- 3. Source :: Enumerator Int m a