Skip to content

Instantly share code, notes, and snippets.

@bosu
bosu / MVC Bug
Created June 6, 2015 16:59
Illustrates View composition bug.
{-# LANGUAGE TemplateHaskell #-}
import Pipes
import qualified Pipes.Prelude as P
import MVC
import MVC.Prelude
import Control.Lens
data V = Twice Int | Thrice Int
makePrisms ''V
@bosu
bosu / gist:4fdf685091ea7e0cb26f
Created June 3, 2014 14:34
Free Alternative
{-# LANGUAGE DeriveFunctor, FlexibleInstances #-}
{-# OPTIONS -Wall #-}
import Control.Monad.Free
import Control.Applicative
data SomeF f a = Many [a] | One (f a) deriving Functor
instance Functor f => Alternative (Free (SomeF f)) where
empty = Free (Many [])