[haskell] haskell helloworld

安装(Glasgow Haskell Compiler)

sudo apt-get install ghc

进入shell

ghci      

hello.hs

module Main where
import System.Environment
 
main :: IO ()
main = do
    args <- getArgs
    putStrLn ("Hello, " ++ args !! 0)

compiler & exec

$ ghc -o hello --make hello.hs 
[1 of 1] Compiling Main             ( hello.hs, hello.o )
Linking hello ...
$ ./hello  haskell
hello, haskell

 

 

原文地址:https://www.cnblogs.com/bluefrog/p/2533117.html