[Haskell-cafe] GHC TV station?
Sylvester
sylvester.hazel at googlemail.com
Tue May 15 16:13:54 UTC 2018
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"
===================================================
GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( C:\strlen.WhiteSpaced.hs, interpreted
)
C:\strlen.WhiteSpaced.hs:2:14: error:
Parse error in pattern: putStr
Possibly caused by a missing 'do'?
|
2 | strlen = do putStr "Enter a string: "
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^...
Failed, no modules loaded.
Prelude>
==================================================
strlen :: IO ()
strlen = do {putStr "Enter a string: ";
xs <- getLine;
putStr "The string has ";
putStr (show (length xs));
putStr " characters"}
=================================================
GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( C:\strlen.Bracesed.hs, interpreted )
Ok, one module loaded.
*Main>
--
Sent from: http://haskell.1045720.n5.nabble.com/Haskell-Haskell-Cafe-f3074699.html
More information about the Haskell-Cafe
mailing list