File tree Expand file tree Collapse file tree 2 files changed +17
-20
lines changed
Expand file tree Collapse file tree 2 files changed +17
-20
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,13 @@ library
3535 src
3636 ghc-options : -Wall
3737 build-depends :
38- aeson
39- , attoparsec
40- , base
41- , base16-bytestring >= 1
42- , bytestring
43- , hashable
44- , path-pieces
45- , persistent
46- , text
38+ aeson >= 0.5.0.0
39+ , attoparsec >= 0.10.0.0
40+ , base >= 4.8 && < 5
41+ , base16-bytestring >= 1.0.0.0
42+ , bytestring >= 0.10.2.0
43+ , hashable >= 1.1.2.0
44+ , path-pieces >= 0.1.0
45+ , persistent >= 1.2.0
46+ , text >= 0.11.1.5
4747 default-language : Haskell2010
Original file line number Diff line number Diff line change @@ -45,26 +45,23 @@ instance ToJSON BlobKey where
4545
4646instance PathPiece BlobKey where
4747
48- fromPathPiece =
49- either (const Nothing ) Just .
50- blobKeyHexParser
48+ fromPathPiece = either (const Nothing ) Just . blobKeyHexParser
5149
5250 toPathPiece = T. decodeUtf8 . Hex. encode . unBlobKey
5351
5452-- | Parse a blob key in hex format.
5553blobKeyHexParser :: Text -> Either String BlobKey
5654blobKeyHexParser =
57- Atto.T. parseOnly
58- (fmap
59- BlobKey
60- (do bytes <- Atto.T. take 64
61- case Hex. decode (T. encodeUtf8 bytes) of
62- Right result -> pure result
63- Left _ -> fail " Invalid hex key." ))
55+ Atto.T. parseOnly $
56+ BlobKey <$> do
57+ bytes <- Atto.T. take 64
58+ case Hex. decode (T. encodeUtf8 bytes) of
59+ Right result -> pure result
60+ Left _ -> fail " Invalid hex key."
6461
6562-- | Parse a blob key in binary format.
6663blobKeyBinaryParser :: Atto.B. Parser BlobKey
67- blobKeyBinaryParser = fmap BlobKey ( Atto.B. take 32 )
64+ blobKeyBinaryParser = BlobKey <$> Atto.B. take 32
6865
6966-- | Yield a t'S.Builder' value corresponding to the given t'BlobKey' value.
7067blobKeyToBuilder :: BlobKey -> S. Builder
You can’t perform that action at this time.
0 commit comments