Compare commits
No commits in common. "e2d9a9aa933f60eb803f3f037008a2da0a05dc7e" and "39d8da7b11a80269454c2f134a5c834e0f3cb9a7" have entirely different histories.
e2d9a9aa93
...
39d8da7b11
4 changed files with 1 additions and 17 deletions
|
@ -5,12 +5,6 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [0.12.2.0]
|
|
||||||
|
|
||||||
### Added
|
|
||||||
|
|
||||||
- `FromHttpApiData` instance for Servant integration
|
|
||||||
|
|
||||||
## [0.12.0]
|
## [0.12.0]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -39,7 +39,6 @@ library
|
||||||
, bytestring
|
, bytestring
|
||||||
, foreign-rust
|
, foreign-rust
|
||||||
, generics-sop
|
, generics-sop
|
||||||
, servant
|
|
||||||
, text
|
, text
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: hexstring
|
name: hexstring
|
||||||
version: 0.12.2.0
|
version: 0.12.1.0
|
||||||
git: "https://git.vergara.tech/Vergara_Tech/haskell-hexstring"
|
git: "https://git.vergara.tech/Vergara_Tech/haskell-hexstring"
|
||||||
license: MIT
|
license: MIT
|
||||||
author:
|
author:
|
||||||
|
@ -30,7 +30,6 @@ library:
|
||||||
- generics-sop
|
- generics-sop
|
||||||
- borsh >= 0.2
|
- borsh >= 0.2
|
||||||
- foreign-rust
|
- foreign-rust
|
||||||
- servant
|
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
hextring-test:
|
hextring-test:
|
||||||
|
|
|
@ -35,8 +35,6 @@ import qualified GHC.Generics as GHC
|
||||||
import qualified Generics.SOP as SOP
|
import qualified Generics.SOP as SOP
|
||||||
import Text.Read
|
import Text.Read
|
||||||
|
|
||||||
import Servant.API (FromHttpApiData(..))
|
|
||||||
|
|
||||||
-- | Represents a Hex string. Guarantees that all characters it contains
|
-- | Represents a Hex string. Guarantees that all characters it contains
|
||||||
-- are valid hex characters.
|
-- are valid hex characters.
|
||||||
newtype HexString = HexString
|
newtype HexString = HexString
|
||||||
|
@ -58,12 +56,6 @@ instance FromJSON HexString where
|
||||||
instance ToJSON HexString where
|
instance ToJSON HexString where
|
||||||
toJSON = Data.Aeson.String . toText
|
toJSON = Data.Aeson.String . toText
|
||||||
|
|
||||||
instance FromHttpApiData HexString where
|
|
||||||
parseUrlPiece s =
|
|
||||||
case BS16.decode (TE.encodeUtf8 s) of
|
|
||||||
Right s -> Right $ HexString s
|
|
||||||
Left e -> Left $ T.pack e
|
|
||||||
|
|
||||||
-- | Smart constructor which validates that all the text are actually
|
-- | Smart constructor which validates that all the text are actually
|
||||||
-- hexadecimal characters.
|
-- hexadecimal characters.
|
||||||
hexString :: BS.ByteString -> HexString
|
hexString :: BS.ByteString -> HexString
|
||||||
|
|
Loading…
Reference in a new issue