<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thank guys,<br><br>Now what am I misunderstanding in the code below?<br><br>I would think that<br><br>*Main&gt; comb (Just 65) foo<br><br>and<br><br>*Main&gt; comb (lookup 'A' lst) foo<br><br>would return the same result<br><br>Just 'A'<br><br><br>Michael<br><br>===========Haskell code=============<br><br>import Data.Char<br><br>lst = [('A',65),('B',66),('C',67),('D',68)]<br><br>-- comb is a combinator for sequencing operations that return Maybe<br>comb :: Maybe a -&gt; (a -&gt; Maybe b) -&gt; Maybe b<br>comb Nothing&nbsp; _ = Nothing<br>comb (Just x) f = f x<br><br>foo :: Int -&gt; Maybe Char<br>foo n = Just (chr n) <br><br>================Ghci===========<br><br>[michael@localhost ~]$ ghci<br>GHCi, version 6.10.1: http://www.haskell.org/ghc/&nbsp; :? for help<br>Loading package ghc-prim ... linking ... done.<br>Loading package integer ... linking ...
 done.<br>Loading package base ... linking ... done.<br>Prelude&gt; :load test1<br>[1 of 1] Compiling Main&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( test1.hs, interpreted )<br>Ok, modules loaded: Main.<br>*Main&gt; comb (Just 65) foo<br>Just 'A'<br>*Main&gt; comb Nothing foo<br>Nothing<br>*Main&gt; lookup 'A' lst<br>Just 65<br>*Main&gt; (lookup 'A' lst)<br>Just 65<br>*Main&gt; comb (lookup 'A' lst) foo<br><br>&lt;interactive&gt;:1:22:<br>&nbsp;&nbsp;&nbsp; Couldn't match expected type `Integer' against inferred type `Int'<br>&nbsp;&nbsp;&nbsp; In the second argument of `comb', namely `foo'<br>&nbsp;&nbsp;&nbsp; In the expression: comb (lookup 'A' lst) foo<br>&nbsp;&nbsp;&nbsp; In the definition of `it': it = comb (lookup 'A' lst) foo<br>*Main&gt; <br><br>--- On <b>Tue, 4/28/09, Lennart Augustsson <i>&lt;lennart.augustsson@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255);
 margin-left: 5px; padding-left: 5px;"><br>From: Lennart Augustsson &lt;lennart.augustsson@gmail.com&gt;<br>Subject: Re: [Haskell-cafe] chr/ord?<br>To: "Tim Wawrzynczak" &lt;inforichland@gmail.com&gt;<br>Cc: "michael rice" &lt;nowgate@yahoo.com&gt;, "haskell-cafe@haskell.org" &lt;haskell-cafe@haskell.org&gt;<br>Date: Tuesday, April 28, 2009, 10:53 PM<br><br><div id="yiv1168158711"><div>You can also use the more general toEnum and fromEnum.&nbsp;<br><br>&nbsp;&nbsp; -- Lennart (iPhone)</div><div><br>On Apr 29, 2009, at 2:13, Tim Wawrzynczak &lt;<a rel="nofollow" ymailto="mailto:inforichland@gmail.com" target="_blank" href="/mc/compose?to=inforichland@gmail.com">inforichland@gmail.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>Michael, those functions are not in the Prelude, they're in Data.Char.<br><br><div class="gmail_quote">On Tue, Apr 28, 2009 at 8:08 PM, michael rice <span dir="ltr">&lt;<a rel="nofollow"
 ymailto="mailto:nowgate@yahoo.com" target="_blank" href="/mc/compose?to=nowgate@yahoo.com"></a><a rel="nofollow" ymailto="mailto:nowgate@yahoo.com" target="_blank" href="/mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
Hi,<br><br>My Prelude docs must be out of date because chr and ord don't seem to be there. How do I access these functions?<br><br>Michael<br><br>===============<br><br>[michael@localhost ~]$ ghci<br>GHCi, version 6.10.1: <a rel="nofollow" target="_blank" href="http://www.haskell.org/ghc/"></a><a rel="nofollow" target="_blank" href="http://www.haskell.org/ghc/">http://www.haskell.org/ghc/</a>&nbsp; :? for help<br>
Loading package ghc-prim ... linking ... done.<br>Loading package integer ... linking ... done.<br>Loading package base ... linking ... done.<br>Prelude&gt; chr 65<br><br>&lt;interactive&gt;:1:0: Not in scope: `chr'<br>
Prelude&gt; ord 'A'<br><br>&lt;interactive&gt;:1:0: Not in scope: `ord'<br>Prelude&gt; <br><br><br><br><br></td></tr></tbody></table><br>



      <br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a rel="nofollow" ymailto="mailto:Haskell-Cafe@haskell.org" target="_blank" href="/mc/compose?to=Haskell-Cafe@haskell.org"></a><a rel="nofollow" ymailto="mailto:Haskell-Cafe@haskell.org" target="_blank" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a rel="nofollow" target="_blank" href="http://www.haskell.org/mailman/listinfo/haskell-cafe"></a><a rel="nofollow" target="_blank" href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span><a rel="nofollow" ymailto="mailto:Haskell-Cafe@haskell.org" target="_blank" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a></span><br><span><a rel="nofollow" target="_blank" href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a></span><br></div></blockquote></div></blockquote></td></tr></table><br>