]> Git — Sourcephile - doclang.git/blob - exe/cli/Read.hs
Add References, --trace and other stuffs.
[doclang.git] / exe / cli / Read.hs
1 module Read where
2
3 import Control.Monad.IO.Class (MonadIO(..))
4 import Data.Eq (Eq(..))
5 import Data.Functor ((<$>))
6 import Data.Text (Text)
7 import System.IO (IO, FilePath, hPrint, stderr)
8 import Text.Show (Show(..))
9 import qualified Data.ByteString as BS
10 import qualified Data.Map.Strict as Map
11 import qualified Data.Text.Encoding as Enc
12 -- import qualified System.FilePath as FilePath
13 import qualified Text.Megaparsec as P
14
15
16 readFile :: MonadIO m => FilePath -> (FilePath -> Text -> m a) -> m a
17 readFile fp f = do
18 content <- Enc.decodeUtf8 <$> liftIO (BS.readFile fp)
19 f fp content