This file is indexed.

/usr/share/doc/libghc-language-c-doc/html/Language-C-Analysis-TravMonad.html is in libghc-language-c-doc 0.7.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
<!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>Language.C.Analysis.TravMonad</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Language-C-Analysis-TravMonad.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Language-C-Analysis-TravMonad.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">language-c-0.7.1: Analysis and generation of C code</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>(c) 2008 Benedikt Huber</td></tr><tr><th>License</th><td>BSD-style</td></tr><tr><th>Maintainer</th><td>benedikt.huber@gmail.com</td></tr><tr><th>Stability</th><td>alpha</td></tr><tr><th>Portability</th><td>ghc</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Language.C.Analysis.TravMonad</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Name generation monad</a></li><li><a href="#g:2">Symbol table monad</a></li><li><a href="#g:3">Specialized C error-handling monad</a></li><li><a href="#g:4">AST traversal monad</a></li><li><a href="#g:5">Handling declarations</a></li><li><a href="#g:6">Symbol table scope modification</a></li><li><a href="#g:7">Symbol table lookup (delegate)</a></li><li><a href="#g:8">Symbol table modification</a></li><li><a href="#g:9">Additional error handling facilities</a></li><li><a href="#g:10">Trav - default MonadTrav implementation</a></li><li><a href="#g:11">Language options</a></li><li><a href="#g:12">Helpers</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Monad for Traversals of the C AST.</p><p>For the traversal, we maintain a symboltable and need MonadError and unique
 name generation facilities.
 Furthermore, the user may provide callbacks to handle declarations and definitions.</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">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="#t:MonadName">MonadName</a> m <span class="keyword">where</span><ul class="subs"></ul></li><li class="src short"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="#t:MonadSymtab">MonadSymtab</a> m <span class="keyword">where</span><ul class="subs"></ul></li><li class="src short"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="#t:MonadCError">MonadCError</a> m <span class="keyword">where</span><ul class="subs"></ul></li><li class="src short"><span class="keyword">class</span> (<a href="Language-C-Analysis-TravMonad.html#t:MonadName">MonadName</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m) =&gt; <a href="#t:MonadTrav">MonadTrav</a> m <span class="keyword">where</span><ul class="subs"></ul></li><li class="src short"><a href="#v:handleTagDecl">handleTagDecl</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Analysis-DefTable.html#t:TagFwdDecl">TagFwdDecl</a> -&gt; m ()</li><li class="src short"><a href="#v:handleTagDef">handleTagDef</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Analysis-SemRep.html#t:TagDef">TagDef</a> -&gt; m ()</li><li class="src short"><a href="#v:handleEnumeratorDef">handleEnumeratorDef</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Analysis-SemRep.html#t:Enumerator">Enumerator</a> -&gt; m ()</li><li class="src short"><a href="#v:handleTypeDef">handleTypeDef</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Analysis-SemRep.html#t:TypeDef">TypeDef</a> -&gt; m ()</li><li class="src short"><a href="#v:handleObjectDef">handleObjectDef</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; <a href="Language-C-Analysis-SemRep.html#t:ObjDef">ObjDef</a> -&gt; m ()</li><li class="src short"><a href="#v:handleFunDef">handleFunDef</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; <a href="Language-C-Analysis-SemRep.html#t:FunDef">FunDef</a> -&gt; m ()</li><li class="src short"><a href="#v:handleVarDecl">handleVarDecl</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="Language-C-Analysis-SemRep.html#t:Decl">Decl</a> -&gt; m ()</li><li class="src short"><a href="#v:handleParamDecl">handleParamDecl</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Analysis-SemRep.html#t:ParamDecl">ParamDecl</a> -&gt; m ()</li><li class="src short"><a href="#v:handleAsmBlock">handleAsmBlock</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Analysis-SemRep.html#t:AsmBlock">AsmBlock</a> -&gt; m ()</li><li class="src short"><a href="#v:enterPrototypeScope">enterPrototypeScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m ()</li><li class="src short"><a href="#v:leavePrototypeScope">leavePrototypeScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m ()</li><li class="src short"><a href="#v:enterFunctionScope">enterFunctionScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m ()</li><li class="src short"><a href="#v:leaveFunctionScope">leaveFunctionScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m ()</li><li class="src short"><a href="#v:enterBlockScope">enterBlockScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m ()</li><li class="src short"><a href="#v:leaveBlockScope">leaveBlockScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m ()</li><li class="src short"><a href="#v:lookupTypeDef">lookupTypeDef</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; m <a href="Language-C-Analysis-SemRep.html#t:Type">Type</a></li><li class="src short"><a href="#v:lookupObject">lookupObject</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Language-C-Analysis-SemRep.html#t:IdentDecl">IdentDecl</a>)</li><li class="src short"><a href="#v:createSUERef">createSUERef</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Data-Node.html#t:NodeInfo">NodeInfo</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; m <a href="Language-C-Data-Ident.html#t:SUERef">SUERef</a></li><li class="src short"><a href="#v:hadHardErrors">hadHardErrors</a> :: [<a href="Language-C-Data-Error.html#t:CError">CError</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:handleTravError">handleTravError</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m =&gt; m a -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:throwOnLeft">throwOnLeft</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Data-Error.html#t:Error">Error</a> e) =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> e a -&gt; m a</li><li class="src short"><a href="#v:astError">astError</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m =&gt; <a href="Language-C-Data-Node.html#t:NodeInfo">NodeInfo</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -&gt; m a</li><li class="src short"><a href="#v:warn">warn</a> :: (<a href="Language-C-Data-Error.html#t:Error">Error</a> e, <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m) =&gt; e -&gt; m ()</li><li class="src short"><span class="keyword">data</span> <a href="#t:Trav">Trav</a> s a</li><li class="src short"><a href="#v:runTrav">runTrav</a> :: <span class="keyword">forall</span> s a. s -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> [<a href="Language-C-Data-Error.html#t:CError">CError</a>] (a, <a href="Language-C-Analysis-TravMonad.html#t:TravState">TravState</a> s)</li><li class="src short"><a href="#v:runTrav_">runTrav_</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> () a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> [<a href="Language-C-Data-Error.html#t:CError">CError</a>] (a, [<a href="Language-C-Data-Error.html#t:CError">CError</a>])</li><li class="src short"><span class="keyword">data</span> <a href="#t:TravState">TravState</a> s</li><li class="src short"><a href="#v:initTravState">initTravState</a> :: s -&gt; <a href="Language-C-Analysis-TravMonad.html#t:TravState">TravState</a> s</li><li class="src short"><a href="#v:withExtDeclHandler">withExtDeclHandler</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; (<a href="Language-C-Analysis-SemRep.html#t:DeclEvent">DeclEvent</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s ()) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a</li><li class="src short"><a href="#v:modifyUserState">modifyUserState</a> :: (s -&gt; s) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s ()</li><li class="src short"><a href="#v:userState">userState</a> :: <a href="Language-C-Analysis-TravMonad.html#t:TravState">TravState</a> s -&gt; s</li><li class="src short"><a href="#v:getUserState">getUserState</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s s</li><li class="src short"><span class="keyword">data</span> <a href="#t:TravOptions">TravOptions</a> = <a href="#v:TravOptions">TravOptions</a> {<ul class="subs"><li><a href="#v:language">language</a> :: <a href="Language-C-Analysis-TravMonad.html#t:CLanguage">CLanguage</a></li></ul>}</li><li class="src short"><a href="#v:modifyOptions">modifyOptions</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:TravOptions">TravOptions</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:TravOptions">TravOptions</a>) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s ()</li><li class="src short"><a href="#v:travErrors">travErrors</a> :: <a href="Language-C-Analysis-TravMonad.html#t:TravState">TravState</a> s -&gt; [<a href="Language-C-Data-Error.html#t:CError">CError</a>]</li><li class="src short"><span class="keyword">data</span> <a href="#t:CLanguage">CLanguage</a><ul class="subs"><li>= <a href="#v:C89">C89</a></li><li>| <a href="#v:C99">C99</a></li><li>| <a href="#v:GNU89">GNU89</a></li><li>| <a href="#v:GNU99">GNU99</a></li></ul></li><li class="src short"><a href="#v:mapMaybeM">mapMaybeM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a -&gt; (a -&gt; m b) -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> b)</li><li class="src short"><a href="#v:maybeM">maybeM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a -&gt; (a -&gt; m ()) -&gt; m ()</li><li class="src short"><a href="#v:mapSndM">mapSndM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (b -&gt; m c) -&gt; (a, b) -&gt; m (a, c)</li><li class="src short"><a href="#v:concatMapM">concatMapM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; m [b]) -&gt; [a] -&gt; m [b]</li></ul></div><div id="interface"><h1 id="g:1">Name generation monad</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a id="t:MonadName" class="def">MonadName</a> m <span class="keyword">where</span> <a href="src/Language-C-Analysis-TravMonad.html#MonadName" class="link">Source</a> <a href="#t:MonadName" class="selflink">#</a></p><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Language-C-Analysis-TravMonad.html#v:genName">genName</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a id="v:genName" class="def">genName</a> :: m <a href="Language-C-Data-Name.html#t:Name">Name</a> <a href="src/Language-C-Analysis-TravMonad.html#genName" class="link">Source</a> <a href="#v:genName" class="selflink">#</a></p><div class="doc"><p>unique name generation</p></div></div><div class="subs instances"><p id="control.i:MonadName" class="caption collapser" onclick="toggleSection('i:MonadName')">Instances</p><div id="section.i:MonadName" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:MonadName:MonadName:1" class="instance expander" onclick="toggleSection('i:ic:MonadName:MonadName:1')"></span> <a href="Language-C-Analysis-TravMonad.html#t:MonadName">MonadName</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-427" class="link">Source</a> <a href="#t:MonadName" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:MonadName:MonadName:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:genName">genName</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s <a href="Language-C-Data-Name.html#t:Name">Name</a> <a href="src/Language-C-Analysis-TravMonad.html#genName" class="link">Source</a> <a href="#v:genName" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><h1 id="g:2">Symbol table monad</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a id="t:MonadSymtab" class="def">MonadSymtab</a> m <span class="keyword">where</span> <a href="src/Language-C-Analysis-TravMonad.html#MonadSymtab" class="link">Source</a> <a href="#t:MonadSymtab" class="selflink">#</a></p><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Language-C-Analysis-TravMonad.html#v:getDefTable">getDefTable</a>, <a href="Language-C-Analysis-TravMonad.html#v:withDefTable">withDefTable</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a id="v:getDefTable" class="def">getDefTable</a> :: m <a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a> <a href="src/Language-C-Analysis-TravMonad.html#getDefTable" class="link">Source</a> <a href="#v:getDefTable" class="selflink">#</a></p><div class="doc"><p>return the definition table</p></div><p class="src"><a id="v:withDefTable" class="def">withDefTable</a> :: (<a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a> -&gt; (a, <a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a>)) -&gt; m a <a href="src/Language-C-Analysis-TravMonad.html#withDefTable" class="link">Source</a> <a href="#v:withDefTable" class="selflink">#</a></p><div class="doc"><p>perform an action modifying the definition table</p></div></div><div class="subs instances"><p id="control.i:MonadSymtab" class="caption collapser" onclick="toggleSection('i:MonadSymtab')">Instances</p><div id="section.i:MonadSymtab" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:MonadSymtab:MonadSymtab:1" class="instance expander" onclick="toggleSection('i:ic:MonadSymtab:MonadSymtab:1')"></span> <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-431" class="link">Source</a> <a href="#t:MonadSymtab" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:MonadSymtab:MonadSymtab:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:getDefTable">getDefTable</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s <a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a> <a href="src/Language-C-Analysis-TravMonad.html#getDefTable" class="link">Source</a> <a href="#v:getDefTable" class="selflink">#</a></p><p class="src"><a href="#v:withDefTable">withDefTable</a> :: (<a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a> -&gt; (a, <a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a>)) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="src/Language-C-Analysis-TravMonad.html#withDefTable" class="link">Source</a> <a href="#v:withDefTable" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><h1 id="g:3">Specialized C error-handling monad</h1><div class="top"><p class="src"><span class="keyword">class</span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a id="t:MonadCError" class="def">MonadCError</a> m <span class="keyword">where</span> <a href="src/Language-C-Analysis-TravMonad.html#MonadCError" class="link">Source</a> <a href="#t:MonadCError" class="selflink">#</a></p><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Language-C-Analysis-TravMonad.html#v:throwTravError">throwTravError</a>, <a href="Language-C-Analysis-TravMonad.html#v:catchTravError">catchTravError</a>, <a href="Language-C-Analysis-TravMonad.html#v:recordError">recordError</a>, <a href="Language-C-Analysis-TravMonad.html#v:getErrors">getErrors</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a id="v:throwTravError" class="def">throwTravError</a> :: <a href="Language-C-Data-Error.html#t:Error">Error</a> e =&gt; e -&gt; m a <a href="src/Language-C-Analysis-TravMonad.html#throwTravError" class="link">Source</a> <a href="#v:throwTravError" class="selflink">#</a></p><div class="doc"><p>throw an <code><a href="Language-C-Data-Error.html#t:Error">Error</a></code></p></div><p class="src"><a id="v:catchTravError" class="def">catchTravError</a> :: m a -&gt; (<a href="Language-C-Data-Error.html#t:CError">CError</a> -&gt; m a) -&gt; m a <a href="src/Language-C-Analysis-TravMonad.html#catchTravError" class="link">Source</a> <a href="#v:catchTravError" class="selflink">#</a></p><div class="doc"><p>catch an <code><a href="Language-C-Data-Error.html#t:Error">Error</a></code> (we could implement dynamically-typed catch here)</p></div><p class="src"><a id="v:recordError" class="def">recordError</a> :: <a href="Language-C-Data-Error.html#t:Error">Error</a> e =&gt; e -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#recordError" class="link">Source</a> <a href="#v:recordError" class="selflink">#</a></p><div class="doc"><p>remember that an <code><a href="Language-C-Data-Error.html#t:Error">Error</a></code> occurred (without throwing it)</p></div><p class="src"><a id="v:getErrors" class="def">getErrors</a> :: m [<a href="Language-C-Data-Error.html#t:CError">CError</a>] <a href="src/Language-C-Analysis-TravMonad.html#getErrors" class="link">Source</a> <a href="#v:getErrors" class="selflink">#</a></p><div class="doc"><p>return the list of recorded errors</p></div></div><div class="subs instances"><p id="control.i:MonadCError" class="caption collapser" onclick="toggleSection('i:MonadCError')">Instances</p><div id="section.i:MonadCError" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:MonadCError:MonadCError:1" class="instance expander" onclick="toggleSection('i:ic:MonadCError:MonadCError:1')"></span> <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-440" class="link">Source</a> <a href="#t:MonadCError" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:MonadCError:MonadCError:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:throwTravError">throwTravError</a> :: <a href="Language-C-Data-Error.html#t:Error">Error</a> e =&gt; e -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="src/Language-C-Analysis-TravMonad.html#throwTravError" class="link">Source</a> <a href="#v:throwTravError" class="selflink">#</a></p><p class="src"><a href="#v:catchTravError">catchTravError</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; (<a href="Language-C-Data-Error.html#t:CError">CError</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="src/Language-C-Analysis-TravMonad.html#catchTravError" class="link">Source</a> <a href="#v:catchTravError" class="selflink">#</a></p><p class="src"><a href="#v:recordError">recordError</a> :: <a href="Language-C-Data-Error.html#t:Error">Error</a> e =&gt; e -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s () <a href="src/Language-C-Analysis-TravMonad.html#recordError" class="link">Source</a> <a href="#v:recordError" class="selflink">#</a></p><p class="src"><a href="#v:getErrors">getErrors</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s [<a href="Language-C-Data-Error.html#t:CError">CError</a>] <a href="src/Language-C-Analysis-TravMonad.html#getErrors" class="link">Source</a> <a href="#v:getErrors" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><h1 id="g:4">AST traversal monad</h1><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Language-C-Analysis-TravMonad.html#t:MonadName">MonadName</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m) =&gt; <a id="t:MonadTrav" class="def">MonadTrav</a> m <span class="keyword">where</span> <a href="src/Language-C-Analysis-TravMonad.html#MonadTrav" class="link">Source</a> <a href="#t:MonadTrav" class="selflink">#</a></p><div class="doc"><p>Traversal monad</p></div><div class="subs minimal"><p class="caption">Minimal complete definition</p><p class="src"><a href="Language-C-Analysis-TravMonad.html#v:handleDecl">handleDecl</a></p></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a id="v:handleDecl" class="def">handleDecl</a> :: <a href="Language-C-Analysis-SemRep.html#t:DeclEvent">DeclEvent</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleDecl" class="link">Source</a> <a href="#v:handleDecl" class="selflink">#</a></p><div class="doc"><p>handling declarations and definitions</p></div></div><div class="subs instances"><p id="control.i:MonadTrav" class="caption collapser" onclick="toggleSection('i:MonadTrav')">Instances</p><div id="section.i:MonadTrav" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:ic:MonadTrav:MonadTrav:1" class="instance expander" onclick="toggleSection('i:ic:MonadTrav:MonadTrav:1')"></span> <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-449" class="link">Source</a> <a href="#t:MonadTrav" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:ic:MonadTrav:MonadTrav:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:handleDecl">handleDecl</a> :: <a href="Language-C-Analysis-SemRep.html#t:DeclEvent">DeclEvent</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s () <a href="src/Language-C-Analysis-TravMonad.html#handleDecl" class="link">Source</a> <a href="#v:handleDecl" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><h1 id="g:5">Handling declarations</h1><div class="top"><p class="src"><a id="v:handleTagDecl" class="def">handleTagDecl</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Analysis-DefTable.html#t:TagFwdDecl">TagFwdDecl</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleTagDecl" class="link">Source</a> <a href="#v:handleTagDecl" class="selflink">#</a></p><div class="doc"><p>forward declaration of a tag. Only necessary for name analysis, but otherwise no semantic
 consequences.</p></div></div><div class="top"><p class="src"><a id="v:handleTagDef" class="def">handleTagDef</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Analysis-SemRep.html#t:TagDef">TagDef</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleTagDef" class="link">Source</a> <a href="#v:handleTagDef" class="selflink">#</a></p><div class="doc"><p>define the given composite type or enumeration
 If there is a declaration visible, overwrite it with the definition.
 Otherwise, enter a new definition in the current namespace.
 If there is already a definition present, yield an error (redeclaration).</p></div></div><div class="top"><p class="src"><a id="v:handleEnumeratorDef" class="def">handleEnumeratorDef</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Analysis-SemRep.html#t:Enumerator">Enumerator</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleEnumeratorDef" class="link">Source</a> <a href="#v:handleEnumeratorDef" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:handleTypeDef" class="def">handleTypeDef</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Analysis-SemRep.html#t:TypeDef">TypeDef</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleTypeDef" class="link">Source</a> <a href="#v:handleTypeDef" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:handleObjectDef" class="def">handleObjectDef</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; <a href="Language-C-Analysis-SemRep.html#t:ObjDef">ObjDef</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleObjectDef" class="link">Source</a> <a href="#v:handleObjectDef" class="selflink">#</a></p><div class="doc"><p>handle object defintions (maybe tentative)</p></div></div><div class="top"><p class="src"><a id="v:handleFunDef" class="def">handleFunDef</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; <a href="Language-C-Analysis-SemRep.html#t:FunDef">FunDef</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleFunDef" class="link">Source</a> <a href="#v:handleFunDef" class="selflink">#</a></p><div class="doc"><p>handle function definitions</p></div></div><div class="top"><p class="src"><a id="v:handleVarDecl" class="def">handleVarDecl</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> -&gt; <a href="Language-C-Analysis-SemRep.html#t:Decl">Decl</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleVarDecl" class="link">Source</a> <a href="#v:handleVarDecl" class="selflink">#</a></p><div class="doc"><p>handle variable declarations (external object declarations and function prototypes)
 variable declarations are either function prototypes, or external declarations, and not very
 interesting on their own. we only put them in the symbol table and call the handle.
 declarations never override definitions</p></div></div><div class="top"><p class="src"><a id="v:handleParamDecl" class="def">handleParamDecl</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Analysis-SemRep.html#t:ParamDecl">ParamDecl</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleParamDecl" class="link">Source</a> <a href="#v:handleParamDecl" class="selflink">#</a></p><div class="doc"><p>handle parameter declaration. The interesting part is that parameters can be abstract
 (if they are part of a type). If they have a name, we enter the name (usually in function prototype or function scope),
 checking if there are duplicate definitions.
 FIXME: I think it would be more transparent to handle parameter declarations in a special way</p></div></div><div class="top"><p class="src"><a id="v:handleAsmBlock" class="def">handleAsmBlock</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> m =&gt; <a href="Language-C-Analysis-SemRep.html#t:AsmBlock">AsmBlock</a> -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#handleAsmBlock" class="link">Source</a> <a href="#v:handleAsmBlock" class="selflink">#</a></p></div><h1 id="g:6">Symbol table scope modification</h1><div class="top"><p class="src"><a id="v:enterPrototypeScope" class="def">enterPrototypeScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#enterPrototypeScope" class="link">Source</a> <a href="#v:enterPrototypeScope" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:leavePrototypeScope" class="def">leavePrototypeScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#leavePrototypeScope" class="link">Source</a> <a href="#v:leavePrototypeScope" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:enterFunctionScope" class="def">enterFunctionScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#enterFunctionScope" class="link">Source</a> <a href="#v:enterFunctionScope" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:leaveFunctionScope" class="def">leaveFunctionScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#leaveFunctionScope" class="link">Source</a> <a href="#v:leaveFunctionScope" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:enterBlockScope" class="def">enterBlockScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#enterBlockScope" class="link">Source</a> <a href="#v:enterBlockScope" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:leaveBlockScope" class="def">leaveBlockScope</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m =&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#leaveBlockScope" class="link">Source</a> <a href="#v:leaveBlockScope" class="selflink">#</a></p></div><h1 id="g:7">Symbol table lookup (delegate)</h1><div class="top"><p class="src"><a id="v:lookupTypeDef" class="def">lookupTypeDef</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; m <a href="Language-C-Analysis-SemRep.html#t:Type">Type</a> <a href="src/Language-C-Analysis-TravMonad.html#lookupTypeDef" class="link">Source</a> <a href="#v:lookupTypeDef" class="selflink">#</a></p><div class="doc"><p>lookup a type definition
 the 'wrong kind of object' is an internal error here,
 because the parser should distinguish typeDefs and other
 objects</p></div></div><div class="top"><p class="src"><a id="v:lookupObject" class="def">lookupObject</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Language-C-Analysis-SemRep.html#t:IdentDecl">IdentDecl</a>) <a href="src/Language-C-Analysis-TravMonad.html#lookupObject" class="link">Source</a> <a href="#v:lookupObject" class="selflink">#</a></p><div class="doc"><p>lookup an object, function or enumerator</p></div></div><h1 id="g:8">Symbol table modification</h1><div class="top"><p class="src"><a id="v:createSUERef" class="def">createSUERef</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> m) =&gt; <a href="Language-C-Data-Node.html#t:NodeInfo">NodeInfo</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Language-C-Data-Ident.html#t:Ident">Ident</a> -&gt; m <a href="Language-C-Data-Ident.html#t:SUERef">SUERef</a> <a href="src/Language-C-Analysis-TravMonad.html#createSUERef" class="link">Source</a> <a href="#v:createSUERef" class="selflink">#</a></p><div class="doc"><p>create a reference to a struct/union/enum</p><p>This currently depends on the fact the structs are tagged with unique names.
 We could use the name generation of TravMonad as well, which might be the better
 choice when dealing with autogenerated code.</p></div></div><h1 id="g:9">Additional error handling facilities</h1><div class="top"><p class="src"><a id="v:hadHardErrors" class="def">hadHardErrors</a> :: [<a href="Language-C-Data-Error.html#t:CError">CError</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Language-C-Analysis-TravMonad.html#hadHardErrors" class="link">Source</a> <a href="#v:hadHardErrors" class="selflink">#</a></p><div class="doc"><p>check wheter non-recoverable errors occurred</p></div></div><div class="top"><p class="src"><a id="v:handleTravError" class="def">handleTravError</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m =&gt; m a -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Language-C-Analysis-TravMonad.html#handleTravError" class="link">Source</a> <a href="#v:handleTravError" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:throwOnLeft" class="def">throwOnLeft</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m, <a href="Language-C-Data-Error.html#t:Error">Error</a> e) =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> e a -&gt; m a <a href="src/Language-C-Analysis-TravMonad.html#throwOnLeft" class="link">Source</a> <a href="#v:throwOnLeft" class="selflink">#</a></p><div class="doc"><p>raise an error based on an Either argument</p></div></div><div class="top"><p class="src"><a id="v:astError" class="def">astError</a> :: <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m =&gt; <a href="Language-C-Data-Node.html#t:NodeInfo">NodeInfo</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -&gt; m a <a href="src/Language-C-Analysis-TravMonad.html#astError" class="link">Source</a> <a href="#v:astError" class="selflink">#</a></p><div class="doc"><p>raise an error caused by a malformed AST</p></div></div><div class="top"><p class="src"><a id="v:warn" class="def">warn</a> :: (<a href="Language-C-Data-Error.html#t:Error">Error</a> e, <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> m) =&gt; e -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#warn" class="link">Source</a> <a href="#v:warn" class="selflink">#</a></p></div><h1 id="g:10">Trav - default MonadTrav implementation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:Trav" class="def">Trav</a> s a <a href="src/Language-C-Analysis-TravMonad.html#Trav" class="link">Source</a> <a href="#t:Trav" class="selflink">#</a></p><div class="doc"><p>simple traversal monad, providing user state and callbacks</p></div><div class="subs instances"><p id="control.i:Trav" class="caption collapser" onclick="toggleSection('i:Trav')">Instances</p><div id="section.i:Trav" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Trav:Monad:1" class="instance expander" onclick="toggleSection('i:id:Trav:Monad:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-421" class="link">Source</a> <a href="#t:Trav" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Trav:Monad:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-62--62--61-">(&gt;&gt;=)</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; (a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b <a href="#v:-62--62--61-" class="selflink">#</a></p><p class="src"><a href="#v:-62--62-">(&gt;&gt;)</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b <a href="#v:-62--62-" class="selflink">#</a></p><p class="src"><a href="#v:return">return</a> :: a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="#v:return" class="selflink">#</a></p><p class="src"><a href="#v:fail">fail</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="#v:fail" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Trav:Functor:2" class="instance expander" onclick="toggleSection('i:id:Trav:Functor:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Functor.html#t:Functor">Functor</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-414" class="link">Source</a> <a href="#t:Trav" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Trav:Functor:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:fmap">fmap</a> :: (a -&gt; b) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b <a href="#v:fmap" class="selflink">#</a></p><p class="src"><a href="#v:-60--36-">(&lt;$)</a> :: a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="#v:-60--36-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Trav:Applicative:3" class="instance expander" onclick="toggleSection('i:id:Trav:Applicative:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-417" class="link">Source</a> <a href="#t:Trav" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Trav:Applicative:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:pure">pure</a> :: a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="#v:pure" class="selflink">#</a></p><p class="src"><a href="#v:-60--42--62-">(&lt;*&gt;)</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s (a -&gt; b) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b <a href="#v:-60--42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-42--62-">(*&gt;)</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b <a href="#v:-42--62-" class="selflink">#</a></p><p class="src"><a href="#v:-60--42-">(&lt;*)</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s b -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="#v:-60--42-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Trav:MonadTrav:4" class="instance expander" onclick="toggleSection('i:id:Trav:MonadTrav:4')"></span> <a href="Language-C-Analysis-TravMonad.html#t:MonadTrav">MonadTrav</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-449" class="link">Source</a> <a href="#t:Trav" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Trav:MonadTrav:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:handleDecl">handleDecl</a> :: <a href="Language-C-Analysis-SemRep.html#t:DeclEvent">DeclEvent</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s () <a href="src/Language-C-Analysis-TravMonad.html#handleDecl" class="link">Source</a> <a href="#v:handleDecl" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Trav:MonadCError:5" class="instance expander" onclick="toggleSection('i:id:Trav:MonadCError:5')"></span> <a href="Language-C-Analysis-TravMonad.html#t:MonadCError">MonadCError</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-440" class="link">Source</a> <a href="#t:Trav" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Trav:MonadCError:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:throwTravError">throwTravError</a> :: <a href="Language-C-Data-Error.html#t:Error">Error</a> e =&gt; e -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="src/Language-C-Analysis-TravMonad.html#throwTravError" class="link">Source</a> <a href="#v:throwTravError" class="selflink">#</a></p><p class="src"><a href="#v:catchTravError">catchTravError</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; (<a href="Language-C-Data-Error.html#t:CError">CError</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="src/Language-C-Analysis-TravMonad.html#catchTravError" class="link">Source</a> <a href="#v:catchTravError" class="selflink">#</a></p><p class="src"><a href="#v:recordError">recordError</a> :: <a href="Language-C-Data-Error.html#t:Error">Error</a> e =&gt; e -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s () <a href="src/Language-C-Analysis-TravMonad.html#recordError" class="link">Source</a> <a href="#v:recordError" class="selflink">#</a></p><p class="src"><a href="#v:getErrors">getErrors</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s [<a href="Language-C-Data-Error.html#t:CError">CError</a>] <a href="src/Language-C-Analysis-TravMonad.html#getErrors" class="link">Source</a> <a href="#v:getErrors" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Trav:MonadSymtab:6" class="instance expander" onclick="toggleSection('i:id:Trav:MonadSymtab:6')"></span> <a href="Language-C-Analysis-TravMonad.html#t:MonadSymtab">MonadSymtab</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-431" class="link">Source</a> <a href="#t:Trav" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Trav:MonadSymtab:6" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:getDefTable">getDefTable</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s <a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a> <a href="src/Language-C-Analysis-TravMonad.html#getDefTable" class="link">Source</a> <a href="#v:getDefTable" class="selflink">#</a></p><p class="src"><a href="#v:withDefTable">withDefTable</a> :: (<a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a> -&gt; (a, <a href="Language-C-Analysis-DefTable.html#t:DefTable">DefTable</a>)) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="src/Language-C-Analysis-TravMonad.html#withDefTable" class="link">Source</a> <a href="#v:withDefTable" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:Trav:MonadName:7" class="instance expander" onclick="toggleSection('i:id:Trav:MonadName:7')"></span> <a href="Language-C-Analysis-TravMonad.html#t:MonadName">MonadName</a> (<a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s)</span> <a href="src/Language-C-Analysis-TravMonad.html#line-427" class="link">Source</a> <a href="#t:Trav" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:Trav:MonadName:7" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:genName">genName</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s <a href="Language-C-Data-Name.html#t:Name">Name</a> <a href="src/Language-C-Analysis-TravMonad.html#genName" class="link">Source</a> <a href="#v:genName" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:runTrav" class="def">runTrav</a> :: <span class="keyword">forall</span> s a. s -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> [<a href="Language-C-Data-Error.html#t:CError">CError</a>] (a, <a href="Language-C-Analysis-TravMonad.html#t:TravState">TravState</a> s) <a href="src/Language-C-Analysis-TravMonad.html#runTrav" class="link">Source</a> <a href="#v:runTrav" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:runTrav_" class="def">runTrav_</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> () a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> [<a href="Language-C-Data-Error.html#t:CError">CError</a>] (a, [<a href="Language-C-Data-Error.html#t:CError">CError</a>]) <a href="src/Language-C-Analysis-TravMonad.html#runTrav_" class="link">Source</a> <a href="#v:runTrav_" class="selflink">#</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:TravState" class="def">TravState</a> s <a href="src/Language-C-Analysis-TravMonad.html#TravState" class="link">Source</a> <a href="#t:TravState" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:initTravState" class="def">initTravState</a> :: s -&gt; <a href="Language-C-Analysis-TravMonad.html#t:TravState">TravState</a> s <a href="src/Language-C-Analysis-TravMonad.html#initTravState" class="link">Source</a> <a href="#v:initTravState" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:withExtDeclHandler" class="def">withExtDeclHandler</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a -&gt; (<a href="Language-C-Analysis-SemRep.html#t:DeclEvent">DeclEvent</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s ()) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s a <a href="src/Language-C-Analysis-TravMonad.html#withExtDeclHandler" class="link">Source</a> <a href="#v:withExtDeclHandler" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:modifyUserState" class="def">modifyUserState</a> :: (s -&gt; s) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s () <a href="src/Language-C-Analysis-TravMonad.html#modifyUserState" class="link">Source</a> <a href="#v:modifyUserState" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:userState" class="def">userState</a> :: <a href="Language-C-Analysis-TravMonad.html#t:TravState">TravState</a> s -&gt; s <a href="src/Language-C-Analysis-TravMonad.html#userState" class="link">Source</a> <a href="#v:userState" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:getUserState" class="def">getUserState</a> :: <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s s <a href="src/Language-C-Analysis-TravMonad.html#getUserState" class="link">Source</a> <a href="#v:getUserState" class="selflink">#</a></p></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:TravOptions" class="def">TravOptions</a> <a href="src/Language-C-Analysis-TravMonad.html#TravOptions" class="link">Source</a> <a href="#t:TravOptions" class="selflink">#</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:TravOptions" class="def">TravOptions</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><ul><li><dfn class="src"><a id="v:language" class="def">language</a> :: <a href="Language-C-Analysis-TravMonad.html#t:CLanguage">CLanguage</a></dfn><div class="doc empty">&nbsp;</div></li></ul></div></td></tr></table></div></div><div class="top"><p class="src"><a id="v:modifyOptions" class="def">modifyOptions</a> :: (<a href="Language-C-Analysis-TravMonad.html#t:TravOptions">TravOptions</a> -&gt; <a href="Language-C-Analysis-TravMonad.html#t:TravOptions">TravOptions</a>) -&gt; <a href="Language-C-Analysis-TravMonad.html#t:Trav">Trav</a> s () <a href="src/Language-C-Analysis-TravMonad.html#modifyOptions" class="link">Source</a> <a href="#v:modifyOptions" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:travErrors" class="def">travErrors</a> :: <a href="Language-C-Analysis-TravMonad.html#t:TravState">TravState</a> s -&gt; [<a href="Language-C-Data-Error.html#t:CError">CError</a>] <a href="src/Language-C-Analysis-TravMonad.html#travErrors" class="link">Source</a> <a href="#v:travErrors" class="selflink">#</a></p></div><h1 id="g:11">Language options</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:CLanguage" class="def">CLanguage</a> <a href="src/Language-C-Analysis-TravMonad.html#CLanguage" class="link">Source</a> <a href="#t:CLanguage" class="selflink">#</a></p><div class="doc"><p>The variety of the C language to accept. Note: this is not yet enforced.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:C89" class="def">C89</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:C99" class="def">C99</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:GNU89" class="def">GNU89</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:GNU99" class="def">GNU99</a></td><td class="doc empty">&nbsp;</td></tr></table></div></div><h1 id="g:12">Helpers</h1><div class="top"><p class="src"><a id="v:mapMaybeM" class="def">mapMaybeM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a -&gt; (a -&gt; m b) -&gt; m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> b) <a href="src/Language-C-Analysis-TravMonad.html#mapMaybeM" class="link">Source</a> <a href="#v:mapMaybeM" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:maybeM" class="def">maybeM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a -&gt; (a -&gt; m ()) -&gt; m () <a href="src/Language-C-Analysis-TravMonad.html#maybeM" class="link">Source</a> <a href="#v:maybeM" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:mapSndM" class="def">mapSndM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (b -&gt; m c) -&gt; (a, b) -&gt; m (a, c) <a href="src/Language-C-Analysis-TravMonad.html#mapSndM" class="link">Source</a> <a href="#v:mapSndM" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:concatMapM" class="def">concatMapM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; m [b]) -&gt; [a] -&gt; m [b] <a href="src/Language-C-Analysis-TravMonad.html#concatMapM" class="link">Source</a> <a href="#v:concatMapM" class="selflink">#</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>