Skip to content

Instantly share code, notes, and snippets.

View larsrh's full-sized avatar
🏝️
On hiatus.

Lars Hupel larsrh

🏝️
On hiatus.
View GitHub Profile
@larsrh
larsrh / compose.hs
Created February 5, 2014 21:08
Arbitrary composition
{-# LANGUAGE DataKinds, TypeFamilies, GADTs, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances, FunctionalDependencies #-}
data Nat = Zero | Suc Nat
data Natty (n :: Nat) where
Zy :: Natty Zero
Sy :: Natty n -> Natty (Suc n)
class Composed (n :: Nat) a b f g | n f a b -> g where
compose :: Natty n -> (a -> b) -> f -> g
@larsrh
larsrh / build.sbt
Created May 13, 2014 08:27
Functional Mocking
scalaVersion := "2.10.3"
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.1.0-M6",
"org.scalaz" %% "scalaz-effect" % "7.1.0-M6"
)
@larsrh
larsrh / output.txt
Created August 2, 2014 09:02
Ivy failure for org.scala-lang:scala-library
$ sbt -no-share -sbt-create # paulp's launcher script
Getting org.scala-sbt sbt 0.13.5 ...
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.5/jars/sbt.jar ...
[SUCCESSFUL ] org.scala-sbt#sbt;0.13.5!sbt.jar (857ms)
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-library/2.10.4/scala-library-2.10.4.jar ...
[SUCCESSFUL ] org.scala-lang#scala-library;2.10.4!scala-library.jar (3166ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main/0.13.5/jars/main.jar ...
[SUCCESSFUL ] org.scala-sbt#main;0.13.5!main.jar (2354ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.5/jars/compiler-interface-src.jar ...
[SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.5!compiler-interface-src.jar (798ms)

haskell-src-exts

  • incomplete Unicode support (report)

postgresql-simple

  • ByteString is not treated as binary data by default (report, report)
@larsrh
larsrh / QCUtil.hs
Last active August 29, 2015 14:08
Nicer pretty printing of counterexamples for tuple generators
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
@larsrh
larsrh / qcresult.hs
Created November 17, 2014 11:19
Why do you scream at me?
> quickCheckResult False
*** Failed! Falsifiable (after 1 test):
Failure {numTests = 1, numShrinks = 0, numShrinkTries = 0, numShrinkFinal = 0, usedSeed = TFGenR 000000025E37A9D3000000000003D090000000000000DE920000005C5B22D280 0 8 4 0, USEDSIZE = 0, REASON = "FALSIFIABLE", THEEXCEPTION = NOTHING, LABELS = [], OUTPUT = "*** FAILED! FALSIFIABLE (AFTER 1 TEST): \N"}
@larsrh
larsrh / pghlist.hs
Created January 9, 2015 06:47
HLists in postgresql-simple
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Data.HList (
@larsrh
larsrh / interp.hs
Created February 23, 2015 21:27
Typed lambda calculus interpreter
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
data VarKind t = Bound | Free t
@larsrh
larsrh / Hello.agda
Created March 4, 2015 10:03
Some of my Agda experiments
module Hello where
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
infix 4 _≡_
sym : {A : Set} {x y : A} → x ≡ y → y ≡ x
sym refl = refl
@larsrh
larsrh / Terminal.hs
Created March 21, 2015 10:18
Terminal I/O using Free+Coyoneda
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
module Terminal where
import Control.Monad.Free (Free, liftF, iterM)
import Control.Monad.State
import Data.Functor.Coyoneda (Coyoneda (Coyoneda), liftCoyoneda)