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

Alexey Raga alexey.raga at gmail.com
Thu Jul 12 14:04:20 UTC 2018


> Alexey, could you expand on what you mean in your first point?

I guess that I meant two things here.

First is that when I wrote a signature for my function, the compiler will
make its best to help me implement it. It will yell at me, it will not let
me use things that I am not supposed to use (according to constraints),
etc.
More precise I am with my types (e.g. use non-empty list instead of just
list, use specific ADT instead of Bools, use Age/Weight/Size instead of
Int, etc.) - more help I get.

Another thing is that sometimes I'd just play "Type Tetris" to make things
compile and work. Try something, the compiler says "No, can't have this",
perhaps make a suggestion, try another thing, "aha, next step", etc.
Learned so much from these "games" :)

Regards,
Alexey.

On Thu, Jul 12, 2018 at 11:04 PM Brett Gilio <brettg at posteo.net> wrote:

> Alexey, could you expand on what you mean in your first point? I am
> quite intrigued. I do not use Haskell often, but that could be something
> of interest to me in-and-out of Haskell.
>
> Brett Gilio
> brettg at posteo.net | bmg at member.fsf.org
> Free Software -- Free Society!
>
> On 07/12/2018 07:46 AM, Alexey Raga wrote:
> > Not sure if it counts as "aha moments", but when I started with Haskell
> > I had two major reasons (not in any importance order):
> >
> > 1. The ability to define the specification (types) and then "just"
> > follow them in implementation. Sometimes even without having a clear
> > understanding of the things I was using, I felt (and still feel) guided
> > towards the right solution.
> >
> > 2. The ability to refactor fearlessly is a _massive_ productivity boost.
> > Hard to underestimate.
> >
> > Regards,
> > Alexey.
> >
> > On Wed, Jul 11, 2018 at 10:10 PM Simon Peyton Jones via Haskell-Cafe
> > <haskell-cafe at haskell.org <mailto: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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180713/42dcdd73/attachment.html>


More information about the Haskell-Cafe mailing list