@@ -30,9 +30,9 @@ module Data.Number.Format
30
30
31
31
import Prelude
32
32
33
- foreign import toPrecisionNative ∷ Int → Number → String
34
- foreign import toFixedNative ∷ Int → Number → String
35
- foreign import toExponentialNative ∷ Int → Number → String
33
+ foreign import toPrecisionNative :: Int -> Number -> String
34
+ foreign import toFixedNative :: Int -> Number -> String
35
+ foreign import toExponentialNative :: Int -> Number -> String
36
36
37
37
-- | The `Format` data type specifies how a number will be formatted.
38
38
data Format
@@ -42,21 +42,21 @@ data Format
42
42
43
43
-- | Create a `toPrecision`-based format from an integer. Values smaller than
44
44
-- | `1` and larger than `21` will be clamped.
45
- precision ∷ Int → Format
45
+ precision :: Int -> Format
46
46
precision = Precision <<< clamp 1 21
47
47
48
48
-- | Create a `toFixed`-based format from an integer. Values smaller than `0`
49
49
-- | and larger than `20` will be clamped.
50
- fixed ∷ Int → Format
50
+ fixed :: Int -> Format
51
51
fixed = Fixed <<< clamp 0 20
52
52
53
53
-- | Create a `toExponential`-based format from an integer. Values smaller than
54
54
-- | `0` and larger than `20` will be clamped.
55
- exponential ∷ Int → Format
55
+ exponential :: Int -> Format
56
56
exponential = Exponential <<< clamp 0 20
57
57
58
58
-- | Convert a number to a string with a given format.
59
- toStringWith ∷ Format → Number → String
59
+ toStringWith :: Format -> Number -> String
60
60
toStringWith (Precision p) = toPrecisionNative p
61
61
toStringWith (Fixed p) = toFixedNative p
62
62
toStringWith (Exponential p) = toExponentialNative p
@@ -73,4 +73,4 @@ toStringWith (Exponential p) = toExponentialNative p
73
73
-- | > toString 1.2e-10
74
74
-- | "1.2e-10"
75
75
-- | ```
76
- foreign import toString ∷ Number → String
76
+ foreign import toString :: Number -> String
0 commit comments