Skip to content

Commit

Permalink
Use string-conversions to read migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalii Guzeev committed Sep 22, 2018
1 parent 2370f6f commit 9fbc461
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Database/Schema/Migrations/Filesystem.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import System.Directory ( getDirectoryContents, doesFileExist )
import System.FilePath ( (</>), takeExtension, dropExtension, takeBaseName )
import Data.Text ( Text )
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.ByteString.Char8 as BSC
import Data.String.Conversions ( cs, (<>) )

Expand Down Expand Up @@ -126,7 +125,8 @@ migrationFromPath path = do
getFields :: YamlLight -> [(Text, Text)]
getFields (YMap mp) = map toPair $ Map.assocs mp
where
toPair (YStr k, YStr v) = (T.decodeUtf8 k, T.decodeUtf8 v)
toPair :: (YamlLight, YamlLight) -> (Text, Text)
toPair (YStr k, YStr v) = (cs k, cs v)
toPair (k, v) = throwFS $ "Error in YAML input; expected string key and string value, got " ++ (show (k, v))
getFields _ = throwFS "Error in YAML input; expected mapping"

Expand Down

0 comments on commit 9fbc461

Please sign in to comment.