-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.hs
30 lines (26 loc) · 793 Bytes
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module Main (main, solveFile) where
import Unify
import Parser
import qualified Data.Text.IO as TIO
import Syntax
import Control.Monad
solveFile :: String -> IO ()
solveFile filename = do
contents <- TIO.readFile filename
let Right parsed = parseProblem contents
let solutions = runUnify (Just 1) (solveProblem parsed)
case solutions of
Left err -> print err
Right sols -> forM_ sols $ \s -> do
putStrLn "***** SOLUTION START ****"
forM_ s $ \(m, t) -> do
putStrLn "meta"
print m
print t
putStrLn "***** SOLUTION END ****"
solveProblem :: ProblemDescription -> Unify [(MetaVar, Term)]
solveProblem desc = do
converted <- liftTC $ convertProblem desc
typeCheckThenUnify converted
main :: IO ()
main = putStrLn "Hello, Haskell!"