[Hackage] #531: Text.Parsec.Combinators.notFollowedBy too restrictive

Hackage trac at galois.com
Mon Mar 23 13:28:09 EDT 2009


#531: Text.Parsec.Combinators.notFollowedBy too restrictive
----------------------------+-----------------------------------------------
  Reporter:  nzeh           |        Owner:         
      Type:  enhancement    |       Status:  new    
  Priority:  normal         |    Milestone:  _|_    
 Component:  Cabal library  |      Version:  1.6.0.1
  Severity:  minor          |     Keywords:         
Difficulty:  unknown        |   Ghcversion:         
  Platform:                 |  
----------------------------+-----------------------------------------------
 Say, you want to write something like

 {{{
 aParser :: Parser String
 aParser = many1 $ noneOf "a" <|>
                   ( char 'a' >>
                     notFollowedBy $ string "rrgh" >>
                     return 'a'
                   )
 }}}

 This fails because, according to the type signature of notFollowedBy,
 since the parser parses a stream characters, the parser given to
 notFollowedBy must have return type Char, which it doesn't.  The same
 happens for something a little more meaningful such as

 {{{
 nonFinalA :: Parser ()
 nonFinalA = char 'a' >> notFollowedBy eof
 }}}

 because eof has return type ().  This is a request to change the type
 signature of notFollowedBy to accept a parser with arbitrary return type.

 Rationale:
  * The return type is ignored anyway.
  * The return type has only a loose connection with what part of the input
 stream the parser consumes.

-- 
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/531>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects


More information about the cabal-devel mailing list