From 1c2e8f59960c18b5e5794fba214a3f0906fb074d Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Thu, 23 Feb 2023 23:05:54 +1300 Subject: Parsing overhaul (slightly better errors) --- DSL.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'DSL.hs') diff --git a/DSL.hs b/DSL.hs index 54efb28..5d83035 100644 --- a/DSL.hs +++ b/DSL.hs @@ -5,9 +5,7 @@ import DSL.Parsing import DSL.Interpretation interpretFromString :: String -> IO () -interpretFromString = maybe err interpret . stringToProgram - where - err = putStrLn "Unable to parse program" +interpretFromString = either putStrLn interpret . stringToProgram interpretFromFile :: FilePath -> IO () interpretFromFile path = readFile path >>= interpretFromString -- cgit v1.2.1