Lisää yksinkertaiset funktiot TITO-tiedostojen lukemiseen
This commit is contained in:
parent
9d3e6400b9
commit
f9fc39fe8e
@ -1,2 +1,17 @@
|
|||||||
module Data.TITO where
|
module Data.TITO where
|
||||||
|
|
||||||
|
import Control.Exception
|
||||||
|
|
||||||
|
import qualified Data.ByteString as BS
|
||||||
|
import qualified Text.Megaparsec as P
|
||||||
|
|
||||||
|
import Data.TITO.Parser
|
||||||
|
import Data.TITO.Types
|
||||||
|
|
||||||
|
readTITO :: BS.ByteString -> Either ParseErrors TITO
|
||||||
|
readTITO = P.parse tito ""
|
||||||
|
|
||||||
|
readTITOFile :: FilePath -> IO TITO
|
||||||
|
readTITOFile fp =
|
||||||
|
BS.readFile fp >>=
|
||||||
|
either (throwIO . ErrorCall . P.errorBundlePretty) pure . P.parse tito fp
|
||||||
|
Loading…
Reference in New Issue
Block a user