Verified Commit 621e3ddf authored by Camil Staps's avatar Camil Staps 🚀

Reorganise TypeDB -> CloogleDB

parent b50e3c09
definition module TypeDB
definition module CloogleDB
/**
* A database with information about Clean modules.
* This module is called TypeDB for historical reasons and should be renamed (TODO).
*
* The functions here follow a general guideline about nomenclature:
* - get* expects that you already know the location of the value you seek and
......@@ -23,80 +22,87 @@ definition module TypeDB
from StdOverloaded import class <, class zero
from StdClass import class Ord
from Data.Map import ::Map
from Data.Maybe import ::Maybe
from Data.Map import :: Map
from Data.Maybe import :: Maybe
from GenEq import generic gEq
// CleanTypeUnifier
from Type import ::Type, ::TypeVar, ::TVAssignment, ::TypeDef, class print(..),
::ClassContext, ::ClassRestriction, ::ClassOrGeneric, ::Priority
from Type import :: Type, :: TypeVar, :: TVAssignment, :: TypeDef,
:: ClassContext, :: ClassRestriction, :: ClassOrGeneric, :: Priority,
class print(..)
from Doc import ::Documentation
from Cloogle import :: FunctionKind
from Doc import :: Documentation
/**
* A storage for function types, class definitions, type definitions, etc.
*/
:: TypeDB
:: CloogleDB
/**
* Not-type information that is often associated with things that have a type
* A location in the Clean libraries
*/
:: TypeExtras
= { te_priority :: !Maybe Priority //* The infix priority
, te_isconstructor :: !Bool //* Whether this function is a constructor
, te_isrecordfield :: !Bool //* Whether this function is a record field
, te_generic_vars :: !Maybe [String] //* The names of the type variables of a generic function
// Using TypeVar causes import clashes in TypeDBFactory
, te_representation :: !Maybe String //* A string representation of the entry
, te_documentation :: !Maybe Documentation //* Documentation on this entry
}
:: Location
= Location Library Module LineNr LineNr Name //* A normal location
| Builtin Name //* A language builtin
/**
* A Type with TypeExtras
* Not-type information that is often associated with things that have a type
*/
:: ExtendedType = ET !Type !TypeExtras
:: FunctionEntry
= { fe_kind :: !FunctionKind //* The type of entry
, fe_type :: !Maybe Type //* The type, Nothing for macros
, fe_priority :: !Maybe Priority //* The infix priority
, fe_generic_vars :: !Maybe [String] //* The names of the type variables of a generic function
// Using TypeVar causes import clashes in CloogleDBFactory
, fe_representation :: !Maybe String //* A string representation of the entry
, fe_documentation :: !Maybe Documentation //* Documentation on this entry
}
/**
* A TypeDef with meta-data
*/
:: ExtendedTypeDef
= { etd_typedef :: !TypeDef //* The TypeDef
, etd_doc :: !Maybe Documentation //* Documentation on the TypeDef (a TypeDoc)
:: TypeDefEntry
= { tde_typedef :: !TypeDef //* The TypeDef
, tde_doc :: !Maybe Documentation //* Documentation on the TypeDef (a TypeDoc)
}
/**
* Information about a macro
* Information about a Clean module
*/
:: Macro
= { macro_as_string :: !String //* A string representation
, macro_extras :: !TypeExtras //* Extra information
:: ModuleEntry
= { me_is_core :: !Bool //* Whether this is a core module (e.g. the os* modules in ObjectIO and TCPIP)
, me_documentation :: !Maybe Documentation //* Documentation on this module (a ModuleDoc)
}
/**
* A location in the Clean libraries
* Information about a Clean class
*/
:: Location
= Location Library Module LineNr LineNr Name //* A normal location
| Builtin Name //* A language builtin
:: ClassEntry
= { ce_vars :: ![String] //* The type variables of the class
// Using TypeVar causes import clashes in CloogleDBFactory
, ce_context :: !ClassContext //* A class context
, ce_documentation :: !Maybe Documentation //* Documentation on this class (a ClassDoc)
, ce_members :: ![(!Name, !FunctionEntry)] //* Class members: function name and type information
}
/**
* Information about a Clean module
* Information about a class instance
*/
:: ModuleInfo
= { is_core :: !Bool //* Whether this is a core module (e.g. the os* modules in ObjectIO and TCPIP)
, mod_documentation :: !Maybe Documentation //* Documentation on this module (a ModuleDoc)
:: InstanceEntry
= { ie_types :: [(Type, String)] //* The instantiated type and a string representation for each class variable
, ie_locations :: [Location] //* The places where this instance is found
}
/**
* Information about a Clean class
* Information about a generic derivation
*/
:: Class
= { class_vars :: ![String] //* The type variables of the class
// Using TypeVar causes import clashes in TypeDBFactory
, class_context :: !ClassContext //* A class context
, class_documentation :: !Maybe Documentation //* Documentation on this class (a ClassDoc)
, class_members :: ![(!Name, !ExtendedType)] //* Class members: function name and type information
:: DeriveEntry
= { de_type :: Type //* The type to derive an instance for
, de_type_representation :: String //* A string representation of the type
, de_locations :: [Location] //* The locations in which the derivation occurs
}
:: Name :== String
......@@ -104,19 +110,19 @@ from Doc import ::Documentation
:: Module :== String
:: LineNr :== Maybe Int
instance zero TypeDB
instance zero TypeExtras
instance zero ModuleInfo
instance zero CloogleDB
instance zero FunctionEntry
instance zero ModuleEntry
instance print (Name, ExtendedType)
instance print (Name, FunctionEntry)
getName :: Location -> Name
isBuiltin :: Location -> Bool
isCore :: Location TypeDB -> Bool
isCore :: Location CloogleDB -> Bool
toExtendedTypeDef :: TypeDef (Maybe Documentation) -> ExtendedTypeDef
getTypeDef :: ExtendedTypeDef -> TypeDef
getTypeDefDoc :: ExtendedTypeDef -> Maybe Documentation
toTypeDefEntry :: TypeDef (Maybe Documentation) -> TypeDefEntry
getTypeDef :: TypeDefEntry -> TypeDef
getTypeDefDoc :: TypeDefEntry -> Maybe Documentation
/**
* Wrapper around the Class record field to work around name clashes
......@@ -127,73 +133,61 @@ getTypeDefDoc :: ExtendedTypeDef -> Maybe Documentation
* @param The names and types of the class members
* @result A Class record with those data
*/
toClass :: [String] ClassContext (Maybe Documentation) [(Name, ExtendedType)] -> Class
toClass :: [String] ClassContext (Maybe Documentation) [(Name, FunctionEntry)] -> ClassEntry
functionCount :: TypeDB -> Int
macroCount :: TypeDB -> Int
classCount :: TypeDB -> Int
instanceCount :: TypeDB -> Int
typeCount :: TypeDB -> Int
deriveCount :: TypeDB -> Int
moduleCount :: TypeDB -> Int
functionCount :: CloogleDB -> Int
classCount :: CloogleDB -> Int
instanceCount :: CloogleDB -> Int
typeCount :: CloogleDB -> Int
deriveCount :: CloogleDB -> Int
moduleCount :: CloogleDB -> Int
/**
* Filter the whole database on locations using a property function
*/
filterLocations :: (Location -> Bool) TypeDB -> TypeDB
getFunction :: Location TypeDB -> Maybe ExtendedType
putFunction :: !Location !ExtendedType !TypeDB -> TypeDB
putFunctions :: ![(!Location, !ExtendedType)] !TypeDB -> TypeDB
findFunction :: Name TypeDB -> [(Location, ExtendedType)]
findFunction` :: (Location ExtendedType -> Bool) TypeDB
-> [(Location, ExtendedType)]
findFunction`` :: [(Location ExtendedType -> Bool)] TypeDB
-> [(Location, ExtendedType)]
getMacro :: Location TypeDB -> Maybe Macro
putMacro :: !Location !Macro !TypeDB -> TypeDB
putMacros :: ![(!Location, !Macro)] !TypeDB -> TypeDB
findMacro` :: (Location Macro -> Bool) TypeDB -> [(Location, Macro)]
findMacro`` :: [(Location Macro -> Bool)] TypeDB -> [(Location, Macro)]
getInstances :: Name TypeDB -> [([(Type,String)], [Location])]
putInstance :: !Name ![(!Type,!String)] !Location !TypeDB -> TypeDB
putInstances :: ![(!Name, ![(!Type,!String)], !Location)] !TypeDB -> TypeDB
getClass :: Location TypeDB -> Maybe Class
putClass :: !Location !Class !TypeDB -> TypeDB
putClasses :: ![(!Location, !Class)] !TypeDB -> TypeDB
findClass :: Name TypeDB -> [(Location, Class)]
findClass` :: (Location Class -> Bool) TypeDB -> [(Location, Class)]
findClass`` :: [(Location Class -> Bool)] TypeDB -> [(Location, Class)]
findClassMembers` :: (Location [String] ClassContext Name ExtendedType -> Bool) TypeDB
-> [(Location, [String], ClassContext, Name, ExtendedType)]
findClassMembers`` :: [Location [String] ClassContext Name ExtendedType -> Bool]
TypeDB -> [(Location, [String], ClassContext, Name, ExtendedType)]
getType :: Location TypeDB -> Maybe ExtendedTypeDef
putType :: !Location !ExtendedTypeDef !TypeDB -> TypeDB
putTypes :: ![(!Location, !ExtendedTypeDef)] !TypeDB -> TypeDB
findType :: Name TypeDB -> [(Location, ExtendedTypeDef)]
findType` :: (Location ExtendedTypeDef -> Bool) TypeDB -> [(Location, ExtendedTypeDef)]
findType`` :: [(Location ExtendedTypeDef -> Bool)] TypeDB -> [(Location, ExtendedTypeDef)]
allTypes :: (TypeDB -> [ExtendedTypeDef])
getDerivations :: Name TypeDB -> [(Type, String, [Location])]
putDerivation :: !Name !Type !String !Location !TypeDB -> TypeDB
putDerivations :: !Name ![(!Type, !String, !Location)] !TypeDB -> TypeDB
putDerivationss :: ![(!Name, ![(!Type, !String, !Location)])] !TypeDB -> TypeDB
getModule :: Library Module TypeDB -> Maybe ModuleInfo
putModule :: !Library !Module !ModuleInfo !TypeDB -> TypeDB
findModule` :: (Library Module ModuleInfo -> Bool) TypeDB -> [(Library, Module, ModuleInfo)]
/**
* Search for exactly a certain type
*/
searchExact :: Type TypeDB -> [(Location, ExtendedType)]
filterLocations :: (Location -> Bool) CloogleDB -> CloogleDB
getFunction :: Location CloogleDB -> Maybe FunctionEntry
putFunction :: !Location !FunctionEntry !CloogleDB -> CloogleDB
putFunctions :: ![(!Location, !FunctionEntry)] !CloogleDB -> CloogleDB
findFunction :: Name CloogleDB -> [(Location, FunctionEntry)]
findFunction` :: (Location FunctionEntry -> Bool) CloogleDB
-> [(Location, FunctionEntry)]
findFunction`` :: [(Location FunctionEntry -> Bool)] CloogleDB
-> [(Location, FunctionEntry)]
getInstances :: Name CloogleDB -> [InstanceEntry]
putInstance :: !Name ![(!Type,!String)] !Location !CloogleDB -> CloogleDB
putInstances :: ![(!Name, ![(!Type,!String)], !Location)] !CloogleDB -> CloogleDB
getClass :: Location CloogleDB -> Maybe ClassEntry
putClass :: !Location !ClassEntry !CloogleDB -> CloogleDB
putClasses :: ![(!Location, !ClassEntry)] !CloogleDB -> CloogleDB
findClass :: Name CloogleDB -> [(Location, ClassEntry)]
findClass` :: (Location ClassEntry -> Bool) CloogleDB -> [(Location, ClassEntry)]
findClass`` :: [(Location ClassEntry -> Bool)] CloogleDB -> [(Location, ClassEntry)]
findClassMembers` :: (Location [String] ClassContext Name FunctionEntry -> Bool) CloogleDB
-> [(Location, [String], ClassContext, Name, FunctionEntry)]
findClassMembers`` :: [Location [String] ClassContext Name FunctionEntry -> Bool]
CloogleDB -> [(Location, [String], ClassContext, Name, FunctionEntry)]
getType :: Location CloogleDB -> Maybe TypeDefEntry
putType :: !Location !TypeDefEntry !CloogleDB -> CloogleDB
putTypes :: ![(!Location, !TypeDefEntry)] !CloogleDB -> CloogleDB
findType :: Name CloogleDB -> [(Location, TypeDefEntry)]
findType` :: (Location TypeDefEntry -> Bool) CloogleDB -> [(Location, TypeDefEntry)]
findType`` :: [(Location TypeDefEntry -> Bool)] CloogleDB -> [(Location, TypeDefEntry)]
allTypes :: (CloogleDB -> [TypeDefEntry])
getDerivations :: Name CloogleDB -> [DeriveEntry]
putDerivation :: !Name !Type !String !Location !CloogleDB -> CloogleDB
putDerivations :: !Name ![(!Type, !String, !Location)] !CloogleDB -> CloogleDB
putDerivationss :: ![(!Name, ![(!Type, !String, !Location)])] !CloogleDB -> CloogleDB
getModule :: Library Module CloogleDB -> Maybe ModuleEntry
putModule :: !Library !Module !ModuleEntry !CloogleDB -> CloogleDB
findModule` :: (Library Module ModuleEntry -> Bool) CloogleDB -> [(Library, Module, ModuleEntry)]
/**
* Get all the class instances of a type
......@@ -204,7 +198,7 @@ searchExact :: Type TypeDB -> [(Location, ExtendedType)]
* instantiating the class (type and string representation) and all the
* locations where the class is instantiated for those types)
*/
getTypeInstances :: Name TypeDB -> [(Name, [(Type,String)], [Location])]
getTypeInstances :: Name CloogleDB -> [(Name, InstanceEntry)]
/**
* Get all the generic derivations of a type
......@@ -214,24 +208,19 @@ getTypeInstances :: Name TypeDB -> [(Name, [(Type,String)], [Location])]
* @result A list of derivations (name of the generic function and all the
* locations where it is derived for that type)
*/
getTypeDerivations :: Name TypeDB -> [(Name, [Location])]
/**
* Completely evaluate a database to normal form
*/
evalDb :: !TypeDB -> TypeDB
getTypeDerivations :: Name CloogleDB -> [(Name, [Location])]
/**
* Initialise an empty database
*/
newDb :: TypeDB
newDb :: CloogleDB
/**
* Read the database from a file. The file should be opened for reading.
*/
openDb :: *File -> *(!TypeDB, !*File)
openDb :: *File -> *(!CloogleDB, !*File)
/**
* Save the database to a file. The file should be opened for writing.
*/
saveDb :: !TypeDB !*File -> *File
saveDb :: !CloogleDB !*File -> *File
implementation module TypeDB
implementation module CloogleDB
// Standard libraries
import StdArray
......@@ -30,19 +30,20 @@ import GenLexOrd
// CleanTypeUnifier
import Type
import Cloogle
import Doc
:: TypeDB
:: CloogleDB
= { // Base maps
functionmap :: !Map Location ExtendedType
, macromap :: !Map Location Macro
, classmap :: !Map Location Class
, instancemap :: !Map Name [([(Type,String)], [Location])]
, typemap :: !Map Location ExtendedTypeDef
, derivemap :: !Map Name [(Type, String, [Location])]
, modulemap :: !Map (Library, Module) ModuleInfo
functionmap :: !Map Location FunctionEntry
, classmap :: !Map Location ClassEntry
, instancemap :: !Map Name [InstanceEntry]
, typemap :: !Map Location TypeDefEntry
, derivemap :: !Map Name [DeriveEntry]
, modulemap :: !Map (Library, Module) ModuleEntry
// Derived maps
, instancemap` :: !Map Name [(Name, [(Type,String)], [Location])]
, instancemap` :: !Map Name [(Name, InstanceEntry)]
, derivemap` :: !Map Name [(Name, [Location])]
}
......@@ -52,22 +53,21 @@ printersperse ia a bs = intercalate (print False a) (map (print ia) bs)
(--) infixr 5 :: a b -> [String] | print a & print b
(--) a b = print False a ++ print False b
derive gEq ClassOrGeneric, Location, Type, TypeExtras, Priority,
ExtendedType, TypeDef, TypeDefRhs, RecordField, Constructor, Kind, Macro,
Documentation, TypeRhsDoc, ClassMemberDoc
derive JSONEncode ClassOrGeneric, Location, Type, TypeDB, TypeExtras,
Priority, ExtendedType, TypeDef, TypeDefRhs, RecordField, Constructor,
Kind, Macro, ModuleInfo, Documentation, TypeRhsDoc, ClassMemberDoc,
ExtendedTypeDef, Class
derive JSONDecode ClassOrGeneric, Location, Type, TypeDB, TypeExtras,
Priority, ExtendedType, TypeDef, TypeDefRhs, RecordField, Constructor,
Kind, Macro, ModuleInfo, Documentation, TypeRhsDoc, ClassMemberDoc,
ExtendedTypeDef, Class
instance zero TypeDB
derive gEq ClassOrGeneric, Location, Type, Priority, FunctionEntry, TypeDef,
TypeDefRhs, RecordField, Constructor, Kind, Documentation, TypeRhsDoc,
ClassMemberDoc, InstanceEntry, DeriveEntry
derive JSONEncode ClassOrGeneric, Location, Type, CloogleDB, Priority,
FunctionEntry, TypeDef, TypeDefRhs, RecordField, Constructor, Kind,
ModuleEntry, Documentation, TypeRhsDoc, ClassMemberDoc, TypeDefEntry,
ClassEntry, InstanceEntry, DeriveEntry
derive JSONDecode ClassOrGeneric, Location, Type, CloogleDB, Priority,
FunctionEntry, TypeDef, TypeDefRhs, RecordField, Constructor, Kind,
ModuleEntry, Documentation, TypeRhsDoc, ClassMemberDoc, TypeDefEntry,
ClassEntry, InstanceEntry, DeriveEntry
instance zero CloogleDB
where
zero = { functionmap = newMap
, macromap = newMap
, classmap = newMap
, instancemap = newMap
, typemap = newMap
......@@ -84,39 +84,38 @@ instance < Type where (<) a b = (a =?= b) === LT
instance < (a,b,c,d) | gLexOrd{|*|} a & gLexOrd{|*|} b & gLexOrd{|*|} c & gLexOrd{|*|} d
where (<) a b = (a =?= b) === LT
instance == Location
where
(==) a b = gEq{|*|} a b
instance == Location where == a b = gEq{|*|} a b
instance == DeriveEntry where == a b = gEq{|*|} a b
instance zero TypeExtras
instance zero FunctionEntry
where
zero = { te_priority = Nothing
, te_isconstructor = False
, te_isrecordfield = False
, te_generic_vars = Nothing
, te_representation = Nothing
, te_documentation = Nothing
zero = { fe_kind = Function
, fe_type = Nothing
, fe_priority = Nothing
, fe_generic_vars = Nothing
, fe_representation = Nothing
, fe_documentation = Nothing
}
instance zero ModuleInfo
where zero = {is_core = False, mod_documentation=Nothing}
instance print TypeExtras
where
print b {te_priority=Just p} = print b p -- " "
print b {te_generic_vars=Just vars} = printersperse b " " vars -- " "
print _ _ = []
instance zero ModuleEntry
where zero = {me_is_core = False, me_documentation=Nothing}
instance print (Name, ExtendedType)
instance print (Name, FunctionEntry)
where
print _ (f, (ET t e))
= gen -- fname -- " " -- e -- ":: " -- t
print b (f, fe)
= gen -- fname -- " " -- prio -- vars -- if (isJust fe.fe_type) (":: " -- fe.fe_type) []
where
gen = if (isJust e.te_generic_vars) "generic " ""
prio = case fe.fe_priority of
Nothing -> []
Just p -> print b p -- " "
vars = case fe.fe_generic_vars of
Nothing -> []
Just vs -> printersperse b " " vars -- " "
gen = if (isJust fe.fe_generic_vars) "generic " ""
fname
| isJust e.te_priority = concat ("(" -- f -- ")")
| e.te_isrecordfield = "." +++ f
| otherwise = f
| isJust fe.fe_priority = concat ("(" -- f -- ")")
| fe.fe_kind == RecordField = "." +++ f
| otherwise = f
getName :: Location -> Name
getName (Location _ _ _ _ name) = name
......@@ -126,56 +125,52 @@ isBuiltin :: Location -> Bool
isBuiltin (Builtin _) = True
isBuiltin _ = False
isCore :: Location TypeDB -> Bool
isCore :: Location CloogleDB -> Bool
isCore (Builtin _) _ = False
isCore (Location lib mod _ _ _) db = case getModule lib mod db of
Nothing = False
(Just b) = b.is_core
(Just b) = b.me_is_core
toExtendedTypeDef :: TypeDef (Maybe Documentation) -> ExtendedTypeDef
toExtendedTypeDef td doc = {etd_typedef=td, etd_doc=doc}
toTypeDefEntry :: TypeDef (Maybe Documentation) -> TypeDefEntry
toTypeDefEntry td doc = {tde_typedef=td, tde_doc=doc}
getTypeDef :: ExtendedTypeDef -> TypeDef
getTypeDef {etd_typedef} = etd_typedef
getTypeDef :: TypeDefEntry -> TypeDef
getTypeDef {tde_typedef} = tde_typedef
getTypeDefDoc :: ExtendedTypeDef -> Maybe Documentation
getTypeDefDoc {etd_doc} = etd_doc
getTypeDefDoc :: TypeDefEntry -> Maybe Documentation
getTypeDefDoc {tde_doc} = tde_doc
toClass :: [String] ClassContext (Maybe Documentation) [(Name, ExtendedType)] -> Class
toClass :: [String] ClassContext (Maybe Documentation) [(Name, FunctionEntry)] -> ClassEntry
toClass vs cc doc mems
= { class_vars = vs
, class_context = cc
, class_documentation = doc
, class_members = mems
= { ce_vars = vs
, ce_context = cc
, ce_documentation = doc
, ce_members = mems
}
functionCount :: TypeDB -> Int
functionCount :: CloogleDB -> Int
functionCount {functionmap} = mapSize functionmap
macroCount :: TypeDB -> Int
macroCount {macromap} = mapSize macromap
classCount :: TypeDB -> Int
classCount :: CloogleDB -> Int
classCount {classmap} = mapSize classmap
instanceCount :: TypeDB -> Int
instanceCount :: CloogleDB -> Int
instanceCount {instancemap} = sum $ map length $ elems instancemap
typeCount :: TypeDB -> Int
typeCount :: CloogleDB -> Int
typeCount {typemap} = mapSize typemap
deriveCount :: TypeDB -> Int
deriveCount :: CloogleDB -> Int
deriveCount {derivemap} = sum $ map length $ elems derivemap
moduleCount :: TypeDB -> Int
moduleCount :: CloogleDB -> Int
moduleCount {modulemap} = mapSize modulemap
filterLocations :: (Location -> Bool) TypeDB -> TypeDB
filterLocations :: (Location -> Bool) CloogleDB -> CloogleDB
filterLocations f db
= { db
& functionmap = filterLoc db.functionmap
, macromap = filterLoc db.macromap
, classmap = filterLoc db.classmap
, typemap = filterLoc db.typemap
, instancemap = filtInstLocs <$> db.instancemap
......@@ -186,197 +181,176 @@ where
filterLoc :: ((Map Location a) -> Map Location a)
filterLoc = filterWithKey (const o f)
filtInstLocs :: [(a, [Location])] -> [(a, [Location])]
filtInstLocs :: [InstanceEntry] -> [InstanceEntry]
filtInstLocs [] = []
filtInstLocs [(t,ls):rest] = case ls` of
[] = filtInstLocs rest
_ = [(t,ls`):filtInstLocs rest]
where ls` = filter f ls
filtInstLocs [ie:rest] = case filter f ie.ie_locations of
[] = filtInstLocs rest
ls = [{ie & ie_locations=ls}:filtInstLocs rest]
filtDervLocs :: [(a, b, [Location])] -> [(a, b, [Location])]
filtDervLocs :: [DeriveEntry] -> [DeriveEntry]
filtDervLocs [] = []
filtDervLocs [(t,s,ls):rest] = case ls` of
[] = filtDervLocs rest
_ = [(t,s,ls`):filtDervLocs rest]
where ls` = filter f ls
filtDervLocs [de:rest] = case filter f de.de_locations of
[] = filtDervLocs rest
ls = [{de & de_locations=ls}:filtDervLocs rest]
filtModules :: ((Map (Library, Module) a) -> Map (Library, Module) a)
filtModules = filterWithKey (\(l,m) _ -> f (Location l m Nothing Nothing undef))
getFunction :: Location TypeDB -> Maybe ExtendedType
getFunction :: Location CloogleDB -> Maybe FunctionEntry
getFunction loc {functionmap} = get loc functionmap
putFunction :: !Location !ExtendedType !TypeDB -> TypeDB
putFunction :: !Location !FunctionEntry !CloogleDB -> CloogleDB
putFunction fl t tdb=:{functionmap} = { tdb & functionmap = put fl t functionmap }
putFunctions :: ![(!Location, !ExtendedType)] !TypeDB -> TypeDB
putFunctions :: ![(!Location, !FunctionEntry)] !CloogleDB -> CloogleDB
putFunctions ts tdb = foldr (\(loc,t) db -> putFunction loc t db) tdb ts
findFunction :: Name TypeDB -> [(Location, ExtendedType)]
findFunction :: Name CloogleDB -> [(Location, FunctionEntry)]
findFunction f db=:{functionmap}
= toList $ filterWithKey (\fl _-> f == getName fl) functionmap
findFunction` :: (Location ExtendedType -> Bool) TypeDB
-> [(Location, ExtendedType)]
findFunction` :: (Location FunctionEntry -> Bool) CloogleDB
-> [(Location, FunctionEntry)]
findFunction` f {functionmap} = toList $ filterWithKey f functionmap
findFunction`` :: [(Location ExtendedType -> Bool)] TypeDB
-> [(Location, ExtendedType)]