[Haskell-cafe] Type constrain in instance?

Jason Dusek jason.dusek at gmail.com
Fri Apr 9 12:16:58 EDT 2010


  You need to define the instance with `ChainableFunction' and
  not `CF' (the latter is value-level, not type level).

  Once you make that switch, you'll find yourself with an
  instance that is not compatible with the definition of the
  `Category' class.

    Prelude Control.Category> :info Category
    class Category cat where
      id :: forall a. cat a a
      (.) :: forall b c a. cat b c -> cat a b -> cat a c
            -- Defined in Control.Category

  We see that `id' and `.' have no class constraints and that
  there is in fact no where to place a class constraint on `a',
  `b' or `c'.

  I think that what you're looking for are "restricted
  categories" (and restricted monads and functors, as well,
  perhaps). A cursory search suggests the `data-category'
  package.

--
Jason Dusek


More information about the Haskell-Cafe mailing list