<div dir="ltr">Hello folks,<br><br>Im kinda new to haskell. Ive only been fiddling around with it for bout 3 - 4 weeks now.<br>And for the life of me... i cant seem to figure out why this doesnt work :<br><br><br>class Foo a where<br>
&nbsp;&nbsp;&nbsp; fooFunc :: a -&gt; Int<br><br>data FooData = FData<br><br>instance Foo FooData where<br>&nbsp;&nbsp;&nbsp; fooFunc _ = 10<br><br><br><br>class Bar a where<br>&nbsp;&nbsp;&nbsp; barFunc :: (Foo b) =&gt; a -&gt; b -&gt; Int<br><br>data BarData = BData<br>
<br>instance Bar BarData where<br>&nbsp;&nbsp;&nbsp; barFunc _ FData = 20<br><br><br><br>When I compile I get this :<br>&nbsp;Couldn&#39;t match expected type `b&#39; against inferred type `FooData&#39;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; `b&#39; is a rigid type variable bound by<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the type signature for `barFunc&#39; at Sample.hs:16:20<br>&nbsp;&nbsp;&nbsp; In the pattern: FData<br>&nbsp;&nbsp;&nbsp; In the definition of `barFunc&#39;: barFunc _ FData = 20<br>&nbsp;&nbsp;&nbsp; In the definition for method `barFunc&#39;<br><br><br>Think Im missing something really big...<br>
Could somebody kindly help me out here...<br><br><br><br>Regards<br>Arun<br><br><br>Could so<br><br><br></div>