[Haskell-cafe] GHC TV station?
Matt
parsonsmatt at gmail.com
Tue May 15 17:13:46 UTC 2018
Could you link to a GitHub gist or lambdapaste or similar? I don't see a
plaintext attachment.
Matt Parsons
On Tue, May 15, 2018 at 11:01 AM, Sylvester Hazel via Haskell-Cafe <
haskell-cafe at haskell.org> wrote:
> 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/054851
>> 25/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.
>>
>
>
> _______________________________________________
> 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/f2d2657c/attachment.html>
More information about the Haskell-Cafe
mailing list