Skip to content

Instantly share code, notes, and snippets.

Aloïs Cochard aloiscochard

Block or report user

Report or block aloiscochard

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
aloiscochard / fun-deps.scala
Last active Sep 11, 2016
Fun with fun-deps in scala.
View fun-deps.scala
object Test0 {
import scalaz.meta.Foo._
val s: String =
val i: Int = "test".bar
println(s) // bar
println(i) // 42
aloiscochard /
Created Jan 17, 2016
Scala - Identifying Kinds

Identification scheme for Scala kind annotations.

The number of parameters is followed by an optional list of of modifiers, starting with a letter to indicate the parameter rank and optionally swapping the case from the previous letter in case the type at this position is also higher kinded.


  • [_]
    • 1
  • [_, _]
    • 2
aloiscochard / oplog.hs
Created Jan 18, 2015
Tailing MongoDB OpLog in Haskell
View oplog.hs
{-# LANGUAGE OverloadedStrings #-}
module Mongolito where
import Control.Exception
import Control.Monad.IO.Class (liftIO)
import Database.MongoDB
import System.Log.Logger
localDb :: Database
localDb = "local"
aloiscochard / 0-common.Module.scala
Last active Sep 11, 2016
Dependency Injection in Scala without Cake Pattern
View 0-common.Module.scala
package com.acme
import com.typesafe.config.Config
trait Module {
implicit def config: Config
View Transfigure.scala
package com.timeout
import scala.language.higherKinds
import scalaz._
trait Transfigure[A, B, T] {
def apply(x: A, f: B): T
View gist:10062325

"A designer knows he has achieved perfection not when there is nothing left to add,but when there is nothing left to take away." - Antoine de Saint-Exupéry

"One person's syntax is another person's semantics." -- Joseph Goguen

"Ugly programs are like ugly suspension bridges: they're much more liable to collapse than pretty ones, because the way humans (especially engineer-humans) perceive beauty is intimately related to our ability to process and understand complexity. A language that makes it hard to write elegant code makes it hard to write good code." - Eric S. Raymond

"It is better to have 100 functions operate on one data structure than to have 10 functions operate on 10 data structures." - Alan J. Perlis

"Simple things should be simple and complex things should be possible." - Alan Kay

aloiscochard / Compute.scala
Created Dec 9, 2013
Compute: A very simple language for addition/substraction.
View Compute.scala
import scala.util.parsing.combinator._
import scala.util.matching._
object Compute {
sealed trait Expression
object Expression {
case class Literal(value: Int) extends Expression
case class Apply(operator: Operator, lhs: Expression, rhs: Expression) extends Expression
aloiscochard / Action.scala
Created Dec 1, 2013
Slick monadic Actions
View Action.scala
package slick
* This is some code extracted from TimeOut codebase, demonstrating:
* - Use of tag typed to avoid mixing session of different DB
* - The use of the Reader Monad to compose Actions together and defer the choice of async/sync computation
* I remove the part where we can say if our operation are read only or not (to use different connection), in order to
* make things easier.
aloiscochard /
Last active Mar 5, 2018
QuickSBT - Launch SBT with support for generating /tmp/sbt.quickfix file for Vim
#!/usr/bin/env bash
# QuickSBT #
# Launch SBT with support for generating /tmp/sbt.quickfix file for Vim
# /
# Error format for SBT, and shortcut to open SBT quickfix file :
aloiscochard / field.scala
Created Apr 13, 2012
Scala DSL design: Avoiding TupleX boilerplate using HList
View field.scala
package object field {
case class Field[T]()
val name = Field[String]()
val age = Field[Int]()
val admin = Field[Boolean]()
You can’t perform that action at this time.