Skip to content

Instantly share code, notes, and snippets.

@tgass
tgass / dynlistUpsort.hs
Last active August 7, 2018 18:49
Dynamic list with upsort
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RecursiveDo #-}
module Reflex.Dom.Contrib.Widgets.DynamicListWithUpsort where
import qualified Data.Map as M
import qualified Data.List as L
import Data.Monoid
import Reflex
@tgass
tgass / bracket.hs
Created July 31, 2018 08:45
Tournament bracket recursive style with Haskell and Reflex
{-# LANGUAGE OverloadedStrings, RankNTypes, ScopedTypeVariables, TypeFamilies, FlexibleInstances, FlexibleContexts #-}
module Main where
import Control.Monad (void, when)
import Data.Maybe (fromMaybe)
import Data.Monoid
import qualified Data.List as List
import qualified Data.Text as T
import Reflex
@tgass
tgass / Aggregate.hs
Created October 30, 2016 13:11 — forked from Fristi/Aggregate.hs
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
}