introduced lt in prelude
This commit is contained in:
parent
2cb8527848
commit
fd418faa5f
1 changed files with 83 additions and 72 deletions
33
src/Main.hs
33
src/Main.hs
|
|
@ -1,6 +1,5 @@
|
||||||
{-# LANGUAGE OverloadedRecordDot #-}
|
{-# LANGUAGE OverloadedRecordDot #-}
|
||||||
|
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import AnnForall (annotateForall)
|
import AnnForall (annotateForall)
|
||||||
|
|
@ -19,18 +18,27 @@ import LambdaLifter (lambdaLift)
|
||||||
import Monomorphizer.Monomorphizer (monomorphize)
|
import Monomorphizer.Monomorphizer (monomorphize)
|
||||||
import Renamer.Renamer (rename)
|
import Renamer.Renamer (rename)
|
||||||
import ReportForall (reportForall)
|
import ReportForall (reportForall)
|
||||||
import System.Console.GetOpt (ArgDescr (NoArg, ReqArg),
|
import System.Console.GetOpt (
|
||||||
|
ArgDescr (NoArg, ReqArg),
|
||||||
ArgOrder (RequireOrder),
|
ArgOrder (RequireOrder),
|
||||||
OptDescr (Option), getOpt,
|
OptDescr (Option),
|
||||||
usageInfo)
|
getOpt,
|
||||||
import System.Directory (createDirectory, doesPathExist,
|
usageInfo,
|
||||||
|
)
|
||||||
|
import System.Directory (
|
||||||
|
createDirectory,
|
||||||
|
doesPathExist,
|
||||||
getDirectoryContents,
|
getDirectoryContents,
|
||||||
removeDirectoryRecursive,
|
removeDirectoryRecursive,
|
||||||
setCurrentDirectory)
|
setCurrentDirectory,
|
||||||
|
)
|
||||||
import System.Environment (getArgs)
|
import System.Environment (getArgs)
|
||||||
import System.Exit (ExitCode (ExitFailure),
|
import System.Exit (
|
||||||
exitFailure, exitSuccess,
|
ExitCode (ExitFailure),
|
||||||
exitWith)
|
exitFailure,
|
||||||
|
exitSuccess,
|
||||||
|
exitWith,
|
||||||
|
)
|
||||||
import System.IO (stderr)
|
import System.IO (stderr)
|
||||||
import System.Process (spawnCommand, waitForProcess)
|
import System.Process (spawnCommand, waitForProcess)
|
||||||
import TypeChecker.TypeChecker (TypeChecker (Bi, Hm), typecheck)
|
import TypeChecker.TypeChecker (TypeChecker (Bi, Hm), typecheck)
|
||||||
|
|
@ -93,11 +101,12 @@ main' opts s =
|
||||||
let
|
let
|
||||||
log :: (Print a, Show a) => a -> IO ()
|
log :: (Print a, Show a) => a -> IO ()
|
||||||
log = printToErr . if opts.debug then show else printTree
|
log = printToErr . if opts.debug then show else printTree
|
||||||
in do
|
in
|
||||||
|
do
|
||||||
file <- readFile s
|
file <- readFile s
|
||||||
|
|
||||||
printToErr "-- Parse Tree -- "
|
printToErr "-- Parse Tree -- "
|
||||||
parsed <- fromErr . pProgram . resolveLayout True $ myLexer file
|
parsed <- fromErr . pProgram . resolveLayout True $ myLexer (file ++ prelude)
|
||||||
log parsed
|
log parsed
|
||||||
|
|
||||||
printToErr "-- Desugar --"
|
printToErr "-- Desugar --"
|
||||||
|
|
@ -156,3 +165,5 @@ printToErr = hPutStrLn stderr
|
||||||
|
|
||||||
fromErr :: Err a -> IO a
|
fromErr :: Err a -> IO a
|
||||||
fromErr = either (\s -> printToErr s >> exitFailure) pure
|
fromErr = either (\s -> printToErr s >> exitFailure) pure
|
||||||
|
|
||||||
|
prelude = "const x y = x\n\ndata Bool () where\n True : Bool ()\n False : Bool ()\n\nlt : Int -> Int -> Bool ()\nlt = \\x. \\y. const True (x + y)"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue