[Haskell-cafe] GHC Extension Proposal: ArgumentBlock
Francesco Ariis
fa-ml at ariis.it
Sun Sep 6 22:08:54 UTC 2015
On Sun, Sep 06, 2015 at 02:33:28PM -0430, Manuel Gómez wrote:
> It seems to me that lately the community’s visible attitude has
> shifted toward a heightened value of stability and uniformity for
> Haskell and its software ecosystem, and experimentation, fragmentation
> and diversity in styles and dialects are now viewed as threatening.
> This drives us to reject the process of gradual improvement that has
> made Haskell great over the years. Other similarly purely syntactic
> extensions seem to me to have been met with less resistance in the
> past. It appears we’re now far more concerned with the pursuit of
> success.
>
> +1
Hello Manuel,
your post made me clearly realise why I am sometimes unhappy about
syntactic extensions, so I'll take advantage of this discussion to
illustrate my point.
I don't recall the exact details, but a few months ago I was writing a
small patch for a Haskell project I liked. Datatypes were simple, e.g.:
data SomeData = SomeData {
somedataName :: String
, somedataVersion :: Int
, somedataSynopsis :: Maybe String
, somedataDescription :: Maybe String
, somedataHomepage :: Maybe String
, somedataBugReports :: Maybe String
-- etc, etc.
In the where part of the (long) top level function, I found an
expression similar to this:
-- there was no type sig there
alfa = ("version", somedataVersion)
A tuple with a String and an accessor `SomeData -> Int`, ok.
Somewhere else this pops out:
let beta = 7 + snd alfa
What? For sure something is wrong, this program shouldn't compile! It
should be:
let beta = 7 + (snd alfa) myData
I fired ghci, loaded the project and it turns out I was right and ghc wrong!
λ> :t ("s", somedataVersion)
("s", somedataVersion) :: (String , SomeData -> Int)
What was happening? A conspicuous bug in ghc (which was exploited in
a weird way by the project developer)? Hallucinations? Not really!
It turns out that in the top of the file, which looked like:
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}
I missed the `RecordWildCards` extension. RecordWildCards allows these
kind of patterns:
f (C {a = 1, ..}) = b + c + d
-- shame on me for not checking extensions first!
This long introduction to make my point :P
> It seems to me that lately the community’s visible attitude has
> shifted toward a heightened value of stability and uniformity for
> Haskell and its software ecosystem, and experimentation, fragmentation
> and diversity in styles and dialects are now viewed as threatening.
> This drives us to reject the process of gradual improvement that has
> made Haskell great over the years.
Even though they aren't as 'dangerous' as other well known extensions,
5 small syntactic extensions potentially create 31 dialects which will
make me trip in many different ways. One of the reason I like Haskell is
because it's a joy to read other people's code (unlike other languages
where I don't even try, so daunting is the challenge).
I think it is healthy to have a thorough discussion for each one of the
proposed extensions and most importantly study what we are trying to
accomplish and see if there is a way to reach the same goal(s) with a
smaller set of orthogonal changes.
And yes, to err on the conservative side and say 'no' if the benefit
isn't worth the additional fragmentation.
I understand the fact that Haskell is meant to be an always evolving
language: this is awesome and I like it. I like it even more when
the community goes forward *together*! [1]
Sorry for the long rant (phew, it took more words than necessary)!
As written above, your message cleared my mind so I decided to share my
thoughts, maybe they can be helpful to the discussion.
[1] be it a Standard like H2010, a well thought out migration-path
for changes like BPP, a stricter and curated selection for
extensions, etc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150907/5edccc60/attachment-0001.sig>
More information about the Haskell-Cafe
mailing list