- 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
Found 185 Articles for Haskell
217 Views
In Haskell, this program will help us in checking the current date against a specified birthday and prints a "Happy Birthday" message if it is a match otherwise, it will print “Not your birthday yet”. Haskell provides function to fetch the current date and also to specify a date. This program can be implemented by using various approaches including the use of toGregorian function, fromGregorian function or by using utctDay getCurrentTime. This program will only check the birthday once, when the program runs. If we want the program to check the birthday periodically or at a specific time, we ... Read More
1K+ Views
In Haskell, an enumeration (or "enum") is a type that has a finite set of values. The values are called constructors, and are usually defined using the data keyword. Here's an example of an enumeration type that represents the four seasons − data Season = Spring | Summer | Fall | Winter Enumerations are used to represent things like states, modes, or options that have a fixed set of possible values. Method 1: Iterate over enumeration type This method is used to directly iterate over the enumeration type in Haskell. Here, we define the list of all the enumeration ... Read More
343 Views
Haskell is a functional programming language and does not have a concept of inheritance. Instead, it uses type classes to achieve similar functionality. This tutorial will help us in implementing the same in Haskell. Method 1: Implement a type class that simulates multiple inheritances. This method uses type class to simulate the multiple inheritance. Here, we define two parent class and one child class. And the function of child class is being called. Once the function is being called it will take instance from both the parent class and the final output is displayed. Algorithm Step 1 − The ... Read More
165 Views
This tutorial will help us in initializing and printing a complex number. In Haskell, the Data.Complex library provides a Complex type to represent complex numbers. Method 1: Using Complex data type This method defines a Complex data type that holds the real and imaginary parts of a complex number, and an instance of the Show type class for Complex, which allows it to be printed using the putStrLn function. In the main function, it creates a complex number object with real part and imaginary part. Then it prints the complex number using the putStrLn function and the show function. Algorithm ... Read More
382 Views
This tutorial discusses writing a program to check whether the input number is a Palindrome number in the Haskell programming language. A number can be called as a palindrome when it results in the same number when the digits are reversed. For Example, the number 12321 is a palindrome, because after reversing the digits it results in the same number. In this tutorial we see, Program to check whether the input number is a palindrome using the string reverse function. Program to check whether the input number is a palindrome using the recursive function. Method 1: Checking Palindrome ... Read More
1K+ Views
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! ... Read More
749 Views
This tutorial discusses writing a program to check whether the input string is a palindrome in the Haskell programming language. A string is said to be a palindrome when it results in an exact string after reversing it. For example, the string “level” is a palindrome because it results in an exact string even after reversing it. In this tutorial we see, Program to check whether the string is a palindrome using a built-in function reverse. Program to check whether the string is a palindrome using a recursive function. Method 1: Checking The String Is A Palindrome Using ... Read More
664 Views
This tutorial discusses writing a program to find the factorial of a positive number in the Haskell programming language. In this tutorial, we see Program to find the factorial of a positive number using a recursive function. Program to find the factorial of a positive number using an inbuilt function product. Algorithm Steps Take input or initialize a variable to store a positive integer. Implement program logic to find the factorial of a number. Print the resulting factorial. Method: Find The Factorial Of A Positive Number Using A Recursive Function Example Program to find the factorial ... Read More
571 Views
This tutorial discusses writing a program to convert a decimal number into a binary number in the Haskell programming language. Haskell is a Declarative, Strongly Typed, and Functional programming Language. The computations in Haskell are mathematical functions. In a Decimal number system, each number is denoted with numbers ranging from 0-9. This number system is also called as base 10 number system. For example, The number four hundred and ninety-one is represented as 491(4*10^2 + 9*10^1 + 1*10^0). In a Binary number system, each number is represented as numbers ranging from 0-1. This number system is also called as base ... Read More
2K+ Views
This tutorial discusses writing a program to display Fibonacci Series in the Haskell programming language. The Fibonacci series is a sequence in which each number is the sum of the preceding two terms. The Fibonacci series up to five terms is 0 1 1 2 3. In this tutorial we see, Program to print nth fibonacci number. Program to print the first ‘n’ terms in the Fibonacci series. Program to print the first ‘n’ terms in the Fibonacci series using the list comprehension. Program to print the first ‘n’ terms in the Fibonacci series using the map function. ... Read More
To Continue Learning Please Login
Login with Google