[Haskell-cafe] Re: Type constrain in instance?

2010-04-09 Thread Louis Zhuang
Casey McCann gmail.com> writes: > {-# LANGUAGE MultiParamTypeClasses, GADTs #-} > import qualified Control.Category as Cat > > data ChainableFunction a b where > CF :: (Num a, Num b) => (a->b) -> (a->b) -> ChainableFunction a b > CFId :: ChainableFunction a a > > instance Cat.Category C

[Haskell-cafe] Type constrain in instance?

2010-04-09 Thread Louis Zhuang
Hi, I got an issue when playing haskell's type system, partically parametic class/instance have no way to specify constrains of their parameters. for example, i want to data struct to chain functions and their derivatives so we can have combined function and derivations, as following import qualif