Copyright | (c) 2015 Athan Clark |
---|---|
License | BSD-style |
Maintainer | athan.clark@gmail.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
- class Singleton chunks a trie | chunks a -> trie where
- class Extend eitherUrlChunk child result | eitherUrlChunk child -> result where
- class Extrude chunks start result | chunks start -> result where
- type ExtrudeSoundly k cleanxs xs c r = (cleanxs ~ CatMaybes xs, ArityTypeListIso c cleanxs r, Extrude (PathChunks k xs) (RootedPredTrie k c) (RootedPredTrie k r))
- type family CatMaybes (xs :: [Maybe *]) :: [*] where ...
- only :: k -> PathChunk k Nothing
- pred :: k -> (k -> Maybe r) -> PathChunk k (Just r)
- (./) :: PathChunk k mx -> PathChunks k xs -> PathChunks k (mx ': xs)
- nil :: PathChunks k '[]
- data PathChunk k (mx :: Maybe *)
- data PathChunks k (xs :: [Maybe *])
Heterogenous Construction
class Singleton chunks a trie | chunks a -> trie where Source #
Creates a string of nodes - a trie with a width of 1.
(Singleton (PathChunks k xs) new trie0, Extend (PathChunk k x) trie0 trie1) => Singleton (PathChunks k ((:) (Maybe *) x xs)) new trie1 Source # | |
Singleton (PathChunks k ([] (Maybe *))) a (RootedPredTrie k a) Source # | |
class Extend eitherUrlChunk child result | eitherUrlChunk child -> result where Source #
Turn a list of tries (Rooted
) into a node with those children
class Extrude chunks start result | chunks start -> result where Source #
FoldR Extend start chunks ~ result
(Extrude (PathChunks k xs) trie0 trie1, Extend (PathChunk k x) trie1 trie2) => Extrude (PathChunks k ((:) (Maybe *) x xs)) trie0 trie2 Source # | |
Extrude (PathChunks k ([] (Maybe *))) (RootedPredTrie k a) (RootedPredTrie k a) Source # | |
type ExtrudeSoundly k cleanxs xs c r = (cleanxs ~ CatMaybes xs, ArityTypeListIso c cleanxs r, Extrude (PathChunks k xs) (RootedPredTrie k c) (RootedPredTrie k r)) Source #
A simple proof showing that the list version and function version are interchangable.
type family CatMaybes (xs :: [Maybe *]) :: [*] where ... Source #
Convenience type-level function for removing Nothing
s from a type list.
Path Construction
pred :: k -> (k -> Maybe r) -> PathChunk k (Just r) Source #
Match with a predicate against the url chunk directly.
(./) :: PathChunk k mx -> PathChunks k xs -> PathChunks k (mx ': xs) infixr 9 Source #
The cons-cell for building a query path.
nil :: PathChunks k '[] Source #
The basis, equivalent to []
Path Types
data PathChunk k (mx :: Maybe *) Source #
Constrained to AttoParsec, Regex-Compat and T.Text
IsString k => IsString (PathChunk k (Nothing *)) Source # | Use raw strings instead of prepending |
(Eq k, Hashable k, Typeable * r) => Extend (PathChunk k (Just * r)) (RootedPredTrie k (r -> a)) (RootedPredTrie k a) Source # | Existentially quantified case |
(Eq k, Hashable k) => Extend (PathChunk k (Nothing *)) (RootedPredTrie k a) (RootedPredTrie k a) Source # | Literal case |
data PathChunks k (xs :: [Maybe *]) Source #
Container when defining route paths
(Extrude (PathChunks k xs) trie0 trie1, Extend (PathChunk k x) trie1 trie2) => Extrude (PathChunks k ((:) (Maybe *) x xs)) trie0 trie2 Source # | |
(Singleton (PathChunks k xs) new trie0, Extend (PathChunk k x) trie0 trie1) => Singleton (PathChunks k ((:) (Maybe *) x xs)) new trie1 Source # | |
Singleton (PathChunks k ([] (Maybe *))) a (RootedPredTrie k a) Source # | |
Extrude (PathChunks k ([] (Maybe *))) (RootedPredTrie k a) (RootedPredTrie k a) Source # | |