[Diffusion] [Committed] rCABAL2863a628f857: Add two local type signatures

Simon Peyton Jones simonpj at microsoft.com
Fri Jul 8 19:46:33 UTC 2016


I don't believe I made this commit, or the ones around it.   Mysterious; I hope I'm not being impersonated!

Simon

From: noreply at phabricator.haskell.org [mailto:noreply at phabricator.haskell.org]
Sent: 08 July 2016 20:43
To: Simon Peyton Jones <simonpj at 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)

COMMIT
https://phabricator.haskell.org/rCABAL2863a628f857

EMAIL PREFERENCES
https://phabricator.haskell.org/settings/panel/emailpreferences/

To: simonpj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160708/0047250c/attachment.html>


More information about the ghc-devs mailing list