Thursday 12 May 2016

Haskell : unit : Return nothing from IO action

Haskell provides (), which is pronounced as unit. You can return () from an I/O action if you don't want to return anything.



main = do
    putStrLn "Hello "
    let a = 10
    let b = a + 10
    return ()


processInfo :: IO ()
processInfo = do
        putStrLn "Hello Haskell"  
        return ()





Previous                                                 Next                                                 Home

No comments:

Post a Comment