module Unison.Hash32
(
Hash32 (..),
fromHash,
toHash,
unsafeFromBase32Hex,
toBase32Hex,
toText,
)
where
import U.Util.Base32Hex (Base32Hex (..))
import Unison.Hash (Hash)
import Unison.Hash qualified as Hash
import Unison.Prelude
newtype Hash32 = UnsafeFromBase32Hex Base32Hex
deriving (Hash32 -> Hash32 -> Bool
(Hash32 -> Hash32 -> Bool)
-> (Hash32 -> Hash32 -> Bool) -> Eq Hash32
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Hash32 -> Hash32 -> Bool
== :: Hash32 -> Hash32 -> Bool
$c/= :: Hash32 -> Hash32 -> Bool
/= :: Hash32 -> Hash32 -> Bool
Eq, Eq Hash32
Eq Hash32 =>
(Hash32 -> Hash32 -> Ordering)
-> (Hash32 -> Hash32 -> Bool)
-> (Hash32 -> Hash32 -> Bool)
-> (Hash32 -> Hash32 -> Bool)
-> (Hash32 -> Hash32 -> Bool)
-> (Hash32 -> Hash32 -> Hash32)
-> (Hash32 -> Hash32 -> Hash32)
-> Ord Hash32
Hash32 -> Hash32 -> Bool
Hash32 -> Hash32 -> Ordering
Hash32 -> Hash32 -> Hash32
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Hash32 -> Hash32 -> Ordering
compare :: Hash32 -> Hash32 -> Ordering
$c< :: Hash32 -> Hash32 -> Bool
< :: Hash32 -> Hash32 -> Bool
$c<= :: Hash32 -> Hash32 -> Bool
<= :: Hash32 -> Hash32 -> Bool
$c> :: Hash32 -> Hash32 -> Bool
> :: Hash32 -> Hash32 -> Bool
$c>= :: Hash32 -> Hash32 -> Bool
>= :: Hash32 -> Hash32 -> Bool
$cmax :: Hash32 -> Hash32 -> Hash32
max :: Hash32 -> Hash32 -> Hash32
$cmin :: Hash32 -> Hash32 -> Hash32
min :: Hash32 -> Hash32 -> Hash32
Ord, Int -> Hash32 -> ShowS
[Hash32] -> ShowS
Hash32 -> String
(Int -> Hash32 -> ShowS)
-> (Hash32 -> String) -> ([Hash32] -> ShowS) -> Show Hash32
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Hash32 -> ShowS
showsPrec :: Int -> Hash32 -> ShowS
$cshow :: Hash32 -> String
show :: Hash32 -> String
$cshowList :: [Hash32] -> ShowS
showList :: [Hash32] -> ShowS
Show) via (Text)
instance From Hash32 Text where
from :: Hash32 -> Text
from = Hash32 -> Text
toText
instance From Hash32 Hash where
from :: Hash32 -> Hash
from = Hash32 -> Hash
toHash
instance From Hash Hash32 where
from :: Hash -> Hash32
from = Hash -> Hash32
fromHash
fromHash :: Hash -> Hash32
fromHash :: Hash -> Hash32
fromHash =
Base32Hex -> Hash32
unsafeFromBase32Hex (Base32Hex -> Hash32) -> (Hash -> Base32Hex) -> Hash -> Hash32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hash -> Base32Hex
Hash.toBase32Hex
toHash :: Hash32 -> Hash
toHash :: Hash32 -> Hash
toHash =
Base32Hex -> Hash
Hash.fromBase32Hex (Base32Hex -> Hash) -> (Hash32 -> Base32Hex) -> Hash32 -> Hash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hash32 -> Base32Hex
toBase32Hex
unsafeFromBase32Hex :: Base32Hex -> Hash32
unsafeFromBase32Hex :: Base32Hex -> Hash32
unsafeFromBase32Hex =
Base32Hex -> Hash32
forall a b. Coercible a b => a -> b
coerce
toBase32Hex :: Hash32 -> Base32Hex
toBase32Hex :: Hash32 -> Base32Hex
toBase32Hex =
Hash32 -> Base32Hex
forall a b. Coercible a b => a -> b
coerce
toText :: Hash32 -> Text
toText :: Hash32 -> Text
toText =
Hash32 -> Text
forall a b. Coercible a b => a -> b
coerce