parsing cleaner
[minfp.git] / main.icl
index 910de46..30f7d9f 100644 (file)
--- a/main.icl
+++ b/main.icl
@@ -4,7 +4,8 @@ import StdEnv
 import Data.Either
 import Data.Functor
 import Data.Func
-import Control.Monad
+import Text
+import Control.Monad => qualified join
 import System.GetOpt
 import System.CommandLine
 
@@ -24,7 +25,7 @@ chars f
 :: Mode = MHelp | MLex | MParse | MType | MInterpret | MGen
 :: Result
        = Lex [Token]
-       | Parse [Function]
+       | Parse String
        | Type Expression
        | Interpret Value
        | Gen [String]
@@ -51,7 +52,7 @@ Start w
        = case mode of
                MHelp = Left [usageInfo ("Usage: " +++ argv0 +++ " [options]\n") options]
                MLex = Lex <$> lex cs
-               MParse = Parse <$> (lex cs >>= parse)
+               MParse = Parse <$> join "\n" <$> map toString <$> (lex cs >>= parse)
                MType = Type <$> (lex cs >>= parse >>= check)
                MInterpret = Interpret <$> (lex cs >>= parse >>= check >>= int)
                MGen = Gen <$> (lex cs >>= parse >>= check >>= gen)