Skip to content

Instantly share code, notes, and snippets.

@kmicinski
Created April 4, 2013 18:43
Show Gist options
  • Save kmicinski/5313004 to your computer and use it in GitHub Desktop.
Save kmicinski/5313004 to your computer and use it in GitHub Desktop.
data MonO
-- This is the type of arrows for the category of monoids. Note that
-- for a monoid, regarded as a category, there is a single object
-- (called MonO here). Arrows are formed by members of the monoid's
-- carrier, m.
data MonC a b where
M :: Monoid c => c -> MonC MonO MonO
instance Monoid m => Category MonC where
dom (M (_ :: m)) = M (mempty :: m)
cod (M (_ :: m)) = M (mempty :: m)
(M a) ∘ (M b) = M ((mappend a b) :: m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment