urbit-hob 0.3.0 → 0.3.1
raw patch · 4 files changed
+15/−15 lines, 4 files
Files
- lib/Urbit/Ob/Co.hs +10/−10
- lib/Urbit/Ob/Muk.hs +1/−1
- lib/Urbit/Ob/Ob.hs +2/−2
- urbit-hob.cabal +2/−2
lib/Urbit/Ob/Co.hs view
@@ -55,7 +55,7 @@ -- newtype Patp = Patp { unPatp :: BS.ByteString- } deriving (Eq, Generic)+ } deriving (Eq, Ord, Generic) instance Show Patp where show = T.unpack . renderPatp@@ -70,7 +70,7 @@ -- newtype Patq = Patq { unPatq :: BS.ByteString- } deriving (Eq, Generic)+ } deriving (Eq, Ord, Generic) instance Show Patq where show = T.unpack . renderPatq@@ -128,7 +128,7 @@ -- >>> renderPatp (patp 15663360) -- "~nidsut-tomdun" renderPatp :: Patp -> T.Text-renderPatp (Patp bs) = render' Padding LongSpacing bs+renderPatp (Patp bs) = render Padding LongSpacing bs -- | Render a \@p value as 'T.Text'. --@@ -137,7 +137,7 @@ -- >>> renderPatq (patq 15663360) -- "~mun-marzod" renderPatq :: Patq -> T.Text-renderPatq (Patq bs) = render' NoPadding ShortSpacing bs+renderPatq (Patq bs) = render NoPadding ShortSpacing bs -- | Parse a \@p value existing as 'T.Text'. --@@ -172,8 +172,8 @@ deriving Eq -- General-purpose renderer.-render' :: Padding -> Spacing -> BS.ByteString -> T.Text-render' padding spacing bs =+render :: Padding -> Spacing -> BS.ByteString -> T.Text+render padding spacing bs = T.cons '~' . snd . BS.foldr alg (0 :: Int, mempty)@@ -246,10 +246,10 @@ fromPrefix :: T.Text -> Either T.Text Word8 fromPrefix syl = case V.findIndex (== syl) prefixes of- Nothing -> Left (msg syl)+ Nothing -> Left msg Just x -> Right (fromIntegral x :: Word8) where- msg s = "urbit-hob (fromPrefix): invalid prefix \"" <> s <> "\""+ msg = "urbit-hob (fromPrefix): invalid prefix \"" <> syl <> "\"" suffixes :: V.Vector T.Text suffixes = V.fromList@@ -281,8 +281,8 @@ fromSuffix :: T.Text -> Either T.Text Word8 fromSuffix syl = case V.findIndex (== syl) suffixes of- Nothing -> Left (msg syl)+ Nothing -> Left msg Just x -> Right (fromIntegral x :: Word8) where- msg s = "urbit-hob (fromSuffix): invalid suffix \"" <> s <> "\""+ msg = "urbit-hob (fromSuffix): invalid suffix \"" <> syl <> "\""
lib/Urbit/Ob/Muk.hs view
@@ -27,5 +27,5 @@ muk syd key = M.murmur3 syd kee where kee = chr lo `B8.cons` chr hi `B8.cons` mempty lo = fromIntegral (key .&. 0xFF)- hi = fromIntegral (key .&. 0xFF00 `div` 256)+ hi = fromIntegral (key .&. 0xFF00 `div` 0x0100)
lib/Urbit/Ob/Ob.hs view
@@ -63,7 +63,7 @@ -- Note that this has been adjusted from the reference paper in order to -- support some legacy behaviour. feis :: Word32 -> Word32-feis = capFe 4 65535 65536 0xFFFFFFFF capF+feis = capFe 4 0xFFFF 0x10000 0xFFFFFFFF capF -- | Reverse 'feis'. --@@ -72,7 +72,7 @@ -- Note that this has been adjusted from the reference paper in order to -- support some legacy behaviour. tail :: Word32 -> Word32-tail = capFen 4 65535 65536 0xFFFFFFFF capF+tail = capFen 4 0xFFFF 0x10000 0xFFFFFFFF capF -- | A PRF for j in [0, .., 3] capF :: Int -> Word32 -> Word32
urbit-hob.cabal view
@@ -1,5 +1,5 @@ name: urbit-hob-version: 0.3.0+version: 0.3.1 synopsis: Hoon-style atom manipulation and printing functions homepage: https://github.com/urbit/urbit-hob bug-reports: https://github.com/urbit/urbit-hob/issues@@ -64,7 +64,7 @@ hs-source-dirs: lib if flag(release)- ghc-options: -Wall -O2+ ghc-options: -Wall else ghc-options: -Wall -Werror