{-# LANGUAGE CPP #-}
module Staversion.Internal.Megaparsec
( module Text.Megaparsec,
Parser,
#if MIN_VERSION_megaparsec(7,0,0)
anyChar,
#endif
#if MIN_VERSION_megaparsec(6,0,0)
module Text.Megaparsec.Char,
string,
string'
#endif
) where
import Text.Megaparsec
import Data.Text (Text)
#if MIN_VERSION_megaparsec(6,0,0)
import Data.Text (pack, unpack)
import Data.Void (Void)
import Text.Megaparsec.Char hiding (string, string')
import qualified Text.Megaparsec.Char as MC
type Parser = Parsec (ErrorFancy Void) Text
liftToString :: Monad m => (Text -> m Text) -> String -> m String
liftToString f = fmap unpack . f . pack
string :: String -> Parser String
string = liftToString MC.string
string' :: String -> Parser String
string' = liftToString MC.string'
#elif MIN_VERSION_megaparsec(5,0,0)
type Parser = Parsec Dec Text
#else
type Parser = Parsec Text
#endif
#if MIN_VERSION_megaparsec(7,0,0)
anyChar :: Parser Char
anyChar = anySingle
#endif