[Haskell-cafe] GHC TV station?

Sylvester Hazel sylvester.hazel at googlemail.com
Tue May 15 17:01:50 UTC 2018


Hi Victor,
It is frustrating that posting plain text is contorted (via nabble.com and
then again in my mail.google.com account) - please see the attachment.
I really have sent the right indentation copping the Hutton's script.
Is it so difficult for you guys to replicate this obvious failure of GHC on
"do notation" with white space?
Regards,
Sylvester

On Tue, May 15, 2018 at 6:27 PM, Viktor Dukhovni <ietf-dane at dukhovni.org>
wrote:

>
>
> > On May 15, 2018, at 12:13 PM, Sylvester via Haskell-Cafe <
> haskell-cafe at haskell.org> wrote:
> >
> > strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell
> > Platform 8.2.2
> > strlen :: IO ()
> > strlen = do  putStr "Enter a string: "
> >                   xs <-  getLine
> >                   putStr "The string has "
> >                   putStr (show (length xs))
> >                   putStr " characters"
> > ===================================================
>
> The above indentation looks wrong.  Try:
>
> ----------
> $ cat foo.hs
> strlen :: IO ()
> strlen = do putStr "Enter a string: "
>             xs <-  getLine
>             putStr "The string has "
>             putStr (show (length xs))
>             putStrLn " characters"
>
> $ ghci foo.hs
> GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
> [1 of 1] Compiling Main             ( foo.hs, interpreted )
> Ok, modules loaded: Main.
> Loaded GHCi configuration from /tmp/haskell-stack-ghci/
> 05485125/ghci-script
> *Main> strlen
> Enter a string: foo
> The string has 3 characters
> *Main>
> ----------
>
> If I incorrectly indent the subsequent lines:
>
> strlen :: IO ()
> strlen = do putStr "Enter a string: "
>               xs <-  getLine
>               putStr "The string has "
>               putStr (show (length xs))
>               putStrLn " characters"
>
>
> Then I see an error:
>
> foo.hs:2:13: error:
>     Parse error in pattern: putStr
>     Possibly caused by a missing 'do'?
>
> --
>         Viktor.
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180515/efda2898/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrong is HTML.jpg
Type: image/jpeg
Size: 278883 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180515/efda2898/attachment-0001.jpg>


More information about the Haskell-Cafe mailing list