Krystal Maughan krystal.maughan at gmail.com
Wed Jul 11 13:55:09 UTC 2018

```I'm more on the beginner side,
but reading up on the difference between print and putStrLn, and pure and
return.
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).
Oh yeah..and folds. Fold all the things.
- Krystal

On 11 July 2018 at 06:46, Vanessa McHale <vanessa.mchale at iohk.io> wrote:

> I have several short examples that I quite like:
>
> #1: changes a probability density function into a cumulative density
> function
>
> cdf :: (Num a) => [a] -> [a]
> cdf = drop 2 . (scanl (+) 0) . ((:) 0)
>
>
> #2: enumerate all strings on an alphabet (this uses laziness!)
>
> allStrings :: [a] -> [[a]]allStrings = sequence <=< (inits . repeat)
>
> #3: enumerate the Fibonacci numbers (this one uses laziness too)
>
> fibonacci :: (Integral a) => [a]fibonacci = 1 : 1 : zipWith (+) fibonacci (tail fibonacci)
>
>
> #4: Return all subsets of a list
>
> allSubsets :: [a] -> [[a]]allSubsets = filterM (pure [True, False])
>
>
> 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):
>
> http://blog.vmchale.com/article/sum
>
> On 07/11/2018 07:10 AM, Simon Peyton Jones via Haskell-Cafe wrote:
>
> Friends
>
> In a few weeks I’m giving a talk to a bunch of genomics folk at the Sanger
> programming, but they aren’t computer scientists.
>
> main question in their minds: *why should I even care about Haskell*?
> I’m too much of a biased witness.
>
> 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.
>
>    - Can you identify a few lines of Haskell that best characterise what
>    gave you an “aha” moment, or that feeling of joy when you truly make sense
>    of something for the first time.
>
> 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.
>
> 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.
>
> 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.
>
> 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.
>
> Pointers to your favourite blog posts would be another avenue.  (I love
>
> 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.
>
> to more than just me.
>
> Simon
>
>
> _______________________________________________
> Only members subscribed via the mailman list are allowed to post.
>
>
> _______________________________________________