Skip to content

Instantly share code, notes, and snippets.

@khibino
Created November 9, 2012 01:58
Show Gist options
  • Save khibino/4043248 to your computer and use it in GitHub Desktop.
Save khibino/4043248 to your computer and use it in GitHub Desktop.
{-# LANGUAGE FlexibleInstances #-}
import Prelude hiding (id, (.))
import qualified Prelude
import Control.Category (Category(..))
import Data.Monoid (Monoid(..))
newtype F a b = F (a -> b)
instance Category F where
id = F Prelude.id
F f . F g = F (f Prelude.. g)
instance Monoid (F a a) where
mempty = id
mappend = (.)
type Endo a = F a a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment