darcs-2.18.2: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Util.ValidHash

Synopsis

- class (Eq h, IsSizeHash h) => ValidHash h where
  - dirofValidHash :: h -> HashedDir
  - calcValidHash :: ByteString -> h
- data InventoryHash
- data PatchHash
- data PristineHash
- data HashedDir
  - = HashedPristineDir
  - | HashedPatchesDir
  - | HashedInventoriesDir
- encodeValidHash :: ValidHash h => h -> String
- decodeValidHash :: ValidHash h => String -> Maybe h
- parseValidHash :: ValidHash h => Parser h
- getHash :: ValidHash h => h -> Hash
- getSize :: ValidHash h => h -> Maybe Int
- fromHash :: ValidHash h => Hash -> h
- fromSizeAndHash :: ValidHash h => Int -> Hash -> h
- checkHash :: ValidHash h => h -> ByteString -> Bool
- okayHash :: String -> Bool

# Documentation

class (Eq h, IsSizeHash h) => ValidHash h where #

External API for the various hash types.

Minimal complete definition

dirofValidHash

Methods

dirofValidHash :: h -> HashedDir #

The `HashedDir` belonging to this type of hash

calcValidHash :: ByteString -> h #

Compute hash from file content.

#### Instances

Instances details

ValidHash InventoryHash # |
Instance details Defined in Darcs.Util.ValidHash Methods dirofValidHash :: InventoryHash -> HashedDir # calcValidHash :: ByteString -> InventoryHash #
ValidHash PatchHash # |
Instance details Defined in Darcs.Util.ValidHash Methods dirofValidHash :: PatchHash -> HashedDir # calcValidHash :: ByteString -> PatchHash #
ValidHash PristineHash # |
Instance details Defined in Darcs.Util.ValidHash Methods dirofValidHash :: PristineHash -> HashedDir # calcValidHash :: ByteString -> PristineHash #

data InventoryHash #

#### Instances

Instances details

Show InventoryHash # |
Instance details Defined in Darcs.Util.ValidHash Methods showsPrec :: Int -> InventoryHash -> ShowS # show :: InventoryHash -> String # showList :: [InventoryHash] -> ShowS #
ValidHash InventoryHash # |
Instance details Defined in Darcs.Util.ValidHash Methods dirofValidHash :: InventoryHash -> HashedDir # calcValidHash :: ByteString -> InventoryHash #
Eq InventoryHash # |
Instance details Defined in Darcs.Util.ValidHash Methods (==) :: InventoryHash -> InventoryHash -> Bool # (/=) :: InventoryHash -> InventoryHash -> Bool #

data PatchHash #

#### Instances

Instances details

Show PatchHash # |
Instance details Defined in Darcs.Util.ValidHash Methods showsPrec :: Int -> PatchHash -> ShowS # show :: PatchHash -> String # showList :: [PatchHash] -> ShowS #
ValidHash PatchHash # |
Instance details Defined in Darcs.Util.ValidHash Methods dirofValidHash :: PatchHash -> HashedDir # calcValidHash :: ByteString -> PatchHash #
Eq PatchHash # |
Instance details Defined in Darcs.Util.ValidHash Methods (==) :: PatchHash -> PatchHash -> Bool # (/=) :: PatchHash -> PatchHash -> Bool #

data PristineHash #

#### Instances

Instances details

Show PristineHash # |
Instance details Defined in Darcs.Util.ValidHash Methods showsPrec :: Int -> PristineHash -> ShowS # show :: PristineHash -> String # showList :: [PristineHash] -> ShowS #
ValidHash PristineHash # |
Instance details Defined in Darcs.Util.ValidHash Methods dirofValidHash :: PristineHash -> HashedDir # calcValidHash :: ByteString -> PristineHash #
Eq PristineHash # |
Instance details Defined in Darcs.Util.ValidHash Methods (==) :: PristineHash -> PristineHash -> Bool # (/=) :: PristineHash -> PristineHash -> Bool #

data HashedDir #

Semantically, this is the type of hashed objects. Git has a type tag inside the hashed file itself, whereas in Darcs the type is determined by the subdirectory.

Constructors

HashedPristineDir |
HashedPatchesDir |
HashedInventoriesDir |

#### Instances

Instances details

Eq HashedDir # |
Instance details Defined in Darcs.Util.ValidHash Methods (==) :: HashedDir -> HashedDir -> Bool # (/=) :: HashedDir -> HashedDir -> Bool #

encodeValidHash :: ValidHash h => h -> String #

decodeValidHash :: ValidHash h => String -> Maybe h #

parseValidHash :: ValidHash h => Parser h #

getHash :: ValidHash h => h -> Hash #

getSize :: ValidHash h => h -> Maybe Int #

fromHash :: ValidHash h => Hash -> h #

fromSizeAndHash :: ValidHash h => Int -> Hash -> h #

checkHash :: ValidHash h => h -> ByteString -> Bool #

Verify file content against a given `ValidHash`.

okayHash :: String -> Bool #

Check that the given `String` is an encoding of some `ValidHash`.