Skip to content

Commit 79cf119

Browse files
committed
Add lower bounds to package description
Also some refactoring/reformatting
1 parent 359de1e commit 79cf119

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

casa-types/casa-types.cabal

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff 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

casa-types/src/Casa/Types.hs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,23 @@ instance ToJSON BlobKey where
4545

4646
instance 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.
5553
blobKeyHexParser :: Text -> Either String BlobKey
5654
blobKeyHexParser =
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.
6663
blobKeyBinaryParser :: 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.
7067
blobKeyToBuilder :: BlobKey -> S.Builder

0 commit comments

Comments
 (0)