<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Because if you say that your function accept all types which are
      instances of Num, then it must accept *all* of them. Even those
      who do not define a division, or whose division has a different
      behaviour than the fractional one.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">Le 23/09/2016 à 19:53, Lai Boon Hui a
      écrit :<br>
    </div>
    <blockquote
cite="mid:%3CCAJdQggnoHL7N6xZv1Mi=TVe349d=EhwFe9fumgS8560Vi7SchQ@mail.gmail.com%3E"
      type="cite">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>still does not compile</div>
        <div><br>
        </div>
        <div>
          <div>sumList :: (Fractional a) => [a] -> a</div>
          <div>sumList [] = 0</div>
          <div>sumList (x:xs) = x + (sumList xs)</div>
          <div><br>
          </div>
          <div>lengthList :: (Fractional a) => [t] -> a</div>
          <div>lengthList [] = 0</div>
          <div>lengthList (_:xs) = 1 + (lengthList xs)</div>
          <div><br>
          </div>
          <div>meanList :: (Num a, Fractional b) => [a] -> b</div>
          <div>meanList xs = (sumList xs) / (lengthList xs)</div>
        </div>
        <div><br>
        </div>
        <div>i know </div>
        <div><br>
        </div>
        <div>
          <div>meanList :: (Fractional b) => [b] -> b</div>
          <div>meanList xs = (sumList xs) / (lengthList xs)</div>
        </div>
        <div><br>
        </div>
        <div>compiles. But why do i have to restrict the inputs to be a
          list of Fractionals and not Nums??</div>
        <div><br>
          <div class="gmail_extra"><br>
            <div class="gmail_quote">On Fri, Sep 23, 2016 at 11:18 AM, <span
                dir="ltr"><<a moz-do-not-send="true"
                  href="mailto:beginners-request@haskell.org"
                  target="_blank">beginners-request@haskell.org</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">Send Beginners
                mailing list submissions to<br>
                        <a moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a><br>
                <br>
                To subscribe or unsubscribe via the World Wide Web,
                visit<br>
                        <a moz-do-not-send="true"
                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
                or, via email, send a message with subject or body
                'help' to<br>
                        <a moz-do-not-send="true"
                  href="mailto:beginners-request@haskell.org">beginners-request@haskell.org</a><br>
                <br>
                You can reach the person managing the list at<br>
                        <a moz-do-not-send="true"
                  href="mailto:beginners-owner@haskell.org">beginners-owner@haskell.org</a><br>
                <br>
                When replying, please edit your Subject line so it is
                more specific<br>
                than "Re: Contents of Beginners digest..."<br>
                <br>
                <br>
                Today's Topics:<br>
                <br>
                   1. Re:  Beginners Digest, Vol 99, Issue 13 (Tushar
                Tyagi)<br>
                <br>
                <br>
                ------------------------------<wbr>------------------------------<wbr>----------<br>
                <br>
                Message: 1<br>
                Date: Fri, 23 Sep 2016 09:01:18 +0530<br>
                From: Tushar Tyagi <<a moz-do-not-send="true"
                  href="mailto:tushar4r@gmail.com">tushar4r@gmail.com</a>><br>
                To: The Haskell-Beginners Mailing List - Discussion of
                primarily<br>
                        beginner-level topics related to Haskell <<a
                  moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a>><br>
                Subject: Re: [Haskell-beginners] Beginners Digest, Vol
                99, Issue 13<br>
                Message-ID:<br>
                        <<a moz-do-not-send="true"
