- Create a new project data-types using Stack new data types. Change into the directory data-types and build the new project using stack build.
In the command prompt, run stack ghci. You will see the prompt. Enter this =:type (5 :: Int) =: command:
*Main Lib> :type (5 :: Int) (5 :: Int) :: Int
:type is a GHCi command to show the type of the expression. In this case, the expression is 5. It means that the expression (5 :: Int) is Int. Now, enter this :type 5 command:
*Main Lib> :type 5 5 :: Num t => t
- GHCi will interpret 5 as 5 :: Num t => t, which means that Haskell identified 5 as some numerical type t. Num t => t shows that the type is t and that it has an extra qualification, Num. Num t denotes that t is an instance of ...