eliminate s2w8 and w82s
Note that the use of s2w8 in genUUIDInNameSpace made it truncate unicode characters. Luckily, genUUIDInNameSpace is only ever used on ASCII strings as far as I can determine. In particular, git-remote-gcrypt's gcrypt-id is an ASCII string.
This commit is contained in:
parent
3742263c99
commit
c873586e14
6 changed files with 10 additions and 25 deletions
|
@ -10,12 +10,8 @@
|
|||
module Utility.Data (
|
||||
firstJust,
|
||||
eitherToMaybe,
|
||||
s2w8,
|
||||
w82s,
|
||||
) where
|
||||
|
||||
import Data.Word
|
||||
|
||||
{- First item in the list that is not Nothing. -}
|
||||
firstJust :: Eq a => [Maybe a] -> Maybe a
|
||||
firstJust ms = case dropWhile (== Nothing) ms of
|
||||
|
@ -24,15 +20,3 @@ firstJust ms = case dropWhile (== Nothing) ms of
|
|||
|
||||
eitherToMaybe :: Either a b -> Maybe b
|
||||
eitherToMaybe = either (const Nothing) Just
|
||||
|
||||
c2w8 :: Char -> Word8
|
||||
c2w8 = fromIntegral . fromEnum
|
||||
|
||||
w82c :: Word8 -> Char
|
||||
w82c = toEnum . fromIntegral
|
||||
|
||||
s2w8 :: String -> [Word8]
|
||||
s2w8 = map c2w8
|
||||
|
||||
w82s :: [Word8] -> String
|
||||
w82s = map w82c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue