'x'
main is always the entry point of a Haskell program=)main equals to function print with 'x' as the first parameterprint is a function that will only be evaluated when its evaluation is demanded. Hence, the function print not a command.main has type IO ()main equals to print 'x' print, is a function that is imported from a default packagexPreludemain, print, and 'x' are functionsmain has no parameter but has type IO ()print has one parameter and has type Show a ⇒ a → IO ()'x' has no parameter, and has type CharIO is a parametric type declared as data IO a() is the unit typeIO () is the data type IO with type parameter ()IO () is just a type signature with the resulting type IO (), and no parameters
→ separates parameter from other parameter, and separates from the result type that is on the right hand sideIO ()IO (), no parameterString → IO ()IO (), type of parameter: StringStringStringInt → Char → StringString, type of first parameter: Int, type of second parameter: String"aaaaa"
main = print 'x' is called a bindingprint 'x' to function mainmain evaluates it evaluates print with parameter 'x' sResult = fun 5 'a' is just another bindingfun 5 'a' to function sResultsResult evaluates it evaluates fun with parameter 5 and 'a' Prelude includes standard modules (e.g. module System.IO)