An Attoparsec compatibility layer for Parsec
Haskell
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/Data/Attoparsec/Text Compatibility with attoparsec 0.11.2.1 (fixes #5) Mar 21, 2014
test
.ghci Use markdown-unlit instead of pandoc-unlit Oct 12, 2012
.gitignore Initial commit Dec 28, 2011
LICENSE Add stringCI Jan 4, 2012
README.lhs Use pandoc-unlit for README Jun 17, 2012
README.markdown Update README, remove travis config May 30, 2017
Setup.lhs Initial commit Dec 28, 2011
attoparsec-parsec.cabal Remove -Werror May 30, 2017

README.markdown

An Attoparsec compatibility layer for Parsec

attoparsec-parsec allows you to write parsers that can be compiled against both Attoparsec and Parsec.

Example:

{-# LANGUAGE CPP #-}
import           Prelude hiding (takeWhile)
import           Data.Text      (Text)
import qualified Data.Text    as Text
import qualified Data.Text.IO as Text

#ifdef USE_ATTOPARSEC
import           Data.Attoparsec.Text
#else
import           Data.Attoparsec.Text.Parsec
#endif

main :: IO ()
main = Text.interact (either error id . parseOnly removeDashes)

removeDashes :: Parser Text
removeDashes = Text.concat `fmap` sepBy text dash
  where
    text = takeWhile  (/= '-')
    dash = takeWhile1 (== '-')