<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Not sure what's going on here. Doesn't like line 5, the type statement. And what's with the semicolons in that line and in function main?<br><br>Michael<br><br>=========<br><br>From: http://www.haskell.org/ghc/docs/6.10.3/html/libraries/mtl/Control-Monad-Reader.html<br><br>import Control.Monad.Reader<br>import qualified Data.Map as Map<br>import Data.Maybe<br><br>type Bindings = Map String Int;<br><br>-- Returns True if the "count" variable contains correct bindings size.<br>isCountCorrect :: Bindings -&gt; Bool<br>isCountCorrect bindings = runReader calc_isCountCorrect bindings<br><br>-- The Reader monad, which implements this complicated check.<br>calc_isCountCorrect :: Reader Bindings Bool<br>calc_isCountCorrect = do<br>&nbsp;&nbsp;&nbsp; count &lt;- asks (lookupVar "count")<br>&nbsp;&nbsp;&nbsp; bindings &lt;- ask<br>&nbsp;&nbsp;&nbsp; return (count ==
 (Map.size bindings))<br><br>-- The selector function to&nbsp; use with 'asks'.<br>-- Returns value of the variable with specified name.<br>lookupVar :: String -&gt; Bindings -&gt; Int<br>lookupVar name bindings = fromJust (Map.lookup name bindings)<br><br>sampleBindings = Map.fromList [("count",3), ("1",1), ("b",2)]<br><br>main = do<br>&nbsp;&nbsp;&nbsp; putStr $ "Count is correct for bindings " ++ (show sampleBindings) ++ ": ";<br>&nbsp;&nbsp;&nbsp; putStrLn $ show (isCountCorrect sampleBindings);<br><br>==========<br><br>Prelude&gt; :l monad5<br>[1 of 1] Compiling Main&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( monad5.hs, interpreted )<br><br>monad5.hs:5:16: Not in scope: type constructor or class `Map'<br>Failed, modules loaded: none.<br><br></td></tr></table><br>