Skip to content

Commit d26c592

Browse files
committed
Base32: No need to concatMap over singleton lists.
1 parent bd0bd95 commit d26c592

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

hnix-store-core/src/System/Nix/Base32.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import qualified Data.Vector as V
99

1010
-- | Encode a 'BS.ByteString' in Nix's base32 encoding
1111
encode :: BS.ByteString -> T.Text
12-
encode c = T.pack $ concatMap char32 [nChar - 1, nChar - 2 .. 0]
12+
encode c = T.pack $ map char32 [nChar - 1, nChar - 2 .. 0]
1313
where
1414
digits32 = V.fromList "0123456789abcdfghijklmnpqrsvwxyz"
1515
-- Each base32 character gives us 5 bits of information, while
@@ -30,8 +30,8 @@ encode c = T.pack $ concatMap char32 [nChar - 1, nChar - 2 .. 0]
3030
| j <- [0 .. BS.length c - 1]
3131
]
3232

33-
char32 :: Integer -> [Char]
34-
char32 i = [digits32 V.! digitInd]
33+
char32 :: Integer -> Char
34+
char32 i = digits32 V.! digitInd
3535
where
3636
digitInd = fromIntegral $
3737
bAsInteger

0 commit comments

Comments
 (0)