Skip to content

Instantly share code, notes, and snippets.

View aloiscochard's full-sized avatar
🪄

Aloïs Cochard aloiscochard

🪄
View GitHub Profile
@puffnfresh
puffnfresh / Monoid.v
Created April 24, 2014 15:08
Verified monoid in Coq.
Inductive bool : Type :=
| true : bool
| false : bool.
Class Monoid (A : Type) :=
{
empty : A ;
append : A -> A -> A ;
left_neutrality : forall x, append empty x = x ;
@nafg
nafg / gist:6120889
Created July 31, 2013 10:09
two way iteratee based on jsuereth and others
package chavrusa.ivr
import Trampoline.{ Done => TDone, More => TMore, Cont => TCont }
trait Iteratees[Err] {
sealed trait Input[+I]
case class El[+I](value: I) extends Input[I]
case object Empty extends Input[Nothing]
case object EOF extends Input[Nothing]
@YoEight
YoEight / examples.hs
Created October 10, 2012 09:43
Haskell machine package examples
module Examples where
import Control.Applicative
import Control.Monad.Trans
import Data.Machine
data Bit = EMPTY | One | Zero
instance Show Bit where
@tonymorris
tonymorris / gist:3087504
Created July 11, 2012 02:09
Comonad/Monad
trait Functor[F[_]] {
def fmap[A, B](f: A => B): F[A] => F[B]
}
trait Extend[F[_]] extends Functor[F] {
// coflatmap
def extend[A, B](f: F[A] => B): F[A] => F[B]
}
trait Comonad[F[_]] extends Extend[F] {
@arosien
arosien / gist:1712108
Created January 31, 2012 18:41
scalaz operator cheat sheet
F[A] // A is a Functor
M[A] // A is a Monad
fa: F[A], a: A // variables used below
fa1 |+| fa2 // binary append (SemiGroup)
fa1 >| fa2 // map (Functor)
fa1 >>= fa2 // flatmap (Bind)
fa1 |>| fa2 // foreach (Each)
fa <**> fb { (a, b) => c } // apply, produces F[C]
package pl.irc
import org.jibble.pircbot.PircBot
import dispatch._
import Http._
import net.liftweb.json._
import net.liftweb.json.JsonDSL._
import net.liftweb.json.Printer.{compact}
object Multibottest extends PircBot {