Skip to content

Commit e3cea19

Browse files
prefer let over where
1 parent 4f3d71d commit e3cea19

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/Data/String/CodePoints.purs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@ foreign import _unsafeCodePointAt0
7979

8080
unsafeCodePointAt0Fallback :: String -> CodePoint
8181
unsafeCodePointAt0Fallback s =
82+
let cu0 = Unsafe.charCodeAt 0 s in
83+
let cu1 = Unsafe.charCodeAt 1 s in
8284
if isLead cu0 && isTrail cu1
8385
then unsurrogate cu0 cu1
8486
else CodePoint cu0
85-
where
86-
cu0 = Unsafe.charCodeAt 0 s
87-
cu1 = Unsafe.charCodeAt 1 s
8887

8988

9089
-- | Returns the first code point of the string after dropping the given number
@@ -198,10 +197,10 @@ foreign import _singleton
198197

199198
singletonFallback :: CodePoint -> String
200199
singletonFallback (CodePoint cp) | cp <= 0xFFFF = fromCharCode cp
201-
singletonFallback (CodePoint cp) = fromCharCode lead <> fromCharCode trail
202-
where
203-
lead = ((cp - 0x10000) / 0x400) + 0xD800
204-
trail = (cp - 0x10000) `mod` 0x400 + 0xDC00
200+
singletonFallback (CodePoint cp) =
201+
let lead = ((cp - 0x10000) / 0x400) + 0xD800 in
202+
let trail = (cp - 0x10000) `mod` 0x400 + 0xDC00 in
203+
fromCharCode lead <> fromCharCode trail
205204

206205

207206
-- | Returns a record with strings created from the code points on either side

0 commit comments

Comments
 (0)