Hello, World Program is a basic Simple First program or application to code and learn any new programming language.

It just displays the hello world string to the console.

This post shows how to write a Hello World application in Haskell Programming language.

Haskell Hello World Example

Open the editor of your choice.

  • Create a text file name called helloworld.ml
  • add the below line of code
-- hello world program
module Main where
main = putStrLn "Hello, World!"

main is the main function entry point to the Haskell program, It is defined in the module. putStrLn is a function that prints the string to the console

-- hello world program are single comments, ignored by the Haskell compiler.

Ho to run Haskell program using command line

  • Go to terminal,
  • Make sure that the ghc command is working. ghc is a Haskell compiler.
ghc helloworld.hs

[1 of 1] Compiling Main ( helloworld.hs, helloworld.o ) Linking helloworld …