summaryrefslogtreecommitdiff
path: root/docs/users_guide/exts/num_decimals.rst
blob: d606599f74d03b438440de7159aa6879fa9c9cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
.. _num-decimals:
 
Fractional looking integer literals
-----------------------------------
 
.. extension:: NumDecimals
    :shortdesc: Enable support for 'fractional' integer literals.
 
    :since: 7.8.1
 
    Allow the use of floating-point literal syntax for integral types.
 
Haskell 2010 and Haskell 98 define floating literals with the syntax
``1.2e6``. These literals have the type ``Fractional a => a``.
 
The language extension :extension:`NumDecimals` allows you to also use the
floating literal syntax for instances of ``Integral``, and have values
like ``(1.2e6 :: Num a => a)``