<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 11, 2014 at 12:28 AM, Jason Dagit <span dir="ltr"><<a href="mailto:dagitj@gmail.com" target="_blank">dagitj@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>It seems to be an issue with giving everything on a single line:</div><div><br></div><div>Prelude ë> let whee x = x == x && null (show x) :: Show a => Eq a => a => Bool
<div><br></div><div><interactive>:<span tabindex="0" class=""><span class="">2:14</span></span>:</div><div>    Couldn't match expected type `a -> Bool' with actual type `Bool'</div><div>    In the expression:</div>

<div>        x == x && null (show x) :: Show a => Eq a => a => Bool</div>
<div>    In an equation for `whee':</div><div>        whee x = x == x && null (show x) :: Show a => Eq a => a => Bool</div></div></blockquote><div><br></div><div>As the error message indicates, the (:: type) is being applied to the open term: x == x && null (show x), and not to the function whee.<br>

</div><div> <br></div><div>To do this single-line def properly, I think you need -XScopedTypeVariables:<br><br>    let whee (x :: a) = x == x && null (show x) :: Show a => Eq a => Bool<br><br></div><div><br>

</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br></div><div>I see now to make it work as a one liner I could do it this way:</div>
<div><div>Prelude ë> :t (\x -> x == x && null (show x)) :: Show a => Eq a => a => Bool</div><div>(\x -> x == x && null (show x)) :: Show a => Eq a => a => Bool</div><div class="">

<div>  :: (Eq a, Show a) => a -> Bool</div></div></div></blockquote></div><br></div><div class="gmail_extra">And to recover the named binding:<br><br>    let whee = (\x -> x == x && null (show x)) :: Show a => Eq a => a => Bool<br>

<br></div><div class="gmail_extra"><br clear="all"><div>-- Kim-Ee</div>
</div></div>