build-0.0.1: Build systems a la carte

Safe HaskellSafe
LanguageHaskell2010

Build.Store

Contents

Description

An abstract key/value store.

Synopsis

Hashing

data Hash a Source #

A Hash is used for efficient tracking and sharing of build results. We use newtype Hash a = Hash a for prototyping.

Instances

Functor Hash Source # 

Methods

fmap :: (a -> b) -> Hash a -> Hash b #

(<$) :: a -> Hash b -> Hash a #

Applicative Hash Source # 

Methods

pure :: a -> Hash a #

(<*>) :: Hash (a -> b) -> Hash a -> Hash b #

liftA2 :: (a -> b -> c) -> Hash a -> Hash b -> Hash c #

(*>) :: Hash a -> Hash b -> Hash b #

(<*) :: Hash a -> Hash b -> Hash a #

Eq a => Eq (Hash a) Source # 

Methods

(==) :: Hash a -> Hash a -> Bool #

(/=) :: Hash a -> Hash a -> Bool #

Ord a => Ord (Hash a) Source # 

Methods

compare :: Hash a -> Hash a -> Ordering #

(<) :: Hash a -> Hash a -> Bool #

(<=) :: Hash a -> Hash a -> Bool #

(>) :: Hash a -> Hash a -> Bool #

(>=) :: Hash a -> Hash a -> Bool #

max :: Hash a -> Hash a -> Hash a #

min :: Hash a -> Hash a -> Hash a #

Show a => Show (Hash a) Source # 

Methods

showsPrec :: Int -> Hash a -> ShowS #

show :: Hash a -> String #

showList :: [Hash a] -> ShowS #

Hashable a => Hashable (Hash a) Source # 

Methods

hash :: Hash a -> Hash (Hash a) Source #

class Ord a => Hashable a where Source #

Minimal complete definition

hash

Methods

hash :: a -> Hash a Source #

Compute the hash of a given value. We typically assume cryptographic hashing, e.g. SHA256.

Instances

Hashable Int Source # 

Methods

hash :: Int -> Hash Int Source #

Hashable Integer Source # 
Hashable a => Hashable [a] Source # 

Methods

hash :: [a] -> Hash [a] Source #

Hashable a => Hashable (Hash a) Source # 

Methods

hash :: Hash a -> Hash (Hash a) Source #

(Hashable a, Hashable b) => Hashable (a, b) Source # 

Methods

hash :: (a, b) -> Hash (a, b) Source #

Store

data Store i k v Source #

An abstract datatype for a key/value store with build information of type i.

getValue :: k -> Store i k v -> v Source #

Read the value of a key.

putValue :: Eq k => k -> v -> Store i k v -> Store i k v Source #

Update the value of a key.

getHash :: Hashable v => k -> Store i k v -> Hash v Source #

Read the hash of a key's value. In some cases may be implemented more efficiently than hash . getValue k.

getInfo :: Store i k v -> i Source #

Read the build information.

putInfo :: i -> Store i k v -> Store i k v Source #

Write the build information.

mapInfo :: (i -> j) -> Store i k v -> Store j k v Source #

Modify the build information.

initialise :: i -> (k -> v) -> Store i k v Source #

Initialise the store.