<div dir="ltr">I'm more on the beginner side,<div>but reading up on the difference between print and putStrLn, and pure and return.</div><div>Also, understanding the Maybe Monad. </div><div>Finally, reading through some probability randomness examples of rolling dice (for the chapter on State Monad) and seeing how mathematical they look (ie they are similar to how I would reason about them just knowing statistics).</div><div>Oh yeah..and folds. Fold all the things.</div><div>- Krystal</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 July 2018 at 06:46, Vanessa McHale <span dir="ltr"><<a href="mailto:vanessa.mchale@iohk.io" target="_blank">vanessa.mchale@iohk.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>I have several short examples that I quite like:<br>
      <br>
      #1: changes a probability density function into a cumulative
      density function</p>
    <pre><code class="m_-3565511884788950344hljs m_-3565511884788950344rust"><p>cdf :: (Num a) => [a] -> [a]
cdf = <span class="m_-3565511884788950344hljs-built_in">drop</span> <span class="m_-3565511884788950344hljs-number">2</span> . (scanl (+) <span class="m_-3565511884788950344hljs-number">0</span>) . ((:) <span class="m_-3565511884788950344hljs-number">0</span>)

</p></code></pre>
    #2: enumerate all strings on an alphabet (this uses laziness!)<br>
    <pre><code class="m_-3565511884788950344haskell m_-3565511884788950344hljs"><p><span class="m_-3565511884788950344hljs-title">allStrings</span> :: [a] -> [[a]]
<span class="m_-3565511884788950344hljs-title">allStrings</span> = sequence <=< (inits . repeat)
</p></code></pre>
    <h1><code class="m_-3565511884788950344hljs m_-3565511884788950344rust"></code></h1>
    #3: enumerate the Fibonacci numbers (this one uses laziness too)<br>
    <pre><code class="m_-3565511884788950344haskell m_-3565511884788950344hljs"><p><span class="m_-3565511884788950344hljs-title">fibonacci</span> :: (<span class="m_-3565511884788950344hljs-type">Integral</span> a) => [a]
<span class="m_-3565511884788950344hljs-title">fibonacci</span> = <span class="m_-3565511884788950344hljs-number">1</span> : <span class="m_-3565511884788950344hljs-number">1</span> : zipWith (+) fibonacci (tail fibonacci)

</p></code></pre>
    <div class="m_-3565511884788950344moz-cite-prefix">#4: Return all subsets of a list<br>
      <pre><code class="m_-3565511884788950344haskell m_-3565511884788950344hljs"><p><span class="m_-3565511884788950344hljs-title">allSubsets</span> :: [a] -> [[a]]
<span class="m_-3565511884788950344hljs-title">allSubsets</span> = filterM (pure [<span class="m_-3565511884788950344hljs-type">True</span>, <span class="m_-3565511884788950344hljs-type">False</span>])</p></code></pre>
      <br>
      I also have two blog posts I wrote that contain lots of short
      examples. The first contains lots of short-but-interesting
      programs and the second contains examples of how expressive
      Haskell is (by doing the same thing multiple times):<br>
      <br>
      <a class="m_-3565511884788950344moz-txt-link-freetext" href="http://blog.vmchale.com/article/haskell-aphorisms" target="_blank">http://blog.vmchale.com/<wbr>article/haskell-aphorisms</a><br>
      <a class="m_-3565511884788950344moz-txt-link-freetext" href="http://blog.vmchale.com/article/sum" target="_blank">http://blog.vmchale.com/<wbr>article/sum</a><span class=""><br>
      <br>
      On 07/11/2018 07:10 AM, Simon Peyton Jones via Haskell-Cafe wrote:<br>
    </span></div><span class="">
    <blockquote type="cite">
      
      
      
      <div class="m_-3565511884788950344WordSection1">
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Friends<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">In a few
            weeks I’m giving a talk to a bunch of genomics folk at the
            <a href="https://www.sanger.ac.uk/" target="_blank">Sanger
              Institute</a> about Haskell.   They do lots of
            programming, but they aren’t computer scientists.<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">I can
            tell them plenty about Haskell, but I’m ill-equipped to
            answer the main question in their minds:
            <i>why should I even care about Haskell</i>?  I’m too much
            of a biased witness.<br>
            <br>
            <u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">So I
            thought I’d ask you for help.  War stories perhaps â€“ how
            using Haskell worked (or didn’t) for you.  But rather than
            talk generalities, I’d love to illustrate with copious
            examples of beautiful code. <u></u><u></u></span></p>
        <ul style="margin-top:0cm" type="disc">
          <li class="m_-3565511884788950344MsoListParagraph" style="margin-left:0cm"><span style="font-family:"Calibri",sans-serif">Can you
              identify a few lines of Haskell that best characterise
              what you think makes Haskell distinctively worth caring
              about?   Something that gave you an â€œaha” moment, or that
              feeling of joy when you truly make sense of something for
              the first time.<u></u><u></u></span></li>
        </ul>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">The
            challenge is, of course, that this audience will know no
            Haskell, so muttering about Cartesian Closed Categories
            isn’t going to do it for them.  I need examples that I can
            present in 5 minutes, without needing a long setup.<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">To take a
            very basic example, consider Quicksort using list
            comprehensions, compared with its equivalent in C.  It’s so
            short, so obviously right, whereas doing the right thing
            with in-place update in C notoriously prone to fencepost
            errors etc.  But it also makes much less good use of memory,
            and is likely to run slower.  I think I can do that in 5
            minutes.<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Another
            thing that I think comes over easily is the ability to
            abstract: generalising sum and product to fold by
            abstracting out a functional argument; generalising at the
            type level by polymorphism, including polymorphism over
            higher-kinded type constructors.  Â Maybe 8 minutes.<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">But you
            will have more and better ideas, and (crucially) ideas that
            are more credibly grounded in the day to day reality of
            writing programs that get work done.<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Pointers
            to your favourite blog posts would be another avenue.  (I
            love the Haskell Weekly News.)<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Finally,
            I know that some of you use Haskell specifically for
            genomics work, and maybe some of your insights would be
            particularly relevant for the Sanger audience.<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Thank
            you!  Perhaps your responses on this thread (if any) may be
            helpful to more than just me.<u></u><u></u></span></p>
        <p class="MsoNormal"><span style="font-family:"Calibri",sans-serif">Simon<u></u><u></u></span></p>
      </div>
      <br>
      <fieldset class="m_-3565511884788950344mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="m_-3565511884788950344moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
    </blockquote>
  </span></div>

<br>______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.<br></blockquote></div><br></div>