16 Jun
2007
16 Jun
'07
3:22 p.m.
Hugo Pacheco writes:
test :: SomeClass a b => a -> b test 1 = True
test, as you've written it, is only a function from Ints to Bools, not from any a to any b where SomeClass a b holds. It is true that SomeClass Int Bool is the only instance at the moment, but type classes are open and someone could come along and add another instance (perhaps even in a different module), like SomeClass () String, and your function promises to be able to deal with them; as you've written it, it can't. -- -David House, dmhouse@gmail.com