✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
Haskell is a statically typed language, which means (among other things) that the compiler knows statically — before and without the need to execute a piece of source code — what its type is.
In the REPL, you can obtain this information with the special :t meta-instruction (instructions starting with a colon and a letter are typically instructions directed towards the REPL and only valid there).
For example, we can ask: what is the type of the literal True?
ghci> :t True
True :: Bool
The REPL responds that the expression . (In general, Haskell places types "after". This is similar to Python, Scala, TypeScript, and many other languages; but different than C and Java, in which types generally are placed "before", for example in the signature of functions.)True has type (::) Bool
A character literal is written within single quotes. What is the type of 'a'?
(Just answer with the type, not the full REPL output.)
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!