
Look at the following example where we will use different Boolean operations using some Boolean inputs such as "True" or "False". Booleanīoolean data type is also pretty much straightforward like other data type. Once we start our actual practice, we will be habituated with all the data type and its use. Let us move to the other data type and its syntax. See how the entire string has been decoded as an array of Char only. It will produce the following output on screen − Take a look at the following example where we are passing the string “”. There is no specific syntax for using string, but Haskell follows the conventional style of representing a string with double quotation. StringĪ string is nothing but a collection of characters. Look how your input gets decoded into ASCII format. Let us take a look at the following example to understand more − Haskell follows conventional ASCII encoding style. Haskell is a type of language where everything is represented using a number.

Take a look at the following example where we are passing some invalid input as a char which in turn leads to an error.īy the error message ":4:1: Not in scope: `a'" the Haskell compiler is warning us that it is not able to recognize your input. We will learn more about this type in the upcoming chapters. In the above example, (:t) is to include the specific type related to the inputs. Remember you use (: t) while supplying the input. Let us provide following line as input and check its output. Go to your Haskell command prompt and type any character with double or single quotation. Like numbers, Haskell can intelligently identify a character given in as an input to it. The above expression yields "0" as per the expected output.

Now, let us try a little more complex mathematical calculation and see whether our intelligent compiler give us the correct output or not. In the above code, we just passed two numbers as arguments to the GHCI compiler without predefining their type, but compiler could easily decode these two entries as numbers. You will receive the following output as a result.

As per example go to your prelude command prompt and just run "2+2" and hit enter. Therefore, you need not mention its type externally as we usually do in case of other programing languages. Haskell is intelligent enough to decode some number as a number. Throughout this tutorial, we will use the Haskell online platform available on our website ( ). In this chapter, we will learn about basic data models of Haskell which are actually predefined or somehow intelligently decoded into the computer memory. Haskell is a purely functional programing language, hence it is much more interactive and intelligent than other programming languages.
