13 Oct 11:29
Query regarding Type classes
From: Arun Suresh <arun.suresh <at> gmail.com>
Subject: Query regarding Type classes
Newsgroups: gmane.comp.lang.haskell.cafe
Date: 2008-10-13 09:33:02 GMT
Subject: Query regarding Type classes
Newsgroups: gmane.comp.lang.haskell.cafe
Date: 2008-10-13 09:33:02 GMT
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...
Regards
Arun
Could so
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...
Regards
Arun
Could so
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe <at> haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RSS Feed