<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>DynamicLoading</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_DynamicLoading.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">ghc-7.4.2: The GHC API</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">DynamicLoading</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Force loading information </a></li><li><a href="#g:2">Finding names </a></li><li><a href="#g:3">Loading values </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Dynamically lookup up values from modules and loading them. </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:forceLoadModuleInterfaces">forceLoadModuleInterfaces</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Outputable.html#t:SDoc">SDoc</a> -> [<a href="Module.html#t:Module">Module</a>] -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:forceLoadNameModuleInterface">forceLoadNameModuleInterface</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Outputable.html#t:SDoc">SDoc</a> -> <a href="Name.html#t:Name">Name</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:forceLoadTyCon">forceLoadTyCon</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Name.html#t:Name">Name</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="TyCon.html#t:TyCon">TyCon</a></li><li class="src short"><a href="#v:lookupRdrNameInModule">lookupRdrNameInModule</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Module.html#t:ModuleName">ModuleName</a> -> <a href="RdrName.html#t:RdrName">RdrName</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> (<a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Name.html#t:Name">Name</a>)</li><li class="src short"><a href="#v:getValueSafely">getValueSafely</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Name.html#t:Name">Name</a> -> <a href="Type.html#t:Type">Type</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> (<a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:lessUnsafeCoerce">lessUnsafeCoerce</a> :: <a href="DynFlags.html#t:DynFlags">DynFlags</a> -> <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -> a -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> b</li></ul></div><div id="interface"><h1 id="g:1">Force loading information </h1><div class="top"><p class="src"><a name="v:forceLoadModuleInterfaces" class="def">forceLoadModuleInterfaces</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Outputable.html#t:SDoc">SDoc</a> -> [<a href="Module.html#t:Module">Module</a>] -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Force the interfaces for the given modules to be loaded. The <code><a href="Outputable.html#t:SDoc">SDoc</a></code> parameter is used for debugging (<code>-ddump-if-trace</code>) only: it is shown as the reason why the module is being loaded. </p></div></div><div class="top"><p class="src"><a name="v:forceLoadNameModuleInterface" class="def">forceLoadNameModuleInterface</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Outputable.html#t:SDoc">SDoc</a> -> <a href="Name.html#t:Name">Name</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> ()</p><div class="doc"><p>Force the interface for the module containing the name to be loaded. The <code><a href="Outputable.html#t:SDoc">SDoc</a></code> parameter is used for debugging (<code>-ddump-if-trace</code>) only: it is shown as the reason why the module is being loaded. </p></div></div><div class="top"><p class="src"><a name="v:forceLoadTyCon" class="def">forceLoadTyCon</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Name.html#t:Name">Name</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> <a href="TyCon.html#t:TyCon">TyCon</a></p><div class="doc"><p>Load the <code><a href="TyCon.html#t:TyCon">TyCon</a></code> associated with the given name, come hell or high water. Fails if: </p><ul><li> The interface could not be loaded * The name is not that of a <code><a href="TyCon.html#t:TyCon">TyCon</a></code> * The name did not exist in the loaded module </li></ul></div></div><h1 id="g:2">Finding names </h1><div class="top"><p class="src"><a name="v:lookupRdrNameInModule" class="def">lookupRdrNameInModule</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Module.html#t:ModuleName">ModuleName</a> -> <a href="RdrName.html#t:RdrName">RdrName</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> (<a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Name.html#t:Name">Name</a>)</p><div class="doc"><p>Finds the <code><a href="Name.html#t:Name">Name</a></code> corresponding to the given <code><a href="RdrName.html#t:RdrName">RdrName</a></code> in the context of the <code><a href="Module.html#t:ModuleName">ModuleName</a></code>. Returns <code>Nothing</code> if no such <code><a href="Name.html#t:Name">Name</a></code> could be found. Any other condition results in an exception: </p><ul><li> If the module could not be found * If we could not determine the imports of the module </li></ul></div></div><h1 id="g:3">Loading values </h1><div class="top"><p class="src"><a name="v:getValueSafely" class="def">getValueSafely</a> :: <a href="HscTypes.html#t:HscEnv">HscEnv</a> -> <a href="Name.html#t:Name">Name</a> -> <a href="Type.html#t:Type">Type</a> -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> (<a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</p><div class="doc"><p>Loads the value corresponding to a <code><a href="Name.html#t:Name">Name</a></code> if that value has the given <code><a href="Type.html#t:Type">Type</a></code>. This only provides limited safety in that it is up to the user to ensure that that type corresponds to the type you try to use the return value at! </p><p>If the value found was not of the correct type, returns <code>Nothing</code>. Any other condition results in an exception: </p><ul><li> If we could not load the names module * If the thing being loaded is not a value * If the Name does not exist in the module * If the link failed </li></ul></div></div><div class="top"><p class="src"><a name="v:lessUnsafeCoerce" class="def">lessUnsafeCoerce</a> :: <a href="DynFlags.html#t:DynFlags">DynFlags</a> -> <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -> a -> <a href="../base-4.5.1.0/System-IO.html#t:IO">IO</a> b</p><div class="doc"><p>Coerce a value as usual, but: </p><p>1) Evaluate it immediately to get a segfault early if the coercion was wrong </p><p>2) Wrap it in some debug messages at verbosity 3 or higher so we can see what happened if it <em>does</em> segfault </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>