Created
November 23, 2014 07:57
-
-
Save anonymous/266c1a5b9fc75e3e8a37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-#LANGUAGE PolyKinds, TypeFamilies, TypeOperators, ConstraintKinds, UndecidableInstances, FlexibleInstances, FunctionalDependencies, MultiParamTypeClasses, TypeOperators, KindSignatures #-} | |
import qualified Prelude ((.), id, String) | |
import Data.Proxy | |
import GHC.Exts | |
import GHC.TypeLits | |
class SmallCategory cat where | |
name :: Proxy cat -> Prelude.String | |
id ::(Objects cat a, CategoryMorphism cat morph) => morph a a | |
type Objects cat :: a -> Constraint | |
-- type Morph cat :: a -> a -> b | |
class CategoryMorphism cat morph | cat -> morph, morph -> cat where | |
(.) :: (Objects cat a, Objects cat b, Objects cat c) => b `morph` c -> a `morph` b -> a `morph` c | |
instance SmallCategory "Hask" where | |
id = Prelude.id | |
name Proxy = "Hask" | |
type Objects "Hask" = Vacuous "Hask" | |
-- type Morph "Hask" = (->) | |
instance CategoryMorphism "Hask" (->) where | |
(.) = (Prelude..) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment