I don’t believe I made this commit, or the ones around it. Mysterious; I hope I’m not being impersonated!
Simon
From: noreply@phabricator.haskell.org [mailto:noreply@phabricator.haskell.org]
Sent: 08 July 2016 20:43
To: Simon Peyton Jones <simonpj@microsoft.com>
Subject: [Diffusion] [Committed] rCABAL2863a628f857: Add two local type signatures
simonpj committed rCABAL2863a628f857: Add two local type signatures (authored by simonpj).
|
Add two local type signatures
I'm adding these type signatures to satisfy the "do not generalise
local let/where" rule that GHC is taking on.
The signatures are clearly correct, but I was surprised at the
polymorphism needed. For example
parseOptVersion :: ReadP r Version
parseOptVersion = parseQuoted ver <++ ver
where ver :: ReadP r Version
ver = parse <++ return noVersion
noVersion = Version{ versionBranch=[], versionTags=[] }
Note that 'ver' really is called at two different types! That
in turn is because of the type of (<++)
(<++) :: ReadP a a -> ReadP r a -> ReadP r a
(+++) :: ReadP r a -> ReadP r a -> ReadP r a
Note the "a a" in the first arg, which is very unusual.
For example, compare the type of (+++).
Changing it to match the type of (+++) makes ReadP fail to compile,
though, so I assume it's right as it stands. But surely this deserves
a comment?!
AFFECTED FILES
/Distribution/ParseUtils.hs
USERS
simonpj (Author)
EMAIL PREFERENCES
To:
simonpj