Safe Haskell | None |
---|---|
Language | Haskell98 |
- withListing :: mid -> Step sid mid aid -> Schema sid mid aid
- noListing :: Step sid mid aid -> Schema sid mid aid
- singleton :: sid -> Step sid mid aid -> Schema sid mid aid
- named :: [(String, Endpoint sid mid aid)] -> Step sid mid aid
- static :: aid -> Endpoint sid mid aid
- single :: sid -> Endpoint sid mid aid
- singleBy :: (String -> sid) -> Endpoint sid mid aid
- singleRead :: (Show a, Read a, Info a) => (a -> sid) -> Endpoint sid mid aid
- listing :: mid -> Endpoint sid mid aid
- listingBy :: (String -> mid) -> Endpoint sid mid aid
- listingRead :: (Show a, Read a, Info a) => (a -> mid) -> Endpoint sid mid aid
- unnamedSingle :: (String -> sid) -> Step sid mid aid
- unnamedSingleRead :: (Show a, Read a, Info a) => (a -> sid) -> Step sid mid aid
- unnamedListing :: (String -> mid) -> Step sid mid aid
- unnamedListingRead :: (Show a, Read a, Info a) => (a -> mid) -> Step sid mid aid
- data Schema sid mid aid = Schema (Maybe (Cardinality sid mid)) (Step sid mid aid)
- data Step sid mid aid
- data Cardinality s m
- data Getter id
- data Id id = Id (Ident a) (a -> id)
- type Endpoint sid mid aid = Either aid (Cardinality (Getter sid) (Getter mid))
A set of combinators for creating schemas.
Top level
withListing :: mid -> Step sid mid aid -> Schema sid mid aid Source #
A schema with a top level listing.
singleton :: sid -> Step sid mid aid -> Schema sid mid aid Source #
A schema with a singleton at the top level.
Named endpoints
singleBy :: (String -> sid) -> Endpoint sid mid aid Source #
A single resource endpoint with a string identifier.
singleRead :: (Show a, Read a, Info a) => (a -> sid) -> Endpoint sid mid aid Source #
A single resource endpoint with an identifier that can be read.
listingBy :: (String -> mid) -> Endpoint sid mid aid Source #
A listing endpoint with a string identifier.
listingRead :: (Show a, Read a, Info a) => (a -> mid) -> Endpoint sid mid aid Source #
A listing with an identifier that can be read.
Unnamed endpoints
unnamedSingle :: (String -> sid) -> Step sid mid aid Source #
An unnamed single resource with a string identifier.
unnamedSingleRead :: (Show a, Read a, Info a) => (a -> sid) -> Step sid mid aid Source #
An unnamed single resource with an identifier that can be read.
unnamedListing :: (String -> mid) -> Step sid mid aid Source #
An unnamed listing with a string identifier.
unnamedListingRead :: (Show a, Read a, Info a) => (a -> mid) -> Step sid mid aid Source #
An unnamed listing with an identifier that can be read.
The core schema data types.
data Schema sid mid aid Source #
A Schema
describes how (part of the) route to a resource looks,
and returns an identifier for a single resource (sid
), many
resources (mid
) or a static action (aid
).
The first argument specifies the top level resource (no path
segments). The second specifies a what happens at the first step in
the path.
Schema (Maybe (Cardinality sid mid)) (Step sid mid aid) |
data Cardinality s m Source #
Specifies if we're identifying a single resource, or many (a listing).
An identification of an item in a resource. It contains a
dictionary describing how to identify the resource, and a function
for this identification type to an id
.