Premier programme : afficher du texte sur le terminal

Afficher le fameux 'hello world' sur le terminal

Créer le programme hello.hs

-- La fonction `main` est le point d'entrée du programme.
main :: IO ()
main = do
-- `putStrLn` est une fonction qui affiche une chaîne de caractères suivie d'un caractère de nouvelle ligne.
putStrLn 'hello world'

Compiler

ghc hello.hs

Exécuter

./hello


↑ Haut de page