href="mailto:CAEDPzikCmLEpiop-5BGbDaKZK1TifAu6ymF%2BjmJq_rEuMNN_Kg@mail.gmail.com">CAEDPzikCmLEpiop-<wbr>5BGbDaKZK1TifAu6ymF+jmJq_<wbr>rEuMNN_Kg@mail.gmail.com</a>><br>
                Content-Type: text/plain; charset="utf-8"<br>
                <br>
                You can read more about Numbers here:<br>
                <a moz-do-not-send="true"
                  href="https://www.haskell.org/tutorial/numbers.html"
                  rel="noreferrer" target="_blank">https://www.haskell.org/<wbr>tutorial/numbers.html</a><br>
                <br>
                In your implementation sumList and lengthList both
                return 'Num' which<br>
                doesn't define a division operator. So you have to
                convert them into<br>
                fractional by either changing the signatures of these 2
                functions from Num<br>
                to Fractional, or use fromIntegral function, (or
                something else) . Two of<br>
                these approaches have been suggested by people here. :)<br>
                <br>
                Typed using my phone, so excuse my brevity.<br>
                <br>
                On 23 Sep 2016 6:14 a.m., "Lai Boon Hui" <<a
                  moz-do-not-send="true"
                  href="mailto:laiboonh@gmail.com">laiboonh@gmail.com</a>>
                wrote:<br>
                <br>
                > Hi All,<br>
                ><br>
                > i am overwhelmed by all the helpful responses.
                Thanks guys.<br>
                ><br>
                > I am more curious about why<br>
                ><br>
                > meanList :: (Num a, Fractional b) => [a] -> b<br>
                > meanList xs = (sumList xs) / (lengthList xs)<br>
                ><br>
                > does not compile.<br>
                ><br>
                > 'a' being a Num type seems perfectly fine, (/)
                returns a Fractional type<br>
                > hence 'b' being Fractional seems also fine.<br>
                ><br>
                ><br>
                ><br>
                > On Fri, Sep 23, 2016 at 7:13 AM, <<a
                  moz-do-not-send="true"
                  href="mailto:beginners-request@haskell.org">beginners-request@haskell.org</a><wbr>>
                wrote:<br>
                ><br>
                >> Send Beginners mailing list submissions to<br>
                >>         <a moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a><br>
                >><br>
                >> To subscribe or unsubscribe via the World Wide
                Web, visit<br>
                >>         <a moz-do-not-send="true"
                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
                >> or, via email, send a message with subject or
                body 'help' to<br>
                >>         <a moz-do-not-send="true"
                  href="mailto:beginners-request@haskell.org">beginners-request@haskell.org</a><br>
                >><br>
                >> You can reach the person managing the list at<br>
                >>         <a moz-do-not-send="true"
                  href="mailto:beginners-owner@haskell.org">beginners-owner@haskell.org</a><br>
                >><br>
                >> When replying, please edit your Subject line so
                it is more specific<br>
                >> than "Re: Contents of Beginners digest..."<br>
                >><br>
                >><br>
                >> Today's Topics:<br>
                >><br>
                >>    1.  Newbie question about function type
                constraints (Lai Boon Hui)<br>
                >>    2. Re:  Newbie question about function type 
                constraints<br>
                >>       (Tushar Tyagi)<br>
                >>    3. Re:  Newbie question about function type 
                constraints<br>
                >>       (Imants Cekusins)<br>
                >>    4. Re:  Newbie question about function type
                constraints<br>
                >>       (Harald Bögeholz)<br>
                >>    5. Re:  Newbie question about function type
                constraints<br>
                >>       (Sylvain Henry)<br>
                >>    6. Re:  Newbie question about function type
                constraints<br>
                >>       (Sylvain Henry)<br>
                >>    7.  The meaning of categories constructed
                from HASK<br>
                >>       (Dimitri DeFigueiredo)<br>
                >><br>
                >><br>
                >> ------------------------------<wbr>------------------------------<wbr>----------<br>
                >><br>
                >> Message: 1<br>
                >> Date: Thu, 22 Sep 2016 21:19:12 +0800<br>
                >> From: Lai Boon Hui <<a
                  moz-do-not-send="true"
                  href="mailto:laiboonh@gmail.com">laiboonh@gmail.com</a>><br>
                >> To: <a moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a><br>
                >> Subject: [Haskell-beginners] Newbie question
                about function type<br>
                >>         constraints<br>
                >> Message-ID:<br>
                >>         <CAJdQgg=jJYfdRsq+QfBr1aC-<wbr>hS1ft9+4Sp4jopoktg=JnDMirg@<wbr>mail.<br>
                >> <a moz-do-not-send="true"
                  href="http://gmail.com" rel="noreferrer"
                  target="_blank">gmail.com</a>><br>
                >> Content-Type: text/plain; charset="utf-8"<br>
                >><br>
                >> Hi, can someone explain to me why i cannot
                define meanList as:<br>
                >><br>
                >> meanList :: (Integral a, Fractional b) =>
                [a] -> a<br>
                >> meanList xs = (sumList xs) / (lengthList xs)<br>
                >><br>
                >> I want to restrict the function to only accept
                lists like [1,2,3] and<br>
                >> return answer 2.0<br>
                >><br>
                >><br>
                >> sumList :: (Num a) => [a] -> a<br>
                >> sumList [] = 0<br>
                >> sumList (x:xs) = x + (sumList xs)<br>
                >><br>
                >> lengthList :: (Num a) => [t] -> a<br>
                >> lengthList [] = 0<br>
                >> lengthList (_:xs) = 1 + (lengthList xs)<br>
                >> -------------- next part --------------<br>
                >> An HTML attachment was scrubbed...<br>
                >> URL: <<a moz-do-not-send="true"
                  href="http://mail.haskell.org/pipermail/beginners/attachments/"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/<wbr>pipermail/beginners/<wbr>attachments/</a><br>
                >> 20160922/45389bc3/attachment-<wbr>0001.html><br>
                >><br>
                >> ------------------------------<br>
                >><br>
                >> Message: 2<br>
                >> Date: Thu, 22 Sep 2016 19:36:04 +0530<br>
                >> From: Tushar Tyagi <<a
                  moz-do-not-send="true"
                  href="mailto:tushar4r@gmail.com">tushar4r@gmail.com</a>><br>
                >> To: The Haskell-Beginners Mailing List -
                Discussion of primarily<br>
                >>         beginner-level topics related to
                Haskell <<a moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a>><br>
                >> Subject: Re: [Haskell-beginners] Newbie
                question about function type<br>
                >>         constraints<br>
                >> Message-ID:<br>
                >>         <CAEDPzin_vcZA+hh9ZLFo-<wbr>k91Bn63vaemgQJKqN_P4hsAk+ALzQ@<wbr>mail.<br>
                >> <a moz-do-not-send="true"
                  href="http://gmail.com" rel="noreferrer"
                  target="_blank">gmail.com</a>><br>
                >> Content-Type: text/plain; charset="utf-8"<br>
                >><br>
                >> What happens if you change the signature of
                meanList to<br>
                >><br>
                >> meanList :: ( Fractional b) => [b] ->b<br>
                >><br>
                >> The integrals in [1,2,3] would be converted to
                [1.0, 2.0, 3.0] before you<br>
                >> act upon them.<br>
                >><br>
                >> On 22 Sep 2016 6:49 p.m., "Lai Boon Hui" <<a
                  moz-do-not-send="true"
                  href="mailto:laiboonh@gmail.com">laiboonh@gmail.com</a>>
                wrote:<br>
                >><br>
                >> Hi, can someone explain to me why i cannot
                define meanList as:<br>
                >><br>
                >> meanList :: (Integral a, Fractional b) =>
                [a] -> a<br>
                >> meanList xs = (sumList xs) / (lengthList xs)<br>
                >><br>
                >> I want to restrict the function to only accept
                lists like [1,2,3] and<br>
                >> return answer 2.0<br>
                >><br>
                >><br>
                >> sumList :: (Num a) => [a] -> a<br>
                >> sumList [] = 0<br>
                >> sumList (x:xs) = x + (sumList xs)<br>
                >><br>
                >> lengthList :: (Num a) => [t] -> a<br>
                >> lengthList [] = 0<br>
                >> lengthList (_:xs) = 1 + (lengthList xs)<br>
                >><br>
                >><br>
                >><br>
                >> ______________________________<wbr>_________________<br>
                >> Beginners mailing list<br>
                >> <a moz-do-not-send="true"
                  href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
                >> <a moz-do-not-send="true"
                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
                >> -------------- next part --------------<br>
                >> An HTML attachment was scrubbed...<br>
                >> URL: <<a moz-do-not-send="true"
                  href="http://mail.haskell.org/pipermail/beginners/attachments/"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/<wbr>pipermail/beginners/<wbr>attachments/</a><br>
                >> 20160922/a092897b/attachment-<wbr>0001.html><br>
                >><br>
                >> ------------------------------<br>
                >><br>
                >> Message: 3<br>
                >> Date: Thu, 22 Sep 2016 16:06:52 +0200<br>
                >> From: Imants Cekusins <<a
                  moz-do-not-send="true" href="mailto:imantc@gmail.com">imantc@gmail.com</a>><br>
                >> To: The Haskell-Beginners Mailing List -
                Discussion of primarily<br>
                >>         beginner-level topics related to
                Haskell <<a moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a>><br>
                >> Subject: Re: [Haskell-beginners] Newbie
                question about function type<br>
                >>         constraints<br>
                >> Message-ID:<br>
                >>         <<a moz-do-not-send="true"
