Haskell is a general-purpose, purely functional programming language incorporating many recent innovations in programming language design.
Haskell provides higher-order functions, non-strict semantics, static polymorphic typing, user-defined algebraic datatypes, pattern-matching, list comprehensions, a module system, a monadic I/O system, and a rich set of primitive data types, including lists, arrays, arbitrary and fixed precision integers, and floating-point numbers.
Haskell is both the culmination and solidification of many years of research on lazy functional languages.
Haskell is lazy, which means that unless specifically told otherwise, Haskell won't execute functions and calculate things until it's really forced to show you a result. That goes well with referential transparency and it allows you to think of programs as a series of transformations on data.
C, Java, Pascal, Ada, and so on, are all imperative languages. They are "imperative" in the sense that they consist of a sequence of commands, which are executed strictly one after the other. Haskell is a functional language. A functional program is a single expression, which is executed by evaluating the expression.
Another interesting feature of functional languages like Haskell: functions are treated as values like integers (numbers) and strings. You can add a function to another function the way you can add an integer to an integer, 1 + 1, or 35 + 53.
Haskell programs are a series of high-level generalizable functions that define what the program is intended to do, letting lower layers (compiler, runtime, and libraries) handle mundane low-level details such as iteration. Its foundation is a strong static type safety and inference system.
The compiler enforces the type check and produces clean, concise, and correct code with few side effects from the outset.
The Glasgow Haskell Compiler is a state-of-the-art, open-source compiler and interactive environment for the functional language Haskell.
The Glasgow Haskell Compiler (GHC) started as part of an academic research project funded by the UK government at the beginning of the 1990s.
Over its lifetime GHC has generally had around two or three active developers, although the number of people who have contributed some code to GHC is in the hundreds.
We can divide the compiler into three:
ghcicommand in the terminal, if you see output like the below one then your installation is successful.
It is a basic ritual kind of thing to write hello world in programming languages, so let's write hello world program in Haskell.
Prelude> "Hello, World!" "Hello, World!"
The Haskell system evaluated the string and printed the result. Or we can try a variation to print directly to standard output:
Prelude> putStrLn "Hello World" Hello World
Instead of running interactively, you can compile files to create an executable. The -o option lets you specify the name of the output file. The input file in this example is hello.hs, We can't just drop in a putStrLn call the way we would with something like Python. We have to define the main function.
When the program is run that will be the main entry point, just like all other languages. Here are the contents of hello.hs.
main = putStrLn "Hello, world!"
Compile it with
ghc -o hello hello.hs
Run the program
I am Pavankumar, Having 8.5 years of experience currently working in Video/Live Analytics project.