- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Haskell Program to print Hello World!
This tutorial will discuss writing a program to print Hello World! in Haskell Programming Language. The Computations in Haskell are done using mathematical functions. In this tutorial, We will discuss different ways to print Hello World! in Haskell.
Program to print Hello World! Using the “print” function.
Program to print Hello World! Using the “putStr” function.
Program to print Hello World! Using the “putStrLn” function.
Example
Program to print Hello World! Using the “print” function
main :: IO() main = do -- printing using the function print print ("Hello World!")
Output
Hello World!
In the above program, we printed the string “Hello World!” using the function print. Which takes a value(any datatype) as an argument and outputs it to the display console. The function print adds a new line (“
”) character at the end of the output.
Example
Program to print Hello World! Using the “putStr” function
main :: IO() main = do -- printing using the function putStr putStr ("Hello World!")
Output
Hello World!
In the above program, we printed the string “Hello World!” using the function putStr. Which takes a String as an argument and outputs it to the display console. The putStr function print doesn’t add a new line (“
”) character at the end of the output.
Example
Program to print Hello World! Using the “putStrLn” function
main :: IO() main = do -- printing using the function putStrLn putStrLn ("Hello World!")
Output
Hello World!
In the above program, we printed the string “Hello World!” using the function putStr. Which takes a String as an argument and outputs it to the display console. The putStr function print adds a new line (“
”) character at the end of the output.
Conclusion
In this tutorial, we discussed three different ways to implement a program to print Hello World in Haskell programming Language.
- Related Articles
- Python Program to Print Hello world
- Swift program to print Hello World!
- C Program to print “Hello World!” without using a semicolon
- How to print "Hello World!" using Python?
- C++ "Hello, World!" Program
- Print Hello World without semicolon in C++
- Hello World Program in Java
- Creating Java Hello World Program
- Hello World program in Kotlin
- Analysis of Java "Hello World" Program
- How to write "Hello, World!" program in JavaScript?
- How to write "Hello World" Program in C++?
- Internal Analysis of Java "Hello World" Program
- Print “Hello World” in C/C++ without using header files
- Print “Hello World” with empty or blank main in C++
