<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 21, 2021, at 2:48 PM, David Feuer <<a href="mailto:david.feuer@gmail.com" class="">david.feuer@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">This is the dreaded monomorphism restriction, which is turned on by default in modules but turned off by default in GHCi. Because your function is not "syntactically" a function (i.e., there are no arguments to the left of the = sign), and has no type signature, the type checker insists on it having a monomorphic type. Unless there's a use of it in the module forcing it to a particular type, the defaulting rules come into play, and a variable with a `Num` constraint defaults, by default, to `Integer`.</span></div></blockquote></div><br class=""><div class="">Indeed -- but I will offer a tiny nuance: the type checker only insists that the type has no constraints, not that it is fully monomorphic. That is, writing `myId = id` will produce a polymorphic myId because there are no constraints on id, while `myPlus = (+)` will be monomorphic because of the constraint on (+).</div><div class=""><br class=""></div><div class="">Richard</div></body></html>