diff --git a/blog-meta/lib/YAML.hs b/blog-meta/lib/YAML.hs index 3cec3dc..725d273 100644 --- a/blog-meta/lib/YAML.hs +++ b/blog-meta/lib/YAML.hs @@ -6,7 +6,7 @@ import Data.Text (Text) import qualified Data.Text as Text import Misc import Data.ByteString (ByteString) -import qualified Data.ByteString as BS +import qualified Data.ByteString.Char8 as BS8 import qualified Data.ByteString.Lazy as LazyBS import qualified System.IO as IO @@ -34,7 +34,7 @@ list = Sequence () untagged . map toYAML -- @---@ and a @...@. throw an exception if there isn't one readHeader :: FilePath -> IO (Node Pos) readHeader file = IO.withFile file IO.ReadMode \h -> do - ln <- BS.hGetLine h + ln <- BS8.hGetLine h if (ln /= "---") then fail $ file <> ": no header" else @@ -45,7 +45,7 @@ readHeader file = IO.withFile file IO.ReadMode \h -> do linesUntil :: ByteString -> IO.Handle -> IO LazyBS.ByteString linesUntil end h = go [] where go acc = do - l <- BS.hGetLine h + l <- BS8.hGetLine h if l == end then return $ LazyBS.fromChunks $ reverse acc else