| Start |
|---|
Strings The type of the literalWithout any extensions, the type of a string literal – i.e., something between double quotes – is just a string, aka list of characters: However, when the This allows us to define values of string-like types without the need for any explicit conversions. In essence, the Using string literalsNotice how we were able to construct values of For more information on the |
Floating Numeral The type of the literalChoosing a concrete type with annotationsYou can specify the type with a type annotation. The only requirement is that the type must have a if not the compiler will complain |
Integer Numeral The type of the literalchoosing a concrete type with annotationsYou can specify the type as long as the target type is if not the compiler will complain Prelude> 1 :: String |
| List Literals GHC's OverloadedLists (opens new window) extension allows you to construct list-like data structures with the list literal syntax. This allows you to Data.Map (opens new window) like this: Instead of this (note the use of the extra M.fromList (opens new window)): RemarksInteger Literalsis a numeral without a decimal point for example is implicitly applied to Fractional Literalsis a numeral with a decimal point for example is implicitly applied to String LiteralsIf you add the language extension This is often used to replace List LiteralsLists can defined with the By default, the type of With |
Read Article
https://develop.horje.com/learn/1434/reference