Get all of the Haskell files compiling with the new type checker.

Does not actually work, undefined is used in some places as a
stopgap measure.
This commit is contained in:
Evan Czaplicki 2013-07-11 12:48:37 +02:00
parent abaa76943e
commit cb914d91ff
5 changed files with 59 additions and 41 deletions

View file

@ -34,14 +34,16 @@ Library
Language.Elm.Quasi
Hs-Source-Dirs: compiler
other-modules: Unique,
SourceSyntax.Helpers,
SourceSyntax.Location,
SourceSyntax.Literal,
SourceSyntax.Pattern,
SourceSyntax.Expression,
SourceSyntax.Declaration,
SourceSyntax.Expression,
SourceSyntax.Everything,
SourceSyntax.Helpers,
SourceSyntax.Literal,
SourceSyntax.Location,
SourceSyntax.Module,
SourceSyntax.Rename
SourceSyntax.Pattern,
SourceSyntax.Rename,
SourceSyntax.Type,
Generate.JavaScript,
Generate.Noscript,
Generate.Html,
@ -52,21 +54,24 @@ Library
Metadata.LoadLibraries,
Initialize,
Parse.Binop,
Parse.Declaration,
Parse.Expression,
Parse.Foreign,
Parse.Helpers,
Parse.Literal,
Parse.Module,
Parse.Parser,
Parse.Pattern,
Parse.Type,
Types.Alias,
Types.Types,
Types.Constrain,
Types.Hints,
Types.Solver,
Types.Substitutions,
Types.Unify,
Type.Constrain.Declaration,
Type.Constrain.Expression,
Type.Constrain.Literal,
Type.Constrain.Pattern,
Type.Environment,
Type.Fragment,
Type.Solve,
Type.State,
Type.Type,
Type.Unify,
Paths_Elm
Build-depends: base >=4.2 && <5,
@ -84,6 +89,7 @@ Library
mtl >= 2,
pandoc >= 1.10,
parsec >= 3.1.1,
pretty,
shakespeare,
text,
template-haskell,
@ -95,14 +101,16 @@ Executable elm
Main-is: Compiler.hs
Hs-Source-Dirs: compiler
other-modules: Unique,
SourceSyntax.Helpers,
SourceSyntax.Location,
SourceSyntax.Literal,
SourceSyntax.Pattern,
SourceSyntax.Expression,
SourceSyntax.Declaration,
SourceSyntax.Expression,
SourceSyntax.Everything,
SourceSyntax.Helpers,
SourceSyntax.Literal,
SourceSyntax.Location,
SourceSyntax.Module,
SourceSyntax.Rename
SourceSyntax.Pattern,
SourceSyntax.Rename,
SourceSyntax.Type,
Generate.JavaScript,
Generate.Noscript,
Generate.Html,
@ -113,21 +121,24 @@ Executable elm
Metadata.LoadLibraries,
Initialize,
Parse.Binop,
Parse.Declaration,
Parse.Expression,
Parse.Foreign,
Parse.Helpers,
Parse.Literal,
Parse.Module,
Parse.Parser,
Parse.Pattern,
Parse.Type,
Types.Alias,
Types.Types,
Types.Constrain,
Types.Hints,
Types.Solver,
Types.Substitutions,
Types.Unify,
Type.Constrain.Declaration,
Type.Constrain.Expression,
Type.Constrain.Literal,
Type.Constrain.Pattern,
Type.Environment,
Type.Fragment,
Type.Solve,
Type.State,
Type.Type,
Type.Unify,
Paths_Elm
Build-depends: base >=4.2 && <5,
@ -145,6 +156,7 @@ Executable elm
mtl >= 2,
pandoc >= 1.10,
parsec >= 3.1.1,
pretty,
transformers >= 0.2,
union-find,
uniplate
@ -169,6 +181,7 @@ Executable elm-doc
mtl >= 2,
parsec >= 3.1.1,
pandoc >= 1.10,
pretty,
cmdargs,
filepath,
indents

View file

@ -4,16 +4,13 @@ module Main where
import SourceSyntax.Declaration (Declaration(Datatype))
import Control.Applicative ((<$>), (<*>))
import Data.List (intercalate)
import Data.Maybe (catMaybes)
import Types.Types ((==>), Type ( ADT, VarT ) )
import Parse.Type (datatype)
import Parse.Type
import Parse.Helpers
import Parse.Module (moduleDef)
import Text.Parsec hiding (newline,spaces)
import System.Environment
import System.Exit
main = do
srcs <- mapM readFile =<< getArgs
case mapM docParse srcs of
@ -64,11 +61,13 @@ annotation exports =
typeDef = lookAhead ((string "data" <|> string "type") >> whitespace >> capVar)
adt = do
adt = do undefined
{-- TODO: reimplement this
(Datatype name tvs constructors) <- datatype
let toType (cName, typeArgs) =
(cName, show $ foldr (==>) (ADT name $ map VarT tvs) typeArgs, "")
(cName, show $ foldr (==>) (kADT name $ map kVarT tvs) typeArgs, "")
return $ map toType constructors
--}
setupParser p source =
case iParse p "" source of

View file

@ -14,7 +14,6 @@ import Generate.Cases
import SourceSyntax.Everything hiding (parens)
import SourceSyntax.Location as Loc
import Transform.SortDefinitions
import Types.Types ( Type(RecordT) )
showErr :: String -> String
showErr err = globalAssign "Elm.Main" (jsFunc "elm" body)

View file

@ -9,14 +9,21 @@ import SourceSyntax.Everything
import Data.List (intercalate,partition)
import Parse.Parser (parseProgram, parseDependencies)
import qualified Metadata.Libraries as Libs
import Types.Types ((-:))
import Types.Hints (hints)
import Types.Unify (unify)
import Types.Alias (dealias, mistakes)
import Transform.Optimize
import System.Exit
import System.FilePath
{-- TODO: replace with new stuff
import Types.Hints (hints)
import Types.Unify (unify)
import Types.Alias (dealias, mistakes)
--}
mistakes = undefined
unify = undefined
hints = undefined
checkMistakes :: (Data t, Data v) => Module t v -> Either String (Module t v)
checkMistakes modul@(Module name ex im stmts) =
case mistakes stmts of

View file

@ -165,10 +165,10 @@ restore alreadyCopied variable = do
debug $ putStr "Restoring: "
desc <- liftIO $ UF.descriptor variable
if mark desc /= alreadyCopied
then do
then do
debug $ putStrLn "not copied, no need to do anything"
return variable
else do
else do
debug $ putStrLn "restoring"
restoredStructure <-
case structure desc of