[Haskell-cafe] What is your favourite Haskell "aha" moment?

Theodore Lief Gannon tanuki at gmail.com
Wed Jul 11 21:46:34 UTC 2018


Gabriel Gonzalez's "Haskell for Everyone" blog is a wellspring of great
candidates. This one came up in another thread yesterday, as an example of
what you can get from treating IO actions as data:
http://www.haskellforall.com/2018/02/the-wizard-monoid.html

On Wed, Jul 11, 2018, 12:51 PM Jeffrey Brown <jeffbrown.the at gmail.com>
wrote:

> "Blow your mind" on the Haskell Wiki[1] is a collection of short bits of
> awesome code.
>
> [1] https://wiki.haskell.org/Blow_your_mind
>
> On Wed, Jul 11, 2018 at 2:40 PM Chris Smith <cdsmith at gmail.com> wrote:
>
>> I feel like the one theme that's been missing in all of this is the
>> interaction between equational reasoning and rewrite rules.  Examples of
>> fusing operations on Text or ByteString were pretty impressive to me.  The
>> ideas may be incorporated into other languages, but I believe Haskell
>> is pretty unique, at least versus mainstream languages, in doing the fusion
>> in the optimizer where there's still opportunity for the results to be
>> inlined and further optimized.
>>
>> I don't have a complete example off the top of my head.
>>
>> On Wed, Jul 11, 2018 at 3:31 PM Scott Fleischman <
>> scott.fleischman at plowtech.net> wrote:
>>
>>> We make extensive use of Servant for our web services at Plow
>>> Technologies. It is my favorite example of the success of using types (even
>>> relatively fancy types) to help with a common problem (creating web sites
>>> with web services) and reduce boilerplate.
>>>
>>> I like the examples in the tutorial
>>> <https://haskell-servant.readthedocs.io/en/stable/tutorial/index.html>.
>>>
>>> Scott Fleischman
>>>
>>>
>>> On Wed, Jul 11, 2018 at 5:10 AM, Simon Peyton Jones via Haskell-Cafe <
>>> haskell-cafe at haskell.org> wrote:
>>>
>>>> Friends
>>>>
>>>> In a few weeks I’m giving a talk to a bunch of genomics folk at the Sanger
>>>> Institute <https://www.sanger.ac.uk/> about Haskell.   They do lots of
>>>> programming, but they aren’t computer scientists.
>>>>
>>>> I can tell them plenty about Haskell, but I’m ill-equipped to answer
>>>> the 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 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.
>>>>
>>>> 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
>>>> the Haskell Weekly News.)
>>>>
>>>> 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.
>>>>
>>>> Thank you!  Perhaps your responses on this thread (if any) may be
>>>> helpful to more than just me.
>>>>
>>>> Simon
>>>>
>>>> _______________________________________________
>>>> Haskell-Cafe mailing list
>>>> To (un)subscribe, modify options or view archives go to:
>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>> Only members subscribed via the mailman list are allowed to post.
>>>>
>>>
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
>
>
>
> --
> Jeff Brown | Jeffrey Benjamin Brown
> Website <https://msu.edu/~brown202/>   |   Facebook
> <https://www.facebook.com/mejeff.younotjeff>   |   LinkedIn
> <https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often
> miss messages here)   |   Github <https://github.com/jeffreybenjaminbrown>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180711/c84a3951/attachment.html>


More information about the Haskell-Cafe mailing list