<div dir="ltr"><div><div><div><div>Hi Victor,<br></div>It is frustrating that posting plain text is contorted (via <a href="http://nabble.com">nabble.com</a> and then again in my <a href="http://mail.google.com">mail.google.com</a> account) - please see the attachment. <br>I really have sent the right indentation copping the Hutton's script.<br></div>Is it so difficult for you guys to replicate this obvious failure of GHC on "do notation" with white space?<br></div>Regards,<br></div>Sylvester<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 15, 2018 at 6:27 PM, Viktor Dukhovni <span dir="ltr"><<a href="mailto:ietf-dane@dukhovni.org" target="_blank">ietf-dane@dukhovni.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
> On May 15, 2018, at 12:13 PM, Sylvester via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>> wrote:<br>
> <br>
> strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell<br>
> Platform 8.2.2<br>
> strlen :: IO ()<br>
> strlen = do putStr "Enter a string: " <br>
> xs <- getLine <br>
> putStr "The string has " <br>
> putStr (show (length xs)) <br>
> putStr " characters" <br>
> ==============================<wbr>=====================<br>
<br>
</span>The above indentation looks wrong. Try:<br>
<br>
----------<br>
$ cat foo.hs<br>
<span class="">strlen :: IO ()<br>
strlen = do putStr "Enter a string: " <br>
xs <- getLine <br>
putStr "The string has " <br>
putStr (show (length xs)) <br>
</span> putStrLn " characters"<br>
<br>
$ ghci foo.hs <br>
GHCi, version 8.0.2: <a href="http://www.haskell.org/ghc/" rel="noreferrer" target="_blank">http://www.haskell.org/ghc/</a> :? for help<br>
[1 of 1] Compiling Main ( foo.hs, interpreted )<br>
Ok, modules loaded: Main.<br>
Loaded GHCi configuration from /tmp/haskell-stack-ghci/<wbr>05485125/ghci-script<br>
*Main> strlen<br>
Enter a string: foo<br>
The string has 3 characters<br>
*Main><br>
---------- <br>
<br>
If I incorrectly indent the subsequent lines:<br>
<span class=""><br>
strlen :: IO ()<br>
strlen = do putStr "Enter a string: " <br>
xs <- getLine <br>
putStr "The string has " <br>
putStr (show (length xs)) <br>
</span> putStrLn " characters"<br>
<br>
<br>
Then I see an error:<br>
<br>
foo.hs:2:13: error:<br>
<span class="im HOEnZb"> Parse error in pattern: putStr<br>
Possibly caused by a missing 'do'?<br>
<br>
</span><span class="HOEnZb"><font color="#888888">-- <br>
Viktor.<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</div></div></blockquote></div><br></div>