Skip to content

Instantly share code, notes, and snippets.

@treeowl
treeowl / Magmas
Created May 8, 2015 00:44
Free magmas and semigroups
-- Construction of the free magma over an arbitrary type.
module Magma
import Set
%default total
%access public
infixl 6 <++>
class Set c => Magma c where
@treeowl
treeowl / freemagma
Last active August 29, 2015 14:20
Binary leaf trees are free magmas
module Set
%default total
infixl 4 ~=
class Set c where
(~=) : (x,y:c) -> Type
rfl : {x:c} -> x ~= x
symm : {x,y:c} -> x ~= y -> y ~= x
@treeowl
treeowl / monoidsolverthing
Last active August 29, 2015 14:20
Semigroup solver thing
module Mon
import Set
%default total
%access public
data MonBit a = MkMonBit a | MonZero
data Mon a = MkMon (Sem (MonBit a))
evalM' : MyMonoid a => Sem (MonBit a) -> a
import Data.Tree hiding (unfoldTreeM_BF, unfoldForestM_BF)
import Data.Traversable
import Prelude hiding (sequence)
import Control.Monad.Free
import Data.Functor.Identity
unfoldTreeM_BF :: Monad m => (b->m (a, [b])) -> b -> m (Tree a)
Authors

Merijn Verstraaten

Date

2014/11/22

So You Want to Be a Super Cool GHC Hacker?

So you have a pet peeve/bug/feature request that you'd like to see added to GHC. You made sure there was a Trac ticket for it, but despite your patient waiting no one is solving your problem. Those selfish GHC hackers!