Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 6e204a966e8c42d976f99a1700ce5f20 > files > 3030

ghc-7.4.2-4.mga5.i586.rpm

<!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>Rules</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_Rules.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">Rules</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">RuleBase
</a><ul><li><a href="#g:2">Constructing 
</a></li><li><a href="#g:3">Checking rule applications
</a></li><li><a href="#g:4">Manipulating <code><a href="IdInfo.html#t:SpecInfo">SpecInfo</a></code> rules
</a></li></ul></li><li><a href="#g:5">Misc. CoreRule helpers
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Functions for collecting together and applying rewrite rules to a module.
 The <code><a href="CoreSyn.html#t:CoreRule">CoreRule</a></code> datatype itself is declared elsewhere.
</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"><span class="keyword">type</span> <a href="#t:RuleBase">RuleBase</a> = <a href="NameEnv.html#t:NameEnv">NameEnv</a> [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>]</li><li class="src short"><a href="#v:emptyRuleBase">emptyRuleBase</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a></li><li class="src short"><a href="#v:mkRuleBase">mkRuleBase</a> :: [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a></li><li class="src short"><a href="#v:extendRuleBaseList">extendRuleBaseList</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a></li><li class="src short"><a href="#v:unionRuleBase">unionRuleBase</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a></li><li class="src short"><a href="#v:pprRuleBase">pprRuleBase</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="Outputable.html#t:SDoc">SDoc</a></li><li class="src short"><a href="#v:ruleCheckProgram">ruleCheckProgram</a> :: <a href="BasicTypes.html#t:CompilerPhase">CompilerPhase</a> -&gt; <a href="../base-4.5.1.0/Data-String.html#t:String">String</a> -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="CoreSyn.html#t:CoreProgram">CoreProgram</a> -&gt; <a href="Outputable.html#t:SDoc">SDoc</a></li><li class="src short"><a href="#v:mkSpecInfo">mkSpecInfo</a> :: [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="IdInfo.html#t:SpecInfo">SpecInfo</a></li><li class="src short"><a href="#v:extendSpecInfo">extendSpecInfo</a> :: <a href="IdInfo.html#t:SpecInfo">SpecInfo</a> -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="IdInfo.html#t:SpecInfo">SpecInfo</a></li><li class="src short"><a href="#v:addSpecInfo">addSpecInfo</a> :: <a href="IdInfo.html#t:SpecInfo">SpecInfo</a> -&gt; <a href="IdInfo.html#t:SpecInfo">SpecInfo</a> -&gt; <a href="IdInfo.html#t:SpecInfo">SpecInfo</a></li><li class="src short"><a href="#v:addIdSpecialisations">addIdSpecialisations</a> :: <a href="Var.html#t:Id">Id</a> -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="Var.html#t:Id">Id</a></li><li class="src short"><a href="#v:rulesOfBinds">rulesOfBinds</a> :: [<a href="CoreSyn.html#t:CoreBind">CoreBind</a>] -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>]</li><li class="src short"><a href="#v:getRules">getRules</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="Var.html#t:Id">Id</a> -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>]</li><li class="src short"><a href="#v:pprRulesForUser">pprRulesForUser</a> :: [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="Outputable.html#t:SDoc">SDoc</a></li><li class="src short"><a href="#v:lookupRule">lookupRule</a> :: (<a href="BasicTypes.html#t:Activation">Activation</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="CoreSyn.html#t:IdUnfoldingFun">IdUnfoldingFun</a> -&gt; <a href="VarEnv.html#t:InScopeSet">InScopeSet</a> -&gt; <a href="Var.html#t:Id">Id</a> -&gt; [<a href="CoreSyn.html#t:CoreExpr">CoreExpr</a>] -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="CoreSyn.html#t:CoreRule">CoreRule</a>, <a href="CoreSyn.html#t:CoreExpr">CoreExpr</a>)</li><li class="src short"><a href="#v:mkRule">mkRule</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="BasicTypes.html#t:RuleName">RuleName</a> -&gt; <a href="BasicTypes.html#t:Activation">Activation</a> -&gt; <a href="Name.html#t:Name">Name</a> -&gt; [<a href="CoreSyn.html#t:CoreBndr">CoreBndr</a>] -&gt; [<a href="CoreSyn.html#t:CoreExpr">CoreExpr</a>] -&gt; <a href="CoreSyn.html#t:CoreExpr">CoreExpr</a> -&gt; <a href="CoreSyn.html#t:CoreRule">CoreRule</a></li><li class="src short"><a href="#v:roughTopNames">roughTopNames</a> :: [<a href="CoreSyn.html#t:CoreExpr">CoreExpr</a>] -&gt; [<a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Name.html#t:Name">Name</a>]</li></ul></div><div id="interface"><h1 id="g:1">RuleBase
</h1><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:RuleBase" class="def">RuleBase</a> = <a href="NameEnv.html#t:NameEnv">NameEnv</a> [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>]</p><div class="doc"><p>Gathers a collection of <code><a href="CoreSyn.html#t:CoreRule">CoreRule</a></code>s. Maps (the name of) an <code><a href="Var.html#t:Id">Id</a></code> to its rules
</p></div></div><h2 id="g:2">Constructing 
</h2><div class="top"><p class="src"><a name="v:emptyRuleBase" class="def">emptyRuleBase</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a></p></div><div class="top"><p class="src"><a name="v:mkRuleBase" class="def">mkRuleBase</a> :: [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a></p></div><div class="top"><p class="src"><a name="v:extendRuleBaseList" class="def">extendRuleBaseList</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a></p></div><div class="top"><p class="src"><a name="v:unionRuleBase" class="def">unionRuleBase</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="Rules.html#t:RuleBase">RuleBase</a></p></div><div class="top"><p class="src"><a name="v:pprRuleBase" class="def">pprRuleBase</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="Outputable.html#t:SDoc">SDoc</a></p></div><h2 id="g:3">Checking rule applications
</h2><div class="top"><p class="src"><a name="v:ruleCheckProgram" class="def">ruleCheckProgram</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="BasicTypes.html#t:CompilerPhase">CompilerPhase</a></td><td class="doc"><p>Rule activation test
</p></td></tr><tr><td class="src">-&gt; <a href="../base-4.5.1.0/Data-String.html#t:String">String</a></td><td class="doc"><p>Rule pattern
</p></td></tr><tr><td class="src">-&gt; <a href="Rules.html#t:RuleBase">RuleBase</a></td><td class="doc"><p>Database of rules
</p></td></tr><tr><td class="src">-&gt; <a href="CoreSyn.html#t:CoreProgram">CoreProgram</a></td><td class="doc"><p>Bindings to check in
</p></td></tr><tr><td class="src">-&gt; <a href="Outputable.html#t:SDoc">SDoc</a></td><td class="doc"><p>Resulting check message
</p></td></tr></table></div><div class="doc"><p>Report partial matches for rules beginning with the specified
 string for the purposes of error reporting
</p></div></div><h2 id="g:4">Manipulating <code><a href="IdInfo.html#t:SpecInfo">SpecInfo</a></code> rules
</h2><div class="top"><p class="src"><a name="v:mkSpecInfo" class="def">mkSpecInfo</a> :: [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="IdInfo.html#t:SpecInfo">SpecInfo</a></p><div class="doc"><p>Make a <code><a href="IdInfo.html#t:SpecInfo">SpecInfo</a></code> containing a number of <code><a href="CoreSyn.html#t:CoreRule">CoreRule</a></code>s, suitable
 for putting into an <code>IdInfo</code>
</p></div></div><div class="top"><p class="src"><a name="v:extendSpecInfo" class="def">extendSpecInfo</a> :: <a href="IdInfo.html#t:SpecInfo">SpecInfo</a> -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="IdInfo.html#t:SpecInfo">SpecInfo</a></p></div><div class="top"><p class="src"><a name="v:addSpecInfo" class="def">addSpecInfo</a> :: <a href="IdInfo.html#t:SpecInfo">SpecInfo</a> -&gt; <a href="IdInfo.html#t:SpecInfo">SpecInfo</a> -&gt; <a href="IdInfo.html#t:SpecInfo">SpecInfo</a></p></div><div class="top"><p class="src"><a name="v:addIdSpecialisations" class="def">addIdSpecialisations</a> :: <a href="Var.html#t:Id">Id</a> -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="Var.html#t:Id">Id</a></p></div><h1 id="g:5">Misc. CoreRule helpers
</h1><div class="top"><p class="src"><a name="v:rulesOfBinds" class="def">rulesOfBinds</a> :: [<a href="CoreSyn.html#t:CoreBind">CoreBind</a>] -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>]</p><div class="doc"><p>Gather all the rules for locally bound identifiers from the supplied bindings
</p></div></div><div class="top"><p class="src"><a name="v:getRules" class="def">getRules</a> :: <a href="Rules.html#t:RuleBase">RuleBase</a> -&gt; <a href="Var.html#t:Id">Id</a> -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>]</p></div><div class="top"><p class="src"><a name="v:pprRulesForUser" class="def">pprRulesForUser</a> :: [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="Outputable.html#t:SDoc">SDoc</a></p></div><div class="top"><p class="src"><a name="v:lookupRule" class="def">lookupRule</a> :: (<a href="BasicTypes.html#t:Activation">Activation</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="CoreSyn.html#t:IdUnfoldingFun">IdUnfoldingFun</a> -&gt; <a href="VarEnv.html#t:InScopeSet">InScopeSet</a> -&gt; <a href="Var.html#t:Id">Id</a> -&gt; [<a href="CoreSyn.html#t:CoreExpr">CoreExpr</a>] -&gt; [<a href="CoreSyn.html#t:CoreRule">CoreRule</a>] -&gt; <a href="../base-4.5.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="CoreSyn.html#t:CoreRule">CoreRule</a>, <a href="CoreSyn.html#t:CoreExpr">CoreExpr</a>)</p><div class="doc"><p>The main rule matching function. Attempts to apply all (active)
 supplied rules to this instance of an application in a given
 context, returning the rule applied and the resulting expression if
 successful.
</p></div></div><div class="top"><p class="src"><a name="v:mkRule" class="def">mkRule</a> :: <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="../base-4.5.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="BasicTypes.html#t:RuleName">RuleName</a> -&gt; <a href="BasicTypes.html#t:Activation">Activation</a> -&gt; <a href="Name.html#t:Name">Name</a> -&gt; [<a href="CoreSyn.html#t:CoreBndr">CoreBndr</a>] -&gt; [<a href="CoreSyn.html#t:CoreExpr">CoreExpr</a>] -&gt; <a href="CoreSyn.html#t:CoreExpr">CoreExpr</a> -&gt; <a href="CoreSyn.html#t:CoreRule">CoreRule</a></p><div class="doc"><p>Used to make <code><a href="CoreSyn.html#t:CoreRule">CoreRule</a></code> for an <code><a href="Var.html#t:Id">Id</a></code> defined in the module being 
 compiled. See also <code><a href="CoreSyn.html#t:CoreRule">CoreRule</a></code>
</p></div></div><div class="top"><p class="src"><a name="v:roughTopNames" class="def">roughTopNames</a> :: [<a href="CoreSyn.html#t:CoreExpr">CoreExpr</a>] -&gt; [<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>Find the &quot;top&quot; free names of several expressions. 
 Such names are either:
</p><ol><li> The function finally being applied to in an application chain
    (if that name is a GlobalId: see <a href="Var.html#globalvslocal">Var</a>), or
</li><li> The <code>TyCon</code> if the expression is a <code><a href="Type.html#t:Type">Type</a></code>
</li></ol><p>This is used for the fast-match-check for rules; 
	if the top names don't match, the rest can't
</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>