<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 23 Jan 2009, at 14:37, Francesco Bochicchio wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br> <div class="gmail_quote">2009/1/23 Paul Visschers <span dir="ltr">&lt;<a href="mailto:mail@paulvisschers.net">mail@paulvisschers.net</a>&gt;</span><br> <blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"> <div> <div></div> <div class="Wj3C7c">Hello,<br><br>It seems like you have some trouble with grasping the concept of<br>polymorphism in this particular case.<br><br>&lt;...&gt;</div></div></blockquote> <div>&nbsp;</div> <div>I think I get the polymorphism. What I don't get is why a specialized type cannot</div> <div>replace a more generic type, since the specialized type implements the interface</div> <div>defined in the generic type. </div> <div><br></div></div></blockquote><br></div><div>Suppose I declare this constant:</div><div>x :: Num a =&gt; a</div><div>x = 3 :: Integer</div><div><br></div><div>Now suppose I want to use that in a function. &nbsp;It's type signature says that x is *any* numeric type i want it to be, so I'm going to add it to another numeric value:</div><div><br></div><div>y :: Complex Float</div><div>y = x + (5.3 :+ 6.93)</div><div><br></div><div>Unfortunately, x *can't* take the form of any Numeric type – it has to be an Integer, so I can't add it do Complex Floating point numbers.</div><div><br></div><div>The type system is telling you "while Integers may imelement the numeric interface, the value 3 :: Integer is not a generic value – it can't take the form of *any* numeric value, only a specific type of numeric values".</div><div><br></div><div>Bob</div></body></html>