Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Hash = Hash ShortByteString
- newtype HashFor t = HashFor {
- genericHash :: Hash
- $sel:toShort:Hash :: Hash -> ShortByteString
- fromByteString :: ByteString -> Hash
- toByteString :: Hash -> ByteString
- fromBase32Hex :: Base32Hex -> Hash
- toBase32Hex :: Hash -> Base32Hex
- fromBase32HexText :: Text -> Maybe Hash
- unsafeFromBase32HexText :: Text -> Hash
- toBase32HexText :: Hash -> Text
Documentation
A hash.
Instances
Generic Hash Source # | |
Show Hash Source # | |
Eq Hash Source # | |
Ord Hash Source # | |
From Hash Text Source # | |
Defined in Unison.Hash | |
From Hash Hash32 Source # | |
Defined in Unison.Hash32 | |
From Hash32 Hash Source # | |
Defined in Unison.Hash32 | |
type Rep Hash Source # | |
Defined in Unison.Hash type Rep Hash = D1 ('MetaData "Hash" "Unison.Hash" "unison-hash-0.0.0-89xUPcq1YDX4TbDWy6AuPS" 'True) (C1 ('MetaCons "Hash" 'PrefixI 'True) (S1 ('MetaSel ('Just "toShort") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString))) |
A hash tagged with the type it's a hash of, useful for maintaining type safety guarantees.
ShortByteString conversions
ByteString conversions
fromByteString :: ByteString -> Hash Source #
Convert a byte string to a hash.
toByteString :: Hash -> ByteString Source #
Convert a hash to a byte string.
Base32Hex conversions
fromBase32Hex :: Base32Hex -> Hash Source #
Convert base32 hex to a hash.
toBase32Hex :: Hash -> Base32Hex Source #
Convert a hash to base32 hex.
Base32Hex Text conversions
fromBase32HexText :: Text -> Maybe Hash Source #
Produce a Hash
from a base32hex-encoded version of its binary representation
unsafeFromBase32HexText :: Text -> Hash Source #
Convert a hash from base32 hex without any validation.
toBase32HexText :: Hash -> Text Source #
Return the lowercase unpadded base32Hex encoding of this Hash
.
Multibase prefix would be v
, see https://github.com/multiformats/multibase