@@ -18,15 +18,16 @@ import Control.Alt ((<|>))
18
18
import Data.Unfoldable (replicate )
19
19
import Data.Int as Int
20
20
import Data.Maybe (Maybe (..), fromMaybe )
21
- import Data.Monoid ( class Monoid )
22
- import Data.String ( length , fromCharArray , dropWhile , singleton , replace , Pattern (..), Replacement (..) )
21
+ import Data.String ( length , dropWhile , replace , Pattern (..), Replacement (..) )
22
+ import Data.String.CodePoints ( singleton , fromCodePointArray , codePointFromChar )
23
23
import Math (round , pow , abs )
24
24
25
25
-- | Pad a string on the left up to a given maximum length. The padding
26
26
-- | character can be specified.
27
27
padLeft :: Char -> Int -> String -> String
28
28
padLeft c len str = prefix <> str
29
- where prefix = fromCharArray (replicate (len - length str) c)
29
+ where prefix = fromCodePointArray $
30
+ map codePointFromChar (replicate (len - length str) c)
30
31
31
32
type PropertiesRecord =
32
33
{ width :: Maybe Int
@@ -153,13 +154,13 @@ instance formatNumber :: Format Number where
153
154
numAbsStr'' = show (abs num)
154
155
numAbsStr' = case rec.decimalMark of
155
156
Nothing -> numAbsStr''
156
- Just d -> replace (Pattern " ." ) (Replacement (singleton d)) numAbsStr''
157
+ Just d -> replace (Pattern " ." ) (Replacement (singleton $ codePointFromChar d)) numAbsStr''
157
158
numAbsStr = case rec.precision of
158
159
Nothing -> numAbsStr'
159
160
Just p -> numAbsStr' <> paddedZeros p
160
- usedDelimiter = fromMaybe ' .' rec.decimalMark
161
+ usedDelimiter = codePointFromChar $ fromMaybe ' .' rec.decimalMark
161
162
paddedZeros p = let d = length (dropWhile (_ /= usedDelimiter) numAbsStr') - 1
162
- in fromCharArray (replicate (p - d) ' 0' )
163
+ in fromCodePointArray $ map codePointFromChar (replicate (p - d) ' 0' )
163
164
numSgn = if nonNegative
164
165
then (if isSigned then " +" else " " )
165
166
else " -"
0 commit comments