module { export = [possibleUnsafeSclValueByName, unsafeSclValueByName, sclModuleNames, moduleByName, documentationOfSCLValue, sclValueRef] } include "./CurrentModuleRepository" include "./Module" importJava "org.simantics.scl.compiler.elaboration.modules.SCLValue" where data SCLValue @JavaName getDocumentation documentationOfSCLValue_ :: SCLValue -> Maybe String documentationOfSCLValue value = fromMaybe "" (documentationOfSCLValue_ value) importJava "org.simantics.scl.compiler.module.repository.ModuleRepository" where // data ModuleRepository // defined in CurrentModuleRepository @JavaName getValue unsafeSclValueByName_ :: ModuleRepository -> String -> a @JavaName getValueRef sclValueRef_ :: ModuleRepository -> String -> Maybe SCLValue @JavaName getSourceRepository moduleSourceRepositoryOf :: ModuleRepository -> ModuleSourceRepository @JavaName getModule moduleByName_ :: ModuleRepository -> String -> Failable Module importJava "org.simantics.scl.compiler.source.repository.ModuleSourceRepository" where data ModuleSourceRepository @JavaName getModuleNames sclModuleNames_ :: ModuleSourceRepository -> [String] importJava "org.simantics.scl.compiler.errors.Failable" where data Failable a didSucceed :: Failable a -> Boolean getResult :: Failable a -> Maybe a unsafeSclValueByName :: String -> a unsafeSclValueByName = unsafeSclValueByName_ MODULE_REPOSITORY sclValueRef name = sclValueRef_ MODULE_REPOSITORY name possibleUnsafeSclValueByName :: String -> Maybe a possibleUnsafeSclValueByName name = Just (unsafeSclValueByName name) `catch` \(_ :: Exception) -> Nothing sclModuleNames :: [String] sclModuleNames = sclModuleNames_ (moduleSourceRepositoryOf MODULE_REPOSITORY) moduleByName :: String -> Maybe Module moduleByName name = getResult failable where failable = moduleByName_ MODULE_REPOSITORY name