Make parseAndRun nicer to use in ghci

It now no longer requires -XOverloadedStrings
This commit is contained in:
Joscha 2020-12-14 11:16:26 +00:00
parent 54214ed10c
commit bf50628483

View file

@ -11,13 +11,13 @@ import Propa.Prolog.Display
import Propa.Prolog.Parse import Propa.Prolog.Parse
import Propa.Prolog.Unify import Propa.Prolog.Unify
parseAndRun :: T.Text -> T.Text -> IO () parseAndRun :: String -> String -> IO ()
parseAndRun dbText statsText = T.putStrLn $ case results of parseAndRun dbStr statsStr = T.putStrLn $ case results of
Left e -> e Left e -> e
Right [] -> "No." Right [] -> "No."
Right rs -> T.intercalate "\n" rs Right rs -> T.intercalate "\n" rs
where where
results = do results = do
db <- parseDb "<input>" dbText db <- parseDb "<db>" $ T.pack dbStr
stats <- parseStats "<input>" statsText stats <- parseStats "<query>" $ T.pack statsStr
pure $ map displayResult $ run db stats pure $ map displayResult $ run db stats