#5041: Incorrect Read deriving for MagicHash constructors
---------------------------------+------------------------------------------
    Reporter:  dolio             |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:  7.2.1       
   Component:  Compiler          |      Version:  7.0.2       
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------
Changes (by simonpj):

  * milestone:  => 7.2.1


Comment:

 The difficulty here is that `lexId` in the library `Text.Read.Lex` doesn't
 recognise `A#` as a lexeme.

 I can't see an obviously good workaround for this. The library can't
 change with different GHC flags. Alternatives:

  * When GHC does 'Show' for a constructor `A#`, make it spit out some
 funny escape sequence like `A_hash`.  (And dually for reading.)  But that
 is no fun.  The ASCII in the file would look odd to a human, and human-
 written stuff like `A#` would fail.

  * Simply fix `Text.Reader.Lex` to recognise a postfix hash as a legal
 lexeme.  The downside here is that `lex` ought to parse `a+x#c` as five
 single-character lexemes, so we'd be changing the behaviour away from H98.

  * Like the previous idea, but make a copy of `Text.Reader.Lex` and invoke
 that when building derived `Read` instances.  The original `lex` would
 stay unchanged.  In effect we'd just have a new function
 `lexWithTrailingHashes`.   Actually you would not need to copy all of it,
 by a long chalk; but there'd be a little duplication.

 My suggestion would be to follow the third plan. Anyone who cares, feel
 free to express an opinion.

 Once we've decided, executing the fix should be easy, so I'll milestone
 for 7.2

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5041#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to