13 lines
370 B
Haskell
13 lines
370 B
Haskell
{-# LANGUAGE ScopedTypeVariables #-}
|
|
module Language.Yanais.Parser.IO (
|
|
parseFile
|
|
) where
|
|
|
|
import qualified Data.ByteString.Char8 as C
|
|
import qualified Language.Yanais.Parser as P
|
|
|
|
parseFile :: String -> P.Parser' e a -> IO (Either e a)
|
|
parseFile f p = do
|
|
contents <- C.readFile f
|
|
let pe = P.makeParseEnv contents
|
|
return (fmap (\(r, _) -> r) $ P.runParser pe p)
|