[Haskell-cafe] Query regarding Type classes

Arun Suresh arun.suresh at gmail.com
Mon Oct 13 05:33:02 EDT 2008

Hello folks,

Im kinda new to haskell. Ive only been fiddling around with it for bout 3 -
4 weeks now.
And for the life of me... i cant seem to figure out why this doesnt work :

class Foo a where
    fooFunc :: a -> Int

data FooData = FData

instance Foo FooData where
    fooFunc _ = 10

class Bar a where
    barFunc :: (Foo b) => a -> b -> Int

data BarData = BData

instance Bar BarData where
    barFunc _ FData = 20

When I compile I get this :
 Couldn't match expected type `b' against inferred type `FooData'
      `b' is a rigid type variable bound by
          the type signature for `barFunc' at Sample.hs:16:20
    In the pattern: FData
    In the definition of `barFunc': barFunc _ FData = 20
    In the definition for method `barFunc'

Think Im missing something really big...
Could somebody kindly help me out here...


Could so
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081013/4a2f80db/attachment.htm

More information about the Haskell-Cafe mailing list