patch applied (cabal): Add two local type signatures

Ian Lynagh igloo at earth.li
Wed Jul 28 13:21:02 EDT 2010


Wed Jul 28 09:35:39 PDT 2010  simonpj at microsoft/com
  * 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?!
  

    M ./Distribution/ParseUtils.hs -6 +9

View patch online:
http://darcs.haskell.org/cgi-bin/darcsweb.cgi?r=cabal;a=darcs_commitdiff;h=20100728163539-5c9d7-e1a76df3cb7507cdef2e43823b977b90b4c1e54e.gz



More information about the cabal-devel mailing list