0N/A{-# OPTIONS -fno-warn-missing-methods #-}
0N/ACopyright : (c) Christian Maeder, Sonja Groening, Uni Bremen 2002-2004
0N/AMaintainer : hets@tzi.de
0N/AStability : provisional
0N/APortability : non-portable(Logic)
0N/A Here is the place where the class Logic is instantiated for Haskell.
0N/A Also the instances for Syntax an Category.
0N/A - writing real functions
0N/A parse_symb_map_items,
0N/A tyconsMembersHaskellPrelude,
0N/A preludeTyconAndClassKinds,
0N/AmoduleInfoTc, hsDeclTc, aHsDeclTc :: TyCon
0N/Ainstance Typeable ModuleInfo where
0N/A typeOf _ = mkAppTy moduleInfoTc []
0N/Ainstance Typeable HsDecl where
0N/A typeOf _ = mkAppTy hsDeclTc []
0N/Ainstance Typeable AHsDecl where
0N/A typeOf _ = mkAppTy aHsDeclTc []
0N/Ainstance PrettyPrint ModuleInfo where
0N/A printText0 _ modInfo = text "Module name"
0N/A <+> text (show (moduleName modInfo))
0N/A $+$ text "Variable Assumptions"
0N/A <+> text (show (varAssumps modInfo))
0N/A $+$ text "Data Constructor Assumptions"
0N/A <+> text (show (dconsAssumps modInfo))
0N/A $+$ text "Class Hierarchy"
0N/A <+> text (show (classHierarchy modInfo))
0N/A <+> text (show (kinds modInfo))
0N/A <+> text (show (synonyms modInfo))
0N/A $+$ text "Infix Declarations"
0N/A <+> text (show (infixDecls modInfo))
0N/A $+$ text "Type Constructor Members"
0N/A <+> text (show (tyconsMembers modInfo))
0N/Ainstance PrintLaTeX ModuleInfo where
0N/A printLatex0 = printText0
0N/Ainstance PrintLaTeX HsDecls where
0N/A printLatex0 = printText0
0N/A-- a dummy datatype for the LogicGraph and for identifying the right
0N/Adata Haskell = Haskell deriving (Show)
0N/Ainstance Language Haskell -- default definition is okay
0N/Atype Sign = ModuleInfo
0N/Ainstance Category Haskell Sign Morphism where
0N/A dom Haskell _ = empty_signature Haskell
0N/A-- abstract syntax, parsing (and printing)
0N/Atype SYMB_MAP_ITEMS = ()
0N/Ainstance Syntax Haskell HsDecls
0N/A SYMB_ITEMS SYMB_MAP_ITEMS
0N/A parse_basic_spec Haskell = Just(toParseFun hatParser ())
0N/A parse_symb_items Haskell = Nothing
0N/A parse_symb_map_items Haskell = Nothing
0N/Atype Haskell_Sublogics = ()
0N/Atype Sentence = AHsDecl
0N/Ainstance Ord AHsDecl where
0N/A compare x y = undefined
0N/Ainstance PrettyPrint Sentence where
0N/A printText0 _ = ptext . show
0N/Ainstance Sentences Haskell Sentence () Sign Morphism Symbol
0N/ApreludeSign :: ModuleInfo
0N/ApreludeSign = ModuleInfo {
0N/A moduleName = AModule "Prelude",
0N/A varAssumps = (listToEnv $ map assumpToPair preludeDefs),
0N/A tyconsMembers = tyconsMembersHaskellPrelude,
0N/A dconsAssumps = (listToEnv $ map assumpToPair preludeDataCons),
0N/A classHierarchy = listToEnv preludeClasses,
0N/A kinds = (listToEnv preludeTyconAndClassKinds),
0N/A infixDecls = preludeInfixDecls,
0N/A synonyms = preludeSynonyms
0N/A{- basic_analysis :: lid ->
0N/A Maybe((basic_spec, -- abstract syntax tree
0N/A sign, -- signature of imported
0N/A GlobalAnnos) -> -- global annotations
0N/A Result (basic_spec, -- renamed module
0N/A sign,sign, -- (total, delta)
0N/A -- delta = deklarations in the modul
0N/A -- total = imported + delta
0N/A [Named sentence] -- programdefinitions))
0N/A basic_analysis calculates from the abstract syntax tree the types of
0N/A all functions and tests wether all used identifiers are declared
0N/Ainstance StaticAnalysis Haskell HsDecls
0N/A SYMB_ITEMS SYMB_MAP_ITEMS
163N/A empty_signature Haskell
113N/A = ModuleInfo { varAssumps = emptyEnv,
0N/A moduleName = AModule "EmptyModule",-- error "Unspecified module name",
0N/A dconsAssumps = emptyEnv,
0N/A classHierarchy = emptyEnv,
0N/A-- empty_signature Haskell = emptyModuleInfo
0N/A signature_union Haskell sig1 sig2 = return (joinModuleInfo sig1 sig2)
0N/A inclusion Haskell _ _ = return ()
0N/A-- sublogic_names Haskell _ = ["Haskell"]
0N/A basic_analysis Haskell = Just(basicAnalysis)
0N/A where basicAnalysis (basicSpec, sig, _) =
0N/A let basicMod = cvrtHsModule (HsModule (Module "Anonymous")
0N/A Nothing [] basicSpec)
113N/A -- re-group matches into their associated funbinds
113N/A -- (patch up the output from the parser)
163N/A moduleSyntaxFixedFunBinds = fixFunBindsInModule basicMod
113N/A -- map the abstract syntax into the annotated abstract syntax
113N/A annotatedSyntax = toAHsModule moduleSyntaxFixedFunBinds
0N/A moduleSynonyms) = tiModule [] annotatedSyntax sig
0N/A modInfo = ModuleInfo {
221N/A varAssumps = moduleEnv,
221N/A moduleName = getAModuleName annotatedSyntax,
221N/A dconsAssumps = dataConEnv,
221N/A classHierarchy = newClassHierarchy,
221N/A kinds = newKindInfoTable,
221N/A tyconsMembers = getTyconsMembers moduleRenamed,
0N/A infixDecls = getInfixDecls moduleRenamed,
0N/A synonyms = moduleSynonyms }
0N/A maybeResult = Just(basicSpec, modInfo,
0N/A (joinModuleInfo sig modInfo),
0N/A (extractSentences annotatedSyntax)) }
0N/Ainstance Logic Haskell Haskell_Sublogics
0N/A HsDecls Sentence SYMB_ITEMS SYMB_MAP_ITEMS
0N/A where data_logic Haskell = Nothing