hakyll-4.16.2.2: A static website compiler library

Safe Haskell | Safe-Inferred
Language | Haskell2010

Hakyll.Core.Store

Description

A store for storing and retreiving items

Synopsis

- data Store
- data Result a
  - = Found a
  - | NotFound
  - | WrongType TypeRep TypeRep
- toMaybe :: Result a -> Maybe a
- new :: Bool -> FilePath -> IO Store
- set :: (Binary a, Typeable a) => Store -> [String] -> a -> IO ()
- get :: forall a. (Binary a, Typeable a) => Store -> [String] -> IO (Result a)
- isMember :: Store -> [String] -> IO Bool
- delete :: Store -> [String] -> IO ()
- hash :: [String] -> String

# Documentation

data Store Source #

#### Instances

Instances details

Show Store Source # |
Instance details Defined in Hakyll.Core.Store Methods showsPrec :: Int -> Store -> ShowS Source # show :: Store -> String Source # showList :: [Store] -> ShowS Source #

data Result a Source #

Result of a store query

Constructors

Found a | Found, result
NotFound | Not found
WrongType TypeRep TypeRep | Expected, true type

#### Instances

Instances details

Show a => Show (Result a) Source # |
Instance details Defined in Hakyll.Core.Store Methods showsPrec :: Int -> Result a -> ShowS Source # show :: Result a -> String Source # showList :: [Result a] -> ShowS Source #
Eq a => Eq (Result a) Source # |
Instance details Defined in Hakyll.Core.Store Methods (==) :: Result a -> Result a -> Bool Source # (/=) :: Result a -> Result a -> Bool Source #

toMaybe :: Result a -> Maybe a Source #

Convert result to `Maybe`

new Source #

Arguments

:: Bool | Use in-memory caching
-> FilePath | Directory to use for hard disk storage
-> IO Store | Store

Initialize the store

set :: (Binary a, Typeable a) => Store -> [String] -> a -> IO () Source #

Store an item

get :: forall a. (Binary a, Typeable a) => Store -> [String] -> IO (Result a) Source #

Load an item

isMember :: Store -> [String] -> IO Bool Source #

Strict function

delete :: Store -> [String] -> IO () Source #

Delete an item

hash :: [String] -> String Source #

Mostly meant for internal usage