[Haskell-cafe] What is your favourite Haskell "aha" moment?
MarLinn
monkleyon at gmail.com
Sat Jul 14 11:33:31 UTC 2018
Warning: I'll be overly harsh in this mail because I assume some people
that are new to Haskell might browse this thread now and in the future.
I don't mean my comments to be considered personal. On the contrary, I
think some of us can learn for their own teaching endeavours.
> #!/usr/bin/env stack
> -- stack script --resolver lts-10.1 --install-ghc
Imagine a "newbie" running this script just to see what it does. After
15 minutes they'll be disappointed why your small demo took so long to
build. Only /then/ do they realize that, what is it today, about half a
gigabyte maybe, of their monthly "high speed" bandwidth and of their
precious space on the cheap but decade-old hard drive is gone.
Of course you need all that data because there's a ghc in that data, but
it should say so on the tin. So please never send a script with this
line to a "newbie" without big warnings so they can make an informed
decision. Maybe they would want to install ghc at their uni to save on
that precious bandwidth at home or something similar.
In fact don't even send scripts with this line to seasoned haskellers.
If your code is compatible with the ghc 8.2.1 on my system, why should
your script assume I want stack to install 8.2.2 right now?
Of course this behaviour is ingrained in the DNA of stack – after all it
values convenience for the professional user more than convenience for
the unprivileged newcomer – but AFAIU it /can/ be persuaded to be more
inclusive. So especially here, we should maybe try to do that.
> interact
> ( show @Double
> . sum
> . mapMaybe readMaybe
> . words
> )
Also, while I do like the scripting possibilities, interact is possibly
the worst way to introduce a newcomer to it because you can't really
test it in ghci. Apart from all the other shortcomings it has. It is
nice in that it hides IO, but…
Again, not meant as an attack, but since we're talking about giving
newcomers a good experience, I thought these two points important.
Cheers,
MarLinn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180714/907ad803/attachment.html>
More information about the Haskell-Cafe
mailing list