[Haskell-cafe] Functional Dependencies and multiparameter typeclasses

2009-08-24 Thread Harald ROTTER
Dear Haskellers, I am using multi parameter typeclasses to represent images consisting of pixels (e.g. bitmap images). {-# OPTIONS_GHC -XMultiParamTypeClasses #-} module Bitmap where -- | a pixel could be a Word8 (e.g. a graysclale image) -- | or a 3-tuple for RGB images class

Re: [Haskell-cafe] Functional Dependencies and multiparameter typeclasses

2009-08-24 Thread Miguel Mitrofanov
However, I do not really understand the cause of the original problem. Why do I need the functional dependency to make this work ? Suppose you have an instance: instance Pixel MyPixel where... instance Image MyImage MyPixel where width i = countPixels i ... And somebody (not necessarily yo

Re: [Haskell-cafe] Functional Dependencies and multiparameter typeclasses

2009-08-24 Thread Bulat Ziganshin
Hello Harald, Monday, August 24, 2009, 3:17:28 PM, you wrote: > class Pixel p where > -- | an image could be a UArray or a list of lists of pixels > class Pixel p => Image a p where read http://haskell.org/haskellwiki/OOP_vs_type_classes here you say that Image is a particular