curry-frontend 0.2.9 → 0.2.10
raw patch · 4 files changed
+32/−15 lines, 4 filesdep ~curry-base
Dependency ranges changed: curry-base
Files
- curry-frontend.cabal +3/−3
- src/CurryCompilerOpts.hs +1/−1
- src/GenFlatCurry.hs +21/−10
- src/Modules.lhs +7/−1
curry-frontend.cabal view
@@ -1,5 +1,5 @@ Name: curry-frontend-Version: 0.2.9+Version: 0.2.10 Cabal-Version: >= 1.6 Synopsis: Compile the functional logic language Curry to several intermediate formats Description: The Curry Frontend consists of the executable program "cymake".@@ -20,13 +20,13 @@ Extra-Source-Files: LIESMICH Data-Files: src/currydoc.css- + Executable cymake hs-source-dirs: src Main-is: cymake.hs Build-Depends: base >= 3 && < 4, - curry-base >= 0.2.6, + curry-base >= 0.2.7, mtl, old-time, containers, pretty ghc-options: -fwarn-unused-binds -fwarn-unused-imports -auto-all Other-Modules: Curry.Syntax.Lexer, Curry.Syntax.LexComb
src/CurryCompilerOpts.hs view
@@ -91,7 +91,7 @@ "do not print warnings for overlapping rules", Option "" ["flat"] (NoArg Flat) "generate FlatCurry code",- Option "" ["extended-flat"] (NoArg ExtFlat)+ Option "" ["extflat"] (NoArg ExtFlat) "generate FlatCurry code with source references", Option "" ["xml"] (NoArg FlatXML) "generate flat xml code",
src/GenFlatCurry.hs view
@@ -26,12 +26,10 @@ import Curry.ExtendedFlat.Type import Curry.ExtendedFlat.TypeInference -import Base {-(ArityEnv, ArityInfo(..), ModuleEnv, - TCEnv, TypeInfo(..), ValueEnv, ValueInfo(..),- lookupValue, qualLookupTC,- qualLookupArity, lookupArity, internalError,- qualLookupValue)-}+import Curry.ExtendedFlat.EraseTypes +import Base+ import qualified IL.Type as IL import qualified IL.CurryToIL as IL @@ -57,7 +55,8 @@ = (prog', messages) where (prog, messages) = run opts cEnv mEnv tyEnv tcEnv aEnv False (visitModule mod)- prog' = adjustTypeInfo $ patchPreludeFCY prog+ prog' = -- eraseTypes $ + adjustTypeInfo $ adjustTypeInfo $ patchPreludeFCY prog -- transforms intermediate language code (IL) to FlatCurry interfaces@@ -196,7 +195,7 @@ visitDataDecl :: IL.Decl -> FlatState TypeDecl visitDataDecl (IL.DataDecl qident arity constrs) = do cdecls <- mapM visitConstrDecl constrs- qname <- visitQualIdent qident+ qname <- visitQualTypeIdent qident vis <- getVisibility False qident return (Type qname vis [0 .. (arity - 1)] (concat cdecls)) visitDataDecl _ = internalError "GenFlatCurry: no data declaration"@@ -365,12 +364,12 @@ is = [0 .. length params - 1] cdecls <- mapM (visitConstrIDecl mid (zip params is)) (catMaybes constrs_)- qname <- visitQualIdent qident+ qname <- visitQualTypeIdent qident return (Type qname Public is cdecls) visitTypeIDecl (CS.ITypeDecl _ qident params typeexpr) = do let is = [0 .. (length params) - 1] texpr <- visitType (fst (cs2ilType (zip params is) typeexpr))- qname <- visitQualIdent qident+ qname <- visitQualTypeIdent qident return (TypeSyn qname Public is texpr) visitTypeIDecl _ = internalError "GenFlatCurry: no type interface" @@ -649,7 +648,7 @@ tcEnv <- gets tConsEnvE let typeexpr' = elimRecordTypes tyEnv tcEnv typeexpr texpr <- visitType (fst (cs2ilType (zip params is) typeexpr'))- qname <- visitQualIdent qident+ qname <- visitQualTypeIdent qident vis <- getVisibility False qident return (TypeSyn qname vis is texpr) genTypeSynonym _ = internalError "GenFlatCurry: no type synonym interface"@@ -1001,9 +1000,21 @@ -- whole implementation. We won't depart from that for mere -- aesthetic reasons. (hsi) lookupIdType :: QualIdent -> FlatState (Maybe TypeExpr)+lookupIdType (QualIdent Nothing (Ident _ "[]" _))+ = return (Just l0)+ where l0 = TCons (mkQName ("Prelude", "[]")) [TVar 0] lookupIdType (QualIdent Nothing (Ident _ ":" _)) = return (Just (FuncType (TVar 0) (FuncType (l0) (l0)))) where l0 = TCons (mkQName ("Prelude", "[]")) [TVar 0]+lookupIdType (QualIdent Nothing (Ident _ "()" _))+ = return (Just l0)+ where l0 = TCons (mkQName ("Prelude", "()")) []+lookupIdType (QualIdent Nothing (Ident _ t@('(':',':r) _))+ = return (Just funtype)+ where tupleArity = length r + 1+ argTypes = map TVar [1..tupleArity]+ contype = TCons (mkQName ("Prelude", t)) argTypes+ funtype = foldr FuncType contype argTypes lookupIdType qid = do aEnv <- gets typeEnvE lt <- gets localTypes
src/Modules.lhs view
@@ -194,8 +194,14 @@ > else tyEnvI > msgs = warnCheck m tyEnv impDs topDs > withExt = withExtensions opts+> -- fre: replaced the argument aEnv by aEnv'' in the+> -- expression below. This fixed a bug that occured+> -- when one imported a module qualified that+> -- exported a function from another module.+> -- However, there is now a cyclic dependecy +> -- but tests didn't show any problems. > (pEnv',topDs') = precCheck m pEnv -> $ syntaxCheck withExt m iEnv aEnv tyEnv tcEnv+> $ syntaxCheck withExt m iEnv aEnv'' tyEnv tcEnv > $ kindCheck m tcEnv topDs > (tcEnv',tyEnv') = typeCheck m tcEnv tyEnv topDs' > ds' = impDs ++ qual m tyEnv' topDs'