This repository serves as a comprehensive guide to several fundamental concepts in Haskell. Each project within this repository elucidates a specific topic in Haskell, providing a succinct and practical implementation to aid understanding.
The 'Logging' project demonstrates basic IO operations in Haskell. The code simply prints "Hello, Haskell!" to the console.
The 'Functions' project is an introduction to defining and using functions in Haskell. It includes examples of a function to add two numbers together, and a function to concatenate two strings.
The 'Typeclasses' project covers the basics of typeclasses in Haskell. It includes a custom typeclass called 'Showable' and instances of 'Showable' for the Int
and Bool
types. The project also includes a function that prints the 'showValue' of a 'Showable' type.
The 'Pattern Matching' project demonstrates the use of pattern matching in function definitions. It provides examples for checking if a number is positive, negative, or zero, calculating the factorial of a non-negative integer, and concatenating two lists.
The 'List Manipulation' project provides examples of how to manipulate lists in Haskell. This includes doubling each element in a list, filtering even numbers from a list, summing all elements in a list, and generating a list of numbers within a given range.
The 'Monads and IO' project is an introduction to monads and IO operations in Haskell. It includes a function that asks for the user's name and greets them, and another function that performs an IO operation.
The 'Modules and Packages' project shows how to define and import custom modules in Haskell. It includes a module called 'MyModule' that contains a function to greet a user.
The 'Error Handling' project demonstrates error handling in Haskell. It includes a function that divides two numbers and handles the case of division by zero, as well as a function that handles the result of the division operation, printing an error message if one occurred, or the result if it was successful.