href="mailto:CAP1qinZcONa4X3nozriFYnbkkguRfBmcFp2r3wMoZ6H3aLGGSQ@mail.gm">CAP1qinZcONa4X3nozriFYnbkkguR<wbr>fBmcFp2r3wMoZ6H3aLGGSQ@mail.gm</a><br>
                >> <a moz-do-not-send="true"
                  href="http://ail.com" rel="noreferrer" target="_blank">ail.com</a>><br>
                >> Content-Type: text/plain; charset="utf-8"<br>
                >><br>
                >> Hello,<br>
                >><br>
                >> this works too:<br>
                >><br>
                >> ​meanList :: (Fractional a) => [a] -> a<br>
                >> meanList xs = (sumList xs) / (lengthList xs)<br>
                >><br>
                >><br>
                >> sumList :: (Fractional a) => [a] -> a<br>
                >> sumList [] = 0<br>
                >> sumList (x:xs) = x + (sumList xs)<br>
                >><br>
                >><br>
                >> lengthList :: (Fractional a) => [t] -> a<br>
                >> lengthList [] = 0<br>
                >> lengthList (_:xs) = 1 + (lengthList xs)<br>
                >> -------------- next part --------------<br>
                >> An HTML attachment was scrubbed...<br>
                >> URL: <<a moz-do-not-send="true"
                  href="http://mail.haskell.org/pipermail/beginners/attachments/"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/<wbr>pipermail/beginners/<wbr>attachments/</a><br>
                >> 20160922/4c967a0d/attachment-<wbr>0001.html><br>
                >><br>
                >> ------------------------------<br>
                >><br>
                >> Message: 4<br>
                >> Date: Thu, 22 Sep 2016 16:08:56 +0200<br>
                >> From: Harald Bögeholz <<a
                  moz-do-not-send="true" href="mailto:bo@ct.de">bo@ct.de</a>><br>
                >> To: The Haskell-Beginners Mailing List -
                Discussion of primarily<br>
                >>         beginner-level topics related to
                Haskell <<a moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a>><br>
                >> Subject: Re: [Haskell-beginners] Newbie
                question about function type<br>
                >>         constraints<br>
                >> Message-ID: <<a moz-do-not-send="true"
                  href="mailto:a134a975-6b0f-b364-7db9-6b6a0d99759a@ct.de">a134a975-6b0f-b364-7db9-<wbr>6b6a0d99759a@ct.de</a>><br>
                >> Content-Type: text/plain; charset=utf-8<br>
                >><br>
                >> Am 22.09.16 um 15:19 schrieb Lai Boon Hui:<br>
                >> > Hi, can someone explain to me why i cannot
                define meanList as:<br>
                >> ><br>
                >> > meanList :: (Integral a, Fractional b)
                => [a] -> a<br>
                >> > meanList xs = (sumList xs) / (lengthList
                xs)<br>
                >> ><br>
                >> > I want to restrict the function to only
                accept lists like [1,2,3] and<br>
                >> > return answer 2.0<br>
                >><br>
                >> It will work like this:<br>
                >><br>
                >> meanList :: (Integral a, Fractional b) =>
                [a] -> b<br>
                >> meanList xs = fromIntegral (sumList xs) /
                (lengthList xs)<br>
                >><br>
                >> You probably meant -> b in the type
                signature, that was a typo.<br>
                >><br>
                >> And you need to insert fromIntegral to convert
                to Fractional before you<br>
                >> can divide. Now that I see it I am beginning to
                wonder why it works,<br>
                >> though, because I was just about to insert
                another fromIntegral before<br>
                >> lengthList ...<br>
                >><br>
                >><br>
                >> > sumList :: (Num a) => [a] -> a<br>
                >> > sumList [] = 0<br>
                >> > sumList (x:xs) = x + (sumList xs)<br>
                >> ><br>
                >> > lengthList :: (Num a) => [t] -> a<br>
                >> > lengthList [] = 0<br>
                >> > lengthList (_:xs) = 1 + (lengthList xs)<br>
                >><br>
                >> Hope this helps<br>
                >><br>
                >><br>
                >> --<br>
                >> Harald Bögeholz    <<a
                  moz-do-not-send="true" href="mailto:bo@ct.de">bo@ct.de</a>>
                (PGP key available from servers)<br>
                >> Redaktion c't      Tel.: <a
                  moz-do-not-send="true"
                  href="tel:%2B49%20511%205352-300"
                  value="+495115352300">+49 511 5352-300</a>  Fax: <a
                  moz-do-not-send="true"
                  href="tel:%2B49%20511%205352-417"
                  value="+495115352417">+49 511 5352-417</a><br>
                >><br>
                >>                    int
                f[9814],b,c=9814,g,i;long a=1e4,d,e,h;<br>
                >>                    main(){for(;b=c,c-=14;i=<wbr>printf("%04d",e+d/a),e=d%a)<br>
                >>                   
                while(g=--b*2)d=h*b+a*(i?f[b]:<wbr>a/5),h=d/--g,f[b]=d%g;}<br>
                >>                                               
                           (Arndt/Haenel)<br>
                >><br>
                >>                    Affe Apfel Vergaser<br>
                >><br>
                >> /*Heise Medien GmbH & Co. KG *
                Karl-Wiechert-Allee 10 * 30625 Hannover<br>
                >> Registergericht: Amtsgericht Hannover HRA 26709<br>
                >> Persönlich haftende Gesellschafterin: Heise
                Medien Geschäftsführung GmbH<br>
                >> Registergericht: Amtsgericht Hannover, HRB
                60405<br>
                >> Geschäftsführer: Ansgar Heise, Dr. Alfons
                Schräder*/<br>
                >><br>
                >><br>
                >> ------------------------------<br>
                >><br>
                >> Message: 5<br>
                >> Date: Thu, 22 Sep 2016 16:10:17 +0200<br>
                >> From: Sylvain Henry <<a
                  moz-do-not-send="true" href="mailto:sylvain@haskus.fr">sylvain@haskus.fr</a>><br>
                >> To: <a moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a><br>
                >> Subject: Re: [Haskell-beginners] Newbie
                question about function type<br>
                >>         constraints<br>
                >> Message-ID: <<a moz-do-not-send="true"
                  href="mailto:66b119b3-ff51-74d7-80c5-d19450164508@haskus.fr">66b119b3-ff51-74d7-80c5-<wbr>d19450164508@haskus.fr</a>><br>
                >> Content-Type: text/plain; charset="utf-8";
                Format="flowed"<br>
                >><br>
                >> Hi,<br>
                >><br>
                >> You can define it, but in practice there is no
                instance of "a" that<br>
                >> satisfies both constraints: Integral a and
                Fractional a<br>
                >>  > meanList ([1,2,3] :: [Int])<br>
                >><br>
                >> <interactive>:4:1: error:<br>
                >>      • No instance for (Fractional Int) arising
                from a use of ‘meanList’<br>
                >><br>
                >>  > meanList ([1,2,3] :: [Float])<br>
                >><br>
                >> <interactive>:5:1: error:<br>
                >>      • No instance for (Integral Float) arising
                from a use of ‘meanList’<br>
                >><br>
                >> What you probably want is:<br>
                >> meanList :: (Integral a, Fractional b) =>
                [a] -> b<br>
                >> meanList xs = fromIntegral (sumList xs) /
                fromIntegral (lengthList xs)<br>
                >><br>
                >> Where we convert from the integral type "a" to
                the fractional type "b"<br>
                >> before performing the division.<br>
                >><br>
                >>  > meanList ([1,2,3] :: [Int])<br>
                >> 2.0<br>
                >><br>
                >> Cheers<br>
                >> Sylvain<br>
                >><br>
                >><br>
                >> On 22/09/2016 15:19, Lai Boon Hui wrote:<br>
                >> > Hi, can someone explain to me why i cannot
                define meanList as:<br>
                >> ><br>
                >> > meanList :: (Integral a, Fractional b)
                => [a] -> a<br>
                >> > meanList xs = (sumList xs) / (lengthList
                xs)<br>
                >> ><br>
                >> > I want to restrict the function to only
                accept lists like [1,2,3] and<br>
                >> > return answer 2.0<br>
                >> ><br>
                >> ><br>
                >> > sumList :: (Num a) => [a] -> a<br>
                >> > sumList [] = 0<br>
                >> > sumList (x:xs) = x + (sumList xs)<br>
                >> ><br>
                >> > lengthList :: (Num a) => [t] -> a<br>
                >> > lengthList [] = 0<br>
                >> > lengthList (_:xs) = 1 + (lengthList xs)<br>
                >> ><br>
                >> ><br>
                >> ><br>
                >> ><br>
                >> > ______________________________<wbr>_________________<br>
                >> > Beginners mailing list<br>
                >> > <a moz-do-not-send="true"
                  href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
                >> > <a moz-do-not-send="true"
                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
                >><br>
                >> -------------- next part --------------<br>
                >> An HTML attachment was scrubbed...<br>
                >> URL: <<a moz-do-not-send="true"
                  href="http://mail.haskell.org/pipermail/beginners/attachments/"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/<wbr>pipermail/beginners/<wbr>attachments/</a><br>
                >> 20160922/1be73068/attachment-<wbr>0001.html><br>
                >><br>
                >> ------------------------------<br>
                >><br>
                >> Message: 6<br>
                >> Date: Thu, 22 Sep 2016 16:14:48 +0200<br>
                >> From: Sylvain Henry <<a
                  moz-do-not-send="true" href="mailto:sylvain@haskus.fr">sylvain@haskus.fr</a>><br>
                >> To: <a moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a><br>
                >> Subject: Re: [Haskell-beginners] Newbie
                question about function type<br>
                >>         constraints<br>
                >> Message-ID: <<a moz-do-not-send="true"
                  href="mailto:074cbf97-2316-9d70-3fb8-7c8c9904c602@haskus.fr">074cbf97-2316-9d70-3fb8-<wbr>7c8c9904c602@haskus.fr</a>><br>
                >> Content-Type: text/plain; charset=utf-8;
                format=flowed<br>
                >><br>
                >> On 22/09/2016 16:08, Harald Bögeholz wrote:<br>
                >> > It will work like this:<br>
                >> > meanList :: (Integral a, Fractional b)
                => [a] -> b<br>
                >> > meanList xs = fromIntegral (sumList xs) /
                (lengthList xs)<br>
                >> ><br>
                >> > You probably meant -> b in the type
                signature, that was a typo.<br>
                >> ><br>
                >> > And you need to insert fromIntegral to
                convert to Fractional before you<br>
                >> > can divide. Now that I see it I am
                beginning to wonder why it works,<br>
                >> > though, because I was just about to insert
                another fromIntegral before<br>
                >> > lengthList ...<br>
                >> It works because in this case lengthList uses
                the fractional type b to<br>
                >> perfom its summation (it doesn't care about the
                type of the elements in<br>
                >> xs).<br>
                >><br>
                >> Cheers<br>
                >> Sylvain<br>
                >><br>
                >><br>
                >> ------------------------------<br>
                >><br>
                >> Message: 7<br>
                >> Date: Thu, 22 Sep 2016 17:26:36 -0600<br>
                >> From: Dimitri DeFigueiredo <<a
                  moz-do-not-send="true"
                  href="mailto:defigueiredo@ucdavis.edu">defigueiredo@ucdavis.edu</a>><br>
                >> To: Haskell Cafe <<a moz-do-not-send="true"
                  href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>>,
                The Haskell-Beginners<br>
                >>         Mailing List - Discussion of primarily
                beginner-level topics<br>
                >> related<br>
                >>         to Haskell <<a
                  moz-do-not-send="true"
                  href="mailto:beginners@haskell.org">beginners@haskell.org</a>><br>
                >> Subject: [Haskell-beginners] The meaning of
                categories constructed<br>
                >>         from HASK<br>
                >> Message-ID: <<a moz-do-not-send="true"
                  href="mailto:36383e22-0b32-426d-7c9f-5e611bbca233@ucdavis.edu">36383e22-0b32-426d-7c9f-<wbr>5e611bbca233@ucdavis.edu</a>><br>
                >> Content-Type: text/plain; charset=utf-8<br>
                >><br>
                >> In category theory, there are many ways one can
                make new categories out<br>
                >> of an old one.<br>
                >><br>
                >> In particular, given a category C one can
                construct:<br>
                >><br>
                >> 1. The arrows category of C:<br>
                >>         arrows in C become objects and<br>
                >>         commutative squares in C become arrows<br>
                >> 2. The slice category of C given an object A:<br>
                >>         arrows into a distinguished object A
                become objects in the slice<br>
                >>         commutative triangles become arrows<br>
                >><br>
                >> There are also functors going from C to these
                new categories (and back).<br>
                >><br>
                >> Are these constructed categories useful when C
                = `Hask` (the category of<br>
                >> haskell types and functions)?<br>
                >> What do they represent in programming terms?<br>
                >><br>
                >> In other words, is there intuition for what the
                arrows category of Hask<br>
                >> is?<br>
                >> What about the slice category of Hask over a
                specific type?<br>
                >> Do the functors between these match some
                programming abstractions?<br>
                >><br>
                >> Any pointers are much appreciated.<br>
                >><br>
                >> Thanks,<br>
                >><br>
                >> Dimitri<br>
                >><br>
                >><br>
                >><br>
                >><br>
                >> ------------------------------<br>
                >><br>
                >> Subject: Digest Footer<br>
                >><br>
                >> ______________________________<wbr>_________________<br>
                >> Beginners mailing list<br>
                >> <a moz-do-not-send="true"
                  href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
                >> <a moz-do-not-send="true"
                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
                >><br>
                >><br>
                >> ------------------------------<br>
                >><br>
                >> End of Beginners Digest, Vol 99, Issue 13<br>
                >> ******************************<wbr>***********<br>
                >><br>
                ><br>
                ><br>
                ><br>
                > --<br>
                > Best Regards,<br>
                > Boon Hui<br>
                ><br>
                > ______________________________<wbr>_________________<br>
                > Beginners mailing list<br>
                > <a moz-do-not-send="true"
                  href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
                > <a moz-do-not-send="true"
                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
                ><br>
                ><br>
                -------------- next part --------------<br>
                An HTML attachment was scrubbed...<br>
                URL: <<a moz-do-not-send="true"
href="http://mail.haskell.org/pipermail/beginners/attachments/20160923/7b6523b3/attachment.html"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/<wbr>pipermail/beginners/<wbr>attachments/20160923/7b6523b3/<wbr>attachment.html</a>><br>
                <br>
                ------------------------------<br>
                <br>
                Subject: Digest Footer<br>
                <br>
                ______________________________<wbr>_________________<br>
                Beginners mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
                <a moz-do-not-send="true"
                  href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
                  rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
                <br>
                <br>
                ------------------------------<br>
                <br>
                End of Beginners Digest, Vol 99, Issue 15<br>
                ******************************<wbr>***********<br>
              </blockquote>
            </div>
            <br>
            <br clear="all">
            <div><br>
            </div>
            -- <br>
            <div class="gmail_signature">
              <div dir="ltr">Best Regards,
                <div>Boon Hui</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
ARJANEN Loïc Jean David
<a class="moz-txt-link-freetext" href="http://blog.luigiscorner.com">http://blog.luigiscorner.com</a>
---
“Computer science is no more about computers than astronomy is about telescopes, biology is about microscopes, or chemistry is about beakers and test tubes. Science is not about tools. It is about how we use them, and what we find out when we do.”
Michael R. Fellows and Ian Parberry</pre>
  </body>
</html>