Skip to content

Commit a139b6f

Browse files
committed
Do not break everyone's code
Force named hashes to be valid. After all, what would be the point of naming an invalid hash ? This avoids propagating manually the ValidAlgo requirement everywhere.
1 parent 5b91fca commit a139b6f

File tree

1 file changed

+2
-2
lines changed
  • hnix-store-core/src/System/Nix/Internal

1 file changed

+2
-2
lines changed

hnix-store-core/src/System/Nix/Internal/Hash.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class ValidAlgo (a :: HashAlgorithm) where
6464

6565
-- | A 'HashAlgorithm' with a canonical name, for serialization
6666
-- purposes (e.g. SRI hashes)
67-
class NamedAlgo (a :: HashAlgorithm) where
67+
class ValidAlgo a => NamedAlgo (a :: HashAlgorithm) where
6868
algoName :: Text
6969
hashSize :: Int
7070

@@ -87,7 +87,7 @@ instance NamedAlgo 'SHA512 where
8787
-}
8888

8989
-- | A digest whose 'NamedAlgo' is not known at compile time.
90-
data SomeNamedDigest = forall a . (NamedAlgo a, ValidAlgo a) => SomeDigest (Digest a)
90+
data SomeNamedDigest = forall a . NamedAlgo a => SomeDigest (Digest a)
9191

9292
instance Show SomeNamedDigest where
9393
show sd = case sd of

0 commit comments

Comments
 (0)