diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index f2cdf0e37..522b36c60 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -585,10 +585,14 @@ compileMPL fp = do runMPL :: FilePath -> IO () runMPL fp = do - cd <- system $ "./" <> dropExtension fp + cd <- system $ prefix <> dropExtension fp case cd of ExitFailure n -> error $ "SML executable failed with code " <> show n ExitSuccess -> pure () + where + prefix = case takeDirectory fp of + "" -> "./" + _ -> "" goSML :: Config -> L1.Prog1 -> (FilePath -> IO a2) -> StateT b IO L1.Prog1 goSML config prog acts = diff --git a/gibbon-compiler/src/Gibbon/L1/GenSML.hs b/gibbon-compiler/src/Gibbon/L1/GenSML.hs index 393137f68..516e9a368 100644 --- a/gibbon-compiler/src/Gibbon/L1/GenSML.hs +++ b/gibbon-compiler/src/Gibbon/L1/GenSML.hs @@ -317,7 +317,9 @@ reduceFunDefs keyword funDef doc = ppMainExpr :: Maybe (Exp1, b) -> Doc ppMainExpr opt = case opt of Nothing -> mempty - Just (exp0, _) -> "val _ = " <> ppE exp0 <> semi + Just (exp0, _) -> + "val _ = " <> ppE exp0 <> semi + <> "\nval _ = print \"\\n\"" ppDDefs :: DDefs1 -> Doc ppDDefs ddefs = case elems ddefs of