{-# LANGUAGE Safe #-}
module Text.Parsec.Text.Lazy
( Parser, GenParser, parseFromFile
) where
import qualified Data.Text.Lazy as Text
import qualified Data.Text.Lazy.IO as TL
import Text.Parsec.Prim
import Text.Parsec.Error
type Parser = Parsec Text.Text ()
type GenParser st = Parsec Text.Text st
parseFromFile :: Parser a -> FilePath -> IO (Either ParseError a)
parseFromFile :: forall a. Parser a -> FilePath -> IO (Either ParseError a)
parseFromFile Parser a
p FilePath
fname
= do Text
input <- FilePath -> IO Text
TL.readFile FilePath
fname
Either ParseError a -> IO (Either ParseError a)
forall (m :: * -> *) a. Monad m => a -> m a
return (Parser a -> () -> FilePath -> Text -> Either ParseError a
forall s t u a.
Stream s Identity t =>
Parsec s u a -> u -> FilePath -> s -> Either ParseError a
runP Parser a
p () FilePath
fname Text
input)