Commit 54dcdba2 authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Compilation errors removed

parent 7e5d0d97
...@@ -149,11 +149,11 @@ visitExpr _ aEnv _ = aEnv ...@@ -149,11 +149,11 @@ visitExpr _ aEnv _ = aEnv
visitStatement :: ModuleIdent -> ArityEnv -> Statement -> ArityEnv visitStatement :: ModuleIdent -> ArityEnv -> Statement -> ArityEnv
visitStatement mid aEnv (StmtExpr _ expr) visitStatement mid aEnv (StmtExpr _ expr)
= visitExpression mid aEnv expr = visitExpr mid aEnv expr
visitStatement mid aEnv (StmtDecl decls) visitStatement mid aEnv (StmtDecl decls)
= foldl (visitDecl mid) aEnv decls = foldl (visitDecl mid) aEnv decls
visitStatement mid aEnv (StmtBind _ _ expr) visitStatement mid aEnv (StmtBind _ _ expr)
= visitExpression mid aEnv expr = visitExpr mid aEnv expr
visitAlt :: ModuleIdent -> ArityEnv -> Alt -> ArityEnv visitAlt :: ModuleIdent -> ArityEnv -> Alt -> ArityEnv
visitAlt mid aEnv (Alt _ _ rhs) = visitRhs mid aEnv rhs visitAlt mid aEnv (Alt _ _ rhs) = visitRhs mid aEnv rhs
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
module CompilerOpts module CompilerOpts
( Options (..), Verbosity (..), TargetType (..), Extension (..) ( Options (..), Verbosity (..), TargetType (..), Extension (..)
, DumpLevel (..), defaultOptions, compilerOpts, usage , DumpLevel (..), defaultOptions, compilerOpts, usage
, implicitPrelude
) where ) where
import Data.List (nub) import Data.List (nub)
...@@ -29,7 +28,7 @@ data Options = Options ...@@ -29,7 +28,7 @@ data Options = Options
, optForce :: Bool -- ^ force compilation , optForce :: Bool -- ^ force compilation
, optImportPaths :: [FilePath] -- ^ directories for imports , optImportPaths :: [FilePath] -- ^ directories for imports
, optOutput :: Maybe FilePath -- ^ name of output file , optOutput :: Maybe FilePath -- ^ name of output file
, optUseSubdir :: Bool -- use subdir for output? , optUseSubdir :: Bool -- ^ use subdir for output?
, optInterface :: Bool -- ^ do not create an interface file , optInterface :: Bool -- ^ do not create an interface file
, optWarn :: Bool -- ^ warnings on/off , optWarn :: Bool -- ^ warnings on/off
, optOverlapWarn :: Bool -- ^ "overlap" warnings on/off , optOverlapWarn :: Bool -- ^ "overlap" warnings on/off
......
...@@ -23,9 +23,7 @@ In this section a lexer for Curry is implemented. ...@@ -23,9 +23,7 @@ In this section a lexer for Curry is implemented.
> import Data.Char (chr, ord, isAlpha, isAlphaNum, isSpace, isUpper > import Data.Char (chr, ord, isAlpha, isAlphaNum, isSpace, isUpper
> , isDigit, isOctDigit, isHexDigit) > , isDigit, isOctDigit, isHexDigit)
> import Data.List (intercalate) > import Data.List (intercalate)
> import qualified Data.Map as Map (Map, union, lookup, fromList > import qualified Data.Map as Map (Map, union, lookup, fromList)
> , findWithDefault)
> import Data.Maybe (fromMaybe)
> import Curry.Base.LexComb > import Curry.Base.LexComb
> import Curry.Base.LLParseComb (Symbol (..)) > import Curry.Base.LLParseComb (Symbol (..))
...@@ -50,9 +48,9 @@ In this section a lexer for Curry is implemented. ...@@ -50,9 +48,9 @@ In this section a lexer for Curry is implemented.
> data Category > data Category
> -- literals > -- literals
> = CharTok > = CharTok
> | IntTok > | IntTok
> | FloatTok > | FloatTok
> | IntegerTok > | IntegerTok
> | StringTok > | StringTok
> -- identifiers > -- identifiers
...@@ -62,7 +60,7 @@ In this section a lexer for Curry is implemented. ...@@ -62,7 +60,7 @@ In this section a lexer for Curry is implemented.
> | QSym -- qualified symbol > | QSym -- qualified symbol
> -- punctuation symbols > -- punctuation symbols
> | LeftParen -- ( > | LeftParen -- (
> | RightParen -- ) > | RightParen -- )
> | Semicolon -- ; > | Semicolon -- ;
> | LeftBrace -- { > | LeftBrace -- {
...@@ -84,24 +82,24 @@ In this section a lexer for Curry is implemented. ...@@ -84,24 +82,24 @@ In this section a lexer for Curry is implemented.
> | KW_choice -- deprecated > | KW_choice -- deprecated
> | KW_data > | KW_data
> -- | KW_deriving -- not supported yet > -- | KW_deriving -- not supported yet
> | KW_do > | KW_do
> | KW_else > | KW_else
> | KW_eval -- deprecated > | KW_eval -- deprecated
> | KW_external > | KW_external
> | KW_free > | KW_free
> | KW_if > | KW_if
> | KW_import > | KW_import
> | KW_in > | KW_in
> | KW_infix > | KW_infix
> | KW_infixl > | KW_infixl
> | KW_infixr > | KW_infixr
> -- | KW_instance -- not supported yet > -- | KW_instance -- not supported yet
> | KW_let > | KW_let
> | KW_module > | KW_module
> | KW_newtype > | KW_newtype
> | KW_of > | KW_of
> | KW_rigid -- deprecated > | KW_rigid -- deprecated
> | KW_then > | KW_then
> | KW_type > | KW_type
> | KW_where > | KW_where
...@@ -119,11 +117,11 @@ In this section a lexer for Curry is implemented. ...@@ -119,11 +117,11 @@ In this section a lexer for Curry is implemented.
> -- | Context -- => -- not supported yet > -- | Context -- => -- not supported yet
> -- special identifiers > -- special identifiers
> | Id_as > | Id_as
> | Id_ccall > | Id_ccall
> | Id_forall > | Id_forall
> | Id_hiding > | Id_hiding
> | Id_interface > | Id_interface
> | Id_primitive > | Id_primitive
> | Id_qualified > | Id_qualified
...@@ -137,7 +135,7 @@ In this section a lexer for Curry is implemented. ...@@ -137,7 +135,7 @@ In this section a lexer for Curry is implemented.
> | Pragma > | Pragma
> -- comments (only for full lexer) inserted by men & bbr > -- comments (only for full lexer) inserted by men & bbr
> | LineComment > | LineComment
> | NestedComment > | NestedComment
> -- end-of-file token > -- end-of-file token
...@@ -170,7 +168,7 @@ attribute values, we make use of records. ...@@ -170,7 +168,7 @@ attribute values, we make use of records.
> showsPrec _ (FloatAttributes fv _) = shows fv > showsPrec _ (FloatAttributes fv _) = shows fv
> showsPrec _ (IntegerAttributes iv _) = shows iv > showsPrec _ (IntegerAttributes iv _) = shows iv
> showsPrec _ (StringAttributes sv _) = shows sv > showsPrec _ (StringAttributes sv _) = shows sv
> showsPrec _ (IdentAttributes mIdent ident) = showsEscaped > showsPrec _ (IdentAttributes mIdent ident) = showsEscaped
> $ intercalate "." > $ intercalate "."
> $ mIdent ++ [ident] > $ mIdent ++ [ident]
...@@ -236,9 +234,6 @@ all tokens in their source representation. ...@@ -236,9 +234,6 @@ all tokens in their source representation.
-- Helper for showing -- Helper for showing
> showsQualified :: [String] -> String -> ShowS
> showsQualified modul ident = showsEscaped $ intercalate "." $ modul ++ [ident]
> showsEscaped :: String -> ShowS > showsEscaped :: String -> ShowS
> showsEscaped s = showChar '`' . showString s . showChar '\'' > showsEscaped s = showChar '`' . showString s . showChar '\''
...@@ -256,10 +251,10 @@ all tokens in their source representation. ...@@ -256,10 +251,10 @@ all tokens in their source representation.
> instance Show Token where > instance Show Token where
> showsPrec _ (Token Id a) = showsIdentifier a > showsPrec _ (Token Id a) = showsIdentifier a
> showsPrec _ (Token QId a) = showString "qualified " > showsPrec _ (Token QId a) = showString "qualified "
> . showsIdentifier a > . showsIdentifier a
> showsPrec _ (Token Sym a) = showsOperator a > showsPrec _ (Token Sym a) = showsOperator a
> showsPrec _ (Token QSym a) = showString "qualified " > showsPrec _ (Token QSym a) = showString "qualified "
> . showsOperator a > . showsOperator a
> showsPrec _ (Token IntTok a) = showString "integer " . shows a > showsPrec _ (Token IntTok a) = showString "integer " . shows a
> showsPrec _ (Token FloatTok a) = showString "float " . shows a > showsPrec _ (Token FloatTok a) = showString "float " . shows a
...@@ -276,11 +271,11 @@ all tokens in their source representation. ...@@ -276,11 +271,11 @@ all tokens in their source representation.
> showsPrec _ (Token Comma _) = showsEscaped "," > showsPrec _ (Token Comma _) = showsEscaped ","
> showsPrec _ (Token Underscore _) = showsEscaped "_" > showsPrec _ (Token Underscore _) = showsEscaped "_"
> showsPrec _ (Token Backquote _) = showsEscaped "`" > showsPrec _ (Token Backquote _) = showsEscaped "`"
> showsPrec _ (Token LeftBraceSemicolon _) = showsEscaped "{;" > showsPrec _ (Token LeftBraceSemicolon _) = showsEscaped "{;"
> . showString " (turn off layout)" > . showString " (turn off layout)"
> showsPrec _ (Token VSemicolon _) = showsEscaped ";" > showsPrec _ (Token VSemicolon _) = showsEscaped ";"
> . showString " (inserted due to layout)" > . showString " (inserted due to layout)"
> showsPrec _ (Token VRightBrace _) = showsEscaped "}" > showsPrec _ (Token VRightBrace _) = showsEscaped "}"
> . showString " (inserted due to layout)" > . showString " (inserted due to layout)"
> showsPrec _ (Token At _) = showsEscaped "@" > showsPrec _ (Token At _) = showsEscaped "@"
> showsPrec _ (Token DotDot _) = showsEscaped ".." > showsPrec _ (Token DotDot _) = showsEscaped ".."
...@@ -342,7 +337,7 @@ Maps for reserved operators and identifiers ...@@ -342,7 +337,7 @@ Maps for reserved operators and identifiers
> , ("..", DotDot ) > , ("..", DotDot )
> , ("=" , Equals ) > , ("=" , Equals )
> , ("\\", Backslash ) > , ("\\", Backslash )
> , ("|" , Bar ) > , ("|" , Bar )
> , ("<-", LeftArrow ) > , ("<-", LeftArrow )
> , ("->", RightArrow ) > , ("->", RightArrow )
> , ("~" , Tilde ) > , ("~" , Tilde )
...@@ -370,7 +365,7 @@ Maps for reserved operators and identifiers ...@@ -370,7 +365,7 @@ Maps for reserved operators and identifiers
> , ("external", KW_external) > , ("external", KW_external)
> , ("free" , KW_free ) > , ("free" , KW_free )
> , ("if" , KW_if ) > , ("if" , KW_if )
> , ("import" , KW_import ) > , ("import" , KW_import )
> , ("in" , KW_in ) > , ("in" , KW_in )
> , ("infix" , KW_infix ) > , ("infix" , KW_infix )
> , ("infixl" , KW_infixl ) > , ("infixl" , KW_infixl )
...@@ -540,7 +535,7 @@ Lexing functions ...@@ -540,7 +535,7 @@ Lexing functions
> lexSymbol :: (Token -> P a) -> P a > lexSymbol :: (Token -> P a) -> P a
> lexSymbol cont p s = > lexSymbol cont p s =
> cont (idTok (maybe Sym id (Map.lookup sym keywordsSpecialIds)) [] sym) > cont (idTok (maybe Sym id (Map.lookup sym reservedSpecialOps)) [] sym)
> (incr p (length sym)) rest > (incr p (length sym)) rest
> where (sym,rest) = span isSymbol s > where (sym,rest) = span isSymbol s
......
...@@ -726,7 +726,7 @@ qconop = qConSym <|> backquotes (qConId <?> "operator name expected") ...@@ -726,7 +726,7 @@ qconop = qConSym <|> backquotes (qConId <?> "operator name expected")
> sym :: Parser Token Ident a > sym :: Parser Token Ident a
> sym = (\ pos -> mkIdentPosition pos . sval) <$> position <*> > sym = (\ pos -> mkIdentPosition pos . sval) <$> position <*>
> tokens [Sym,Sym_Dot,Sym_Minus,Sym_MinusDot] > tokens [Sym, SymColon, SymDot, SymMinus, SymMinusDot]
> qSym :: Parser Token QualIdent a > qSym :: Parser Token QualIdent a
> qSym = qualify <$> sym <|> mkQIdent <$> position <*> token QSym > qSym = qualify <$> sym <|> mkQIdent <$> position <*> token QSym
...@@ -735,15 +735,15 @@ qconop = qConSym <|> backquotes (qConId <?> "operator name expected") ...@@ -735,15 +735,15 @@ qconop = qConSym <|> backquotes (qConId <?> "operator name expected")
> colon :: Parser Token QualIdent a > colon :: Parser Token QualIdent a
> colon = (\ p _ -> qualify $ addPositionIdent p consId) <$> > colon = (\ p _ -> qualify $ addPositionIdent p consId) <$>
> position <*> token Colon > position <*> token SymColon
> minus :: Parser Token Ident a > minus :: Parser Token Ident a
> minus = (\ p _ -> addPositionIdent p minusId) <$> > minus = (\ p _ -> addPositionIdent p minusId) <$>
> position <*> token Sym_Minus > position <*> token SymMinus
> fminus :: Parser Token Ident a > fminus :: Parser Token Ident a
> fminus = (\ p _ -> addPositionIdent p fminusId) <$> > fminus = (\ p _ -> addPositionIdent p fminusId) <$>
> position <*> token Sym_MinusDot > position <*> token SymMinusDot
> tupleCommas :: Parser Token QualIdent a > tupleCommas :: Parser Token QualIdent a
> tupleCommas = (\ p -> qualify . addPositionIdent p . tupleId . succ . length ) > tupleCommas = (\ p -> qualify . addPositionIdent p . tupleId . succ . length )
......
...@@ -16,7 +16,7 @@ import Curry.Files.Filenames ...@@ -16,7 +16,7 @@ import Curry.Files.Filenames
import Curry.Files.PathUtils ( dropExtension, doesModuleExist, lookupCurryFile import Curry.Files.PathUtils ( dropExtension, doesModuleExist, lookupCurryFile
, getModuleModTime, tryGetModuleModTime) , getModuleModTime, tryGetModuleModTime)
import CompilerOpts (Options (..), Extension (..), TargetType (..)) import CompilerOpts (Options (..), TargetType (..))
import CurryDeps (Source (..), flatDeps) import CurryDeps (Source (..), flatDeps)
import Messages (status, abortWith) import Messages (status, abortWith)
import Modules (compileModule) import Modules (compileModule)
...@@ -27,7 +27,7 @@ import Modules (compileModule) ...@@ -27,7 +27,7 @@ import Modules (compileModule)
-} -}
buildCurry :: Options -> FilePath -> IO () buildCurry :: Options -> FilePath -> IO ()
buildCurry opts file = do buildCurry opts file = do
mbFile <- lookupCurryFile importPaths file mbFile <- lookupCurryFile (optImportPaths opts) file
case mbFile of case mbFile of
Nothing -> abortWith [missingModule file] Nothing -> abortWith [missingModule file]
Just f -> do Just f -> do
...@@ -85,13 +85,13 @@ makeCurry opts deps1 targetFile = mapM_ (compile . snd) deps1 where ...@@ -85,13 +85,13 @@ makeCurry opts deps1 targetFile = mapM_ (compile . snd) deps1 where
compileFile f = do compileFile f = do
status opts $ "compiling " ++ f status opts $ "compiling " ++ f
compileModule (compOpts True) f >> return () compileModule (compOpts True) f
skipFile f = status opts $ "skipping " ++ f skipFile f = status opts $ "skipping " ++ f
generateFile f = do generateFile f = do
status opts $ "generating " ++ head (targetNames f) status opts $ "generating " ++ head (targetNames f)
compileModule (compOpts False) f >> return () compileModule (compOpts False) f
compOpts isImport compOpts isImport
| isImport = opts { optTargetTypes = [FlatCurry], optDumps = [] } | isImport = opts { optTargetTypes = [FlatCurry], optDumps = [] }
......
...@@ -42,7 +42,7 @@ dependencies and to update programs composed of multiple modules. ...@@ -42,7 +42,7 @@ dependencies and to update programs composed of multiple modules.
> mEnv <- deps implicitPrelude [] libPaths Map.empty fn > mEnv <- deps implicitPrelude [] libPaths Map.empty fn
> return $ flattenDeps mEnv > return $ flattenDeps mEnv
> where > where
> implicitPrelude = NoImplicitPrelude `notElem` optExtensions otps > implicitPrelude = NoImplicitPrelude `notElem` optExtensions opts
> libPaths = optImportPaths opts > libPaths = optImportPaths opts
> deps :: Bool -> [FilePath] -> [FilePath] -> SourceEnv -> FilePath > deps :: Bool -> [FilePath] -> [FilePath] -> SourceEnv -> FilePath
......
...@@ -87,12 +87,11 @@ makeInterfaces paths (CS.Module mid _ decls) = do ...@@ -87,12 +87,11 @@ makeInterfaces paths (CS.Module mid _ decls) = do
when (null errs) (mapM_ (compile deps1 . snd) deps1) when (null errs) (mapM_ (compile deps1 . snd) deps1)
return errs return errs
where where
compile deps' (Source file' mods) = do compile deps' (Source file' mods) = smake
_ <- smake [flatName file', flatIntName file'] [flatName file', flatIntName file']
(file':mapMaybe (flatInterface deps') mods) (file':mapMaybe (flatInterface deps') mods)
(compileModule (opts paths) file') (compileModule (opts paths) file')
(return Nothing) (return ())
return ()
compile _ _ = return () compile _ _ = return ()
flatInterface deps' mod1 = case (lookup mod1 deps') of flatInterface deps' mod1 = case (lookup mod1 deps') of
......
...@@ -109,7 +109,7 @@ partitionDecl parts (FlatExternalDecl pos ids) ...@@ -109,7 +109,7 @@ partitionDecl parts (FlatExternalDecl pos ids)
= partitionFuncDecls (\ident -> FlatExternalDecl pos [ident]) parts ids = partitionFuncDecls (\ident -> FlatExternalDecl pos [ident]) parts ids
-- op decls -- op decls
partitionDecl parts (InfixDecl pos fix prec idents) partitionDecl parts (InfixDecl pos fix prec idents)
= partitions {opDecls = map (\ident -> (InfixDecl pos fix prec [ident])) idents ++ opDecls parts } = parts {opDecls = map (\ident -> (InfixDecl pos fix prec [ident])) idents ++ opDecls parts }
-- default -- default
partitionDecl parts _ = parts partitionDecl parts _ = parts
......
...@@ -58,10 +58,10 @@ genFlatCurry opts cEnv mEnv tyEnv tcEnv aEnv modul ...@@ -58,10 +58,10 @@ genFlatCurry opts cEnv mEnv tyEnv tcEnv aEnv modul
-- transforms intermediate language code (IL) to FlatCurry interfaces -- transforms intermediate language code (IL) to FlatCurry interfaces
genFlatInterface :: Options -> CurryEnv -> ModuleEnv -> ValueEnv -> TCEnv genFlatInterface :: Options -> CurryEnv -> ModuleEnv -> ValueEnv -> TCEnv
-> ArityEnv -> IL.Module -> (Prog, [WarnMsg]) -> ArityEnv -> IL.Module -> (Prog, [WarnMsg])
genFlatInterface opts cEnv mEnv tyEnv tcEnv aEnv modul genFlatInterface opts cEnv mEnv tyEnv tcEnv aEnv modul =
= (patchPreludeFCY intf, messages) (patchPreludeFCY intf, messages)
where (intf, messages) where (intf, messages)
= run opts cEnv mEnv tyEnv tcEnv aEnv True (visitModule modul) = run opts cEnv mEnv tyEnv tcEnv aEnv True (visitModule modul)
patchPreludeFCY :: Prog -> Prog patchPreludeFCY :: Prog -> Prog
patchPreludeFCY p@(Prog n _ types funcs ops) patchPreludeFCY p@(Prog n _ types funcs ops)
......
...@@ -427,7 +427,7 @@ token2code tok@(Token cat _) ...@@ -427,7 +427,7 @@ token2code tok@(Token cat _)
= Keyword (token2string tok) = Keyword (token2string tok)
| elem cat [LeftParen,RightParen,Semicolon,LeftBrace,RightBrace,LeftBracket, | elem cat [LeftParen,RightParen,Semicolon,LeftBrace,RightBrace,LeftBracket,
RightBracket,Comma,Underscore,Backquote, RightBracket,Comma,Underscore,Backquote,
At,Colon,DotDot,DoubleColon,Equals,Backslash,Bar,LeftArrow,RightArrow, At,DotDot,DoubleColon,Equals,Backslash,Bar,LeftArrow,RightArrow,
Tilde] Tilde]
= Symbol (token2string tok) = Symbol (token2string tok)
| elem cat [LineComment, NestedComment] | elem cat [LineComment, NestedComment]
...@@ -443,7 +443,7 @@ token2code tok@(Token cat _) ...@@ -443,7 +443,7 @@ token2code tok@(Token cat _)
isTokenIdentifier :: Token -> Bool isTokenIdentifier :: Token -> Bool
isTokenIdentifier (Token cat _) = isTokenIdentifier (Token cat _) =
elem cat [Id,QId,Sym,QSym,Sym_Dot,Sym_Minus,Sym_MinusDot] elem cat [Id, QId, Sym, QSym, SymColon, SymDot, SymMinus, SymMinusDot]
-- DECL Position -- DECL Position
...@@ -714,7 +714,6 @@ token2string (Token Backquote _) = "`" ...@@ -714,7 +714,6 @@ token2string (Token Backquote _) = "`"
token2string (Token VSemicolon _) = "" token2string (Token VSemicolon _) = ""
token2string (Token VRightBrace _) = "" token2string (Token VRightBrace _) = ""
token2string (Token At _) = "@" token2string (Token At _) = "@"
token2string (Token Colon _) = ":"
token2string (Token DotDot _) = ".." token2string (Token DotDot _) = ".."
token2string (Token DoubleColon _) = "::" token2string (Token DoubleColon _) = "::"
token2string (Token Equals _) = "=" token2string (Token Equals _) = "="
...@@ -723,9 +722,10 @@ token2string (Token Bar _) = "|" ...@@ -723,9 +722,10 @@ token2string (Token Bar _) = "|"
token2string (Token LeftArrow _) = "<-" token2string (Token LeftArrow _) = "<-"
token2string (Token RightArrow _) = "->" token2string (Token RightArrow _) = "->"
token2string (Token Tilde _) = "~" token2string (Token Tilde _) = "~"
token2string (Token Sym_Dot _) = "." token2string (Token SymColon _) = ":"
token2string (Token Sym_Minus _) = "-" token2string (Token SymDot _) = "."
token2string (Token Sym_MinusDot _) = "-." token2string (Token SymMinus _) = "-"
token2string (Token SymMinusDot _) = "-."
token2string (Token KW_case _) = "case" token2string (Token KW_case _) = "case"
token2string (Token KW_choice _) = "choice" token2string (Token KW_choice _) = "choice"
token2string (Token KW_data _) = "data" token2string (Token KW_data _) = "data"
......
...@@ -20,7 +20,6 @@ This module controls the compilation of modules. ...@@ -20,7 +20,6 @@ This module controls the compilation of modules.
> import Data.List (find, isPrefixOf, partition) > import Data.List (find, isPrefixOf, partition)
> import qualified Data.Map as Map (Map, empty, insert, insertWith, lookup, toList) > import qualified Data.Map as Map (Map, empty, insert, insertWith, lookup, toList)
> import Data.Maybe (fromMaybe) > import Data.Maybe (fromMaybe)
> import System.IO (stderr, hPutStrLn)
> import Text.PrettyPrint.HughesPJ (Doc, ($$), text, vcat) > import Text.PrettyPrint.HughesPJ (Doc, ($$), text, vcat)
> import qualified Curry.AbstractCurry as AC > import qualified Curry.AbstractCurry as AC
...@@ -34,14 +33,14 @@ This module controls the compilation of modules. ...@@ -34,14 +33,14 @@ This module controls the compilation of modules.
> import qualified Curry.IL as IL > import qualified Curry.IL as IL
> import Curry.Syntax > import Curry.Syntax
> import Base.Arity (ArityEnv, initAEnv, bindArities)
> import Base.Eval (evalEnv) > import Base.Eval (evalEnv)
> import Base.Import (bindAlias, initIEnv, fromDeclList)
> import Base.Module (ModuleEnv) > import Base.Module (ModuleEnv)
> import Base.OpPrec (PEnv, initPEnv) > import Base.OpPrec (PEnv, initPEnv)
> import Base.TypeConstructors (TCEnv, TypeInfo (..), initTCEnv, qualLookupTC) > import Base.TypeConstructors (TCEnv, TypeInfo (..), initTCEnv, qualLookupTC)
> import Base.Types (toType, fromQualType) > import Base.Types (toType, fromQualType)
> import Base.Value (ValueEnv, ValueInfo (..), initDCEnv) > import Base.Value (ValueEnv, ValueInfo (..), initDCEnv)
> import Base.Arity (ArityEnv, initAEnv, bindArities)
> import Base.Import (bindAlias, initIEnv)
> import Check.InterfaceCheck (interfaceCheck) > import Check.InterfaceCheck (interfaceCheck)
> import Check.KindCheck (kindCheck) > import Check.KindCheck (kindCheck)
> import Check.SyntaxCheck (syntaxCheck) > import Check.SyntaxCheck (syntaxCheck)
...@@ -66,7 +65,7 @@ This module controls the compilation of modules. ...@@ -66,7 +65,7 @@ This module controls the compilation of modules.
> import CurryToIL (ilTrans) > import CurryToIL (ilTrans)
> import Exports (expandInterface, exportInterface) > import Exports (expandInterface, exportInterface)
> import Imports (importInterface, importInterfaceIntf, importUnifyData) > import Imports (importInterface, importInterfaceIntf, importUnifyData)
> import Messages (errorAt, internalError) > import Messages (errorAt, internalError, putErrsLn)
> import Types > import Types
> import TypeSubst > import TypeSubst
...@@ -94,7 +93,7 @@ as a frontend for PAKCS, all functions for evaluating goals and generating C ...@@ -94,7 +93,7 @@ as a frontend for PAKCS, all functions for evaluating goals and generating C
code are obsolete and commented out. code are obsolete and commented out.
\begin{verbatim} \begin{verbatim}
> compileModule :: Options -> FilePath -> IO (Maybe FilePath) > compileModule :: Options -> FilePath -> IO ()
> compileModule opts fn = do > compileModule opts fn = do
> -- read and parse module > -- read and parse module
> parsed <- (ok . parseModule likeFlat fn) `liftM` readModule fn > parsed <- (ok . parseModule likeFlat fn) `liftM` readModule fn
...@@ -110,7 +109,7 @@ code are obsolete and commented out. ...@@ -110,7 +109,7 @@ code are obsolete and commented out.
> then do > then do
> (tyEnv, tcEnv, _, m', _, _) <- simpleCheckModule opts mEnv m > (tyEnv, tcEnv, _, m', _, _) <- simpleCheckModule opts mEnv m
> -- generate untyped AbstractCurry > -- generate untyped AbstractCurry
> when uacy $ genAbstract opts fn tyEnv tcEnv m' >> return () > when uacy $ genAbstract opts fn tyEnv tcEnv m'
> -- output the parsed source > -- output the parsed source
> when src $ genParsed opts fn m' > when src $ genParsed opts fn m'
> else do > else do
...@@ -123,8 +122,8 @@ code are obsolete and commented out. ...@@ -123,8 +122,8 @@ code are obsolete and commented out.
> -- dump intermediate results > -- dump intermediate results
> mapM_ (doDump opts) dumps > mapM_ (doDump opts) dumps
> -- generate target code > -- generate target code
> when (acy || uacy) $ genAbstract opts fn tyEnv tcEnv m' >> return () > when (acy || uacy) $ genAbstract opts fn tyEnv tcEnv m'
> when (fcy || xml) $ genFlat opts fn mEnv tyEnv tcEnv aEnv' intf m' il >> return () > when (fcy || xml) $ genFlat opts fn mEnv tyEnv tcEnv aEnv' intf m' il
> when src $ genParsed opts fn m'