I've perhaps been trying everyones patiences with my noobish CT
questions, but if you'll bear with me a little longer: I happened to
notice that there is in fact a Category class in Haskell base, in
Control.Category:

quote:
--------
class Category cat where

A class for categories. id and (.) must form a monoid.

Methods

id :: cat a a

the identity morphism

(.) :: cat b c -> cat a b -> cat a c

morphism composition
--------

However, the documentation lists only two instances of Category,
functions (->) and Kleisli Monad. For instruction purposes, could
someone show me an example or two of how to make instances of this
class, perhaps for a few of the common types? My initial thoughts were
something like so:

code:
--------
instance Category Integer where

  id = 1

  (.) = (*)

-- and

instance Category [a] where

  id = []
  (.) = (++)
-------

But these lead to kind mis-matches.

-- 
frigidcode.com

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to