Skip to content

Instantly share code, notes, and snippets.

First of all, sorry for the messy code (it was in a bad condition, and I've been commenting/uncommenting bunch of things to understand what's going on and where, only got time to fix it but not clearnup)

At first, I've started getting

Stack space overflow: current size 8388608 bytes.
@Fuuzetsu
Fuuzetsu / hackagedocs
Last active December 13, 2022 22:40
Script for generating and uploading missing documentation for your Hackage packages. Now with fixed package links and contents page.
#!/usr/bin/env bash
cabal configure && cabal build && cabal haddock --hyperlink-source \
--html-location='/package/$pkg-$version/docs' \
--contents-location='/package/$pkg'
S=$?
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
DDIR="${1}-${2}-docs"
cp -r "${1}" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
@Fristi
Fristi / Aggregate.hs
Last active December 21, 2024 10:17
DDD/Event Sourcing in Haskell. Implemented an aggregate as a type class and type families to couple event, command and error types specific to the aggregate. Errors are returned by using Either (Error e) (Event e). Applying Applicative Functors fits here well to sequentially check if the command suffice.
{-# LANGUAGE TypeFamilies #-}
import Data.Function (on)
import Control.Applicative
data EventData e = EventData {
eventId :: Int,
body :: Event e
}
trait ConfigComponent {
type Config
def config: Config
}
trait MySQLStorageComponent extends StorageComponent with ConfigComponent {
type Config <: MySQLConfig
override def storeUser(user: User) { ... }
override def retrieveUser(id: Int): Option[User] = ...
@tonymorris
tonymorris / TypeClass.hs
Last active September 15, 2020 13:17
Type-class hierarchy
Moved to https://github.com/tonymorris/type-class
@retronym
retronym / just-do-it.log
Created August 19, 2012 22:10
Just Do It: TODO comments in scala/scala git-blamed on commits between 2.9.2 and 2.10-0-SNAPSHOT
========================================
Adriaan Moors
========================================
= src/compiler/scala/tools/nsc/ast/TreeGen.scala
1dbcbd5 2012-02-17 75 // TODO: would be so much nicer if we would know during match-translation (i.e., type checking)
= src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
2890714 2012-04-24 536 // TODO: clean this up -- there is too much information packked into makePatDef's `pat` argument
= src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
a57ac60 2012-02-13 1107 var ctx1 = genLoad(selector, ctx, INT) // TODO: Java 7 allows strings in switches (so, don't assume INT and don't convert the literals using intValue)
= src/compiler/scala/tools/nsc/transform/Erasure.scala
trait Functor[F[_]]
object Functor {
implicit val OptionFunctor: Functor[Option] =
error("")
}
case class OptionT[F[+_], +A]