<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Duh! <div class="">Give that man a ceeeegar! </div><div class="">Thanks</div><div class="">:)</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 8 Nov 2017, at 19:31, David McBride <<a href="mailto:toad3k@gmail.com" class="">toad3k@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">The only thing I can think of is that you wrote a Num instance for Fraction. That allows it to represent a fraction as a literal 2 because you can create a fraction from an integer via fromInteger.<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Nov 8, 2017 at 2:21 PM, mike h <span dir="ltr" class=""><<a href="mailto:mike_k_houghton@yahoo.co.uk" target="_blank" class="">mike_k_houghton@yahoo.co.uk</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 ..8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br class="">
<br class="">
I’m modelling fractions with a view to looking at continued fractions and I have this recursive structure.<br class="">
<br class="">
type Numerator = Integer<br class="">
data Fraction = Numbr Integer | F Numerator Fraction<br class="">
<br class="">
<br class="">
in ghci I do<br class="">
<br class="">
λ-> :t F 1 (Numbr 2)<br class="">
F 1 (Numbr 2) :: Fraction<br class="">
<br class="">
which is fine. But what surprised me is that it also works without using Numbr e.g.<br class="">
<br class="">
λ-> :t F 1 2<br class="">
F 1 2 :: Fraction<br class="">
<br class="">
why is this?<br class="">
<br class="">
Thanks<br class="">
<br class="">
Mike<br class="">
______________________________<wbr class="">_________________<br class="">
Beginners mailing list<br class="">
<a href="mailto:Beginners@haskell.org" class="">Beginners@haskell.org</a><br class="">
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank" class="">http://mail.haskell.org/cgi-<wbr class="">bin/mailman/listinfo/beginners</a><br class="">
</blockquote></div><br class=""></div>
_______________________________________________<br class="">Beginners mailing list<br class=""><a href="mailto:Beginners@haskell.org" class="">Beginners@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners<br class=""></div></blockquote></div><br class=""></div></body></html>