Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

help with haskell

Name: Anonymous 2007-12-10 20:39

import qualified Data.ByteString as BS
import System.IO
message :: [Char]
message = ('H':'e':'l':'l':'o':',':' ':[])
           ++
              ('w':'o':'r':'l':'d':'!':[])
putHelloWorld :: [Char] -> IO()
putHelloWorld (x:xs) =
                  Prelude.putChar(x) >> putHelloWorld xs
putHelloWorld [] = Prelude.putChar('\n')
main :: IO ()
main =
  hSetBuffering stdout NoBuffering >> hSetBuffering stdin LineBuffering
    >> putHelloWorld(message)

can I short the code somehow?
thanks in advance

Name: Anonymous 2007-12-10 20:46

Yes. HTH

Name: Anonymous 2007-12-10 21:52

>>1
Use monads.

Name: Anonymous 2009-03-18 2:42

Don't call me gay, but I need some mary jay!

Marijuana MUST be legalized.

Name: Anonymous 2011-02-03 1:00

Don't change these.
Name: Email:
Entire Thread Thread List