<br><br><div><span class="gmail_quote">On 6/16/07, <b class="gmail_sendername">David House</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hugo Pacheco writes:<br> > test :: SomeClass a b => a -> b<br> > test 1 = True<br><br>>test, as you've written it, is only a function from Ints to Bools, not from any<br>>a to any b where SomeClass a b holds. It is true that SomeClass Int Bool is the
<br>>only instance at the moment, but type classes are open and someone could come<br>>along and add another instance (perhaps even in a different module), like<br>>SomeClass () String, and your function promises to be able to deal with them; as
<br>>you've written it, it can't.</blockquote><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>I've just promoted the test function to the class and it works the same, I missed it before.
</div><div>However, haskell functions are partial. It could be generic and fail when some pattern does not exist as usual. </div><br> </div><br>