| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Yesod.Routes.TH.Types
Description
Warning! This module is considered internal and may have breaking changes
Synopsis
- data Resource typ = Resource {
- resourceName :: String
- resourcePieces :: [Piece typ]
- resourceDispatch :: Dispatch typ
- resourceAttrs :: [String]
- resourceCheck :: CheckOverlap
- data ResourceTree typ
- = ResourceLeaf (Resource typ)
- | ResourceParent String CheckOverlap (Set String) [Piece typ] [ResourceTree typ]
- data Piece typ
- data Dispatch typ
- = Methods {
- methodsMulti :: Maybe typ
- methodsMethods :: [String]
- | Subsite {
- subsiteType :: typ
- subsiteFunc :: String
- = Methods {
- type CheckOverlap = Bool
- data FlatResource a = FlatResource {
- frParentDetails :: [ParentDetails a]
- frName :: String
- frPieces :: [Piece a]
- frDispatch :: Dispatch a
- frCheck :: Bool
- data ParentDetails a = ParentDetails {}
- data TyArgs
- = NoTyArgs
- | SomeTyArgs (NonEmpty (Type, Name))
- toTyArgs :: [(Type, Name)] -> TyArgs
- tyArgsList :: TyArgs -> [(Type, Name)]
- tyArgsTypes :: TyArgs -> [Type]
- tyArgsBinders :: TyArgs -> [Name]
- tyArgsArity :: TyArgs -> Int
- hasTyArgs :: TyArgs -> Bool
- applyTyArgs :: Type -> TyArgs -> Type
- resourceMulti :: Resource typ -> Maybe typ
- resourceTreePieces :: ResourceTree typ -> [Piece typ]
- resourceTreeName :: ResourceTree typ -> String
- flatten :: [ResourceTree a] -> [FlatResource a]
Data types
Constructors
| Resource | |
Fields
| |
Instances
| Functor Resource Source # | |
| Foldable Resource Source # | |
Defined in Yesod.Routes.TH.Types Methods fold :: Monoid m => Resource m -> m foldMap :: Monoid m => (a -> m) -> Resource a -> m foldMap' :: Monoid m => (a -> m) -> Resource a -> m foldr :: (a -> b -> b) -> b -> Resource a -> b foldr' :: (a -> b -> b) -> b -> Resource a -> b foldl :: (b -> a -> b) -> b -> Resource a -> b foldl' :: (b -> a -> b) -> b -> Resource a -> b foldr1 :: (a -> a -> a) -> Resource a -> a foldl1 :: (a -> a -> a) -> Resource a -> a elem :: Eq a => a -> Resource a -> Bool maximum :: Ord a => Resource a -> a minimum :: Ord a => Resource a -> a | |
| Traversable Resource Source # | |
| Lift typ => Lift (Resource typ :: Type) Source # | |
| Show typ => Show (Resource typ) Source # | |
data ResourceTree typ Source #
Constructors
| ResourceLeaf (Resource typ) | |
| ResourceParent String CheckOverlap (Set String) [Piece typ] [ResourceTree typ] |
Instances
| Functor ResourceTree Source # | |
Defined in Yesod.Routes.TH.Types Methods fmap :: (a -> b) -> ResourceTree a -> ResourceTree b (<$) :: a -> ResourceTree b -> ResourceTree a | |
| Foldable ResourceTree Source # | |
Defined in Yesod.Routes.TH.Types Methods fold :: Monoid m => ResourceTree m -> m foldMap :: Monoid m => (a -> m) -> ResourceTree a -> m foldMap' :: Monoid m => (a -> m) -> ResourceTree a -> m foldr :: (a -> b -> b) -> b -> ResourceTree a -> b foldr' :: (a -> b -> b) -> b -> ResourceTree a -> b foldl :: (b -> a -> b) -> b -> ResourceTree a -> b foldl' :: (b -> a -> b) -> b -> ResourceTree a -> b foldr1 :: (a -> a -> a) -> ResourceTree a -> a foldl1 :: (a -> a -> a) -> ResourceTree a -> a toList :: ResourceTree a -> [a] null :: ResourceTree a -> Bool length :: ResourceTree a -> Int elem :: Eq a => a -> ResourceTree a -> Bool maximum :: Ord a => ResourceTree a -> a minimum :: Ord a => ResourceTree a -> a sum :: Num a => ResourceTree a -> a product :: Num a => ResourceTree a -> a | |
| Traversable ResourceTree Source # | |
Defined in Yesod.Routes.TH.Types Methods traverse :: Applicative f => (a -> f b) -> ResourceTree a -> f (ResourceTree b) sequenceA :: Applicative f => ResourceTree (f a) -> f (ResourceTree a) mapM :: Monad m => (a -> m b) -> ResourceTree a -> m (ResourceTree b) sequence :: Monad m => ResourceTree (m a) -> m (ResourceTree a) | |
| Lift typ => Lift (ResourceTree typ :: Type) Source # | |
Defined in Yesod.Routes.TH.Types Methods lift :: Quote m => ResourceTree typ -> m Exp liftTyped :: forall (m :: Type -> Type). Quote m => ResourceTree typ -> Code m (ResourceTree typ) | |
| Show typ => Show (ResourceTree typ) Source # | |
Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> ResourceTree typ -> ShowS show :: ResourceTree typ -> String showList :: [ResourceTree typ] -> ShowS | |
Instances
| Functor Piece Source # | |
| Foldable Piece Source # | |
Defined in Yesod.Routes.TH.Types Methods fold :: Monoid m => Piece m -> m foldMap :: Monoid m => (a -> m) -> Piece a -> m foldMap' :: Monoid m => (a -> m) -> Piece a -> m foldr :: (a -> b -> b) -> b -> Piece a -> b foldr' :: (a -> b -> b) -> b -> Piece a -> b foldl :: (b -> a -> b) -> b -> Piece a -> b foldl' :: (b -> a -> b) -> b -> Piece a -> b foldr1 :: (a -> a -> a) -> Piece a -> a foldl1 :: (a -> a -> a) -> Piece a -> a elem :: Eq a => a -> Piece a -> Bool maximum :: Ord a => Piece a -> a | |
| Traversable Piece Source # | |
| Lift typ => Lift (Piece typ :: Type) Source # | |
| Show typ => Show (Piece typ) Source # | |
Constructors
| Methods | |
Fields
| |
| Subsite | |
Fields
| |
Instances
| Functor Dispatch Source # | |
| Foldable Dispatch Source # | |
Defined in Yesod.Routes.TH.Types Methods fold :: Monoid m => Dispatch m -> m foldMap :: Monoid m => (a -> m) -> Dispatch a -> m foldMap' :: Monoid m => (a -> m) -> Dispatch a -> m foldr :: (a -> b -> b) -> b -> Dispatch a -> b foldr' :: (a -> b -> b) -> b -> Dispatch a -> b foldl :: (b -> a -> b) -> b -> Dispatch a -> b foldl' :: (b -> a -> b) -> b -> Dispatch a -> b foldr1 :: (a -> a -> a) -> Dispatch a -> a foldl1 :: (a -> a -> a) -> Dispatch a -> a elem :: Eq a => a -> Dispatch a -> Bool maximum :: Ord a => Dispatch a -> a minimum :: Ord a => Dispatch a -> a | |
| Traversable Dispatch Source # | |
| Lift typ => Lift (Dispatch typ :: Type) Source # | |
| Show typ => Show (Dispatch typ) Source # | |
type CheckOverlap = Bool Source #
data FlatResource a Source #
Constructors
| FlatResource | |
Fields
| |
Instances
| Show a => Show (FlatResource a) Source # | |
Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> FlatResource a -> ShowS show :: FlatResource a -> String showList :: [FlatResource a] -> ShowS | |
data ParentDetails a Source #
The details of a ResourceParent gathered for a flattened resource: the
parent's name, its path pieces, and the route attributes it contributes to
its descendants.
Since: 1.7.0.0
Constructors
| ParentDetails | |
Instances
| Show a => Show (ParentDetails a) Source # | |
Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> ParentDetails a -> ShowS show :: ParentDetails a -> String showList :: [ParentDetails a] -> ShowS | |
Route datatype type arguments
The type arguments of a route datatype, paired with the source Name each
was derived from. A monomorphic site like App has NoTyArgs; a
parameterized one like MySub subsite has SomeTyArgs.
Carrying the (non-)emptiness in the type — rather than as a bare list with a
separate null check — keeps "are there type args?" and "what are they?"
a single fact, so the populated branch hands you the NonEmpty directly.
Since: 1.7.0.0
Constructors
| NoTyArgs | |
| SomeTyArgs (NonEmpty (Type, Name)) |
toTyArgs :: [(Type, Name)] -> TyArgs Source #
Build TyArgs from a list of (type, source-name) pairs.
Since: 1.7.0.0
tyArgsList :: TyArgs -> [(Type, Name)] Source #
The type arguments as a plain list (empty for NoTyArgs).
Since: 1.7.0.0
tyArgsTypes :: TyArgs -> [Type] Source #
Just the Types of the arguments, in order.
Since: 1.7.0.0
tyArgsBinders :: TyArgs -> [Name] Source #
Just the source Names of the arguments, in order.
Since: 1.7.0.0
tyArgsArity :: TyArgs -> Int Source #
How many type arguments there are.
Since: 1.7.0.0
hasTyArgs :: TyArgs -> Bool Source #
Whether there are any type arguments (i.e. the site is parameterized).
Since: 1.7.0.0
applyTyArgs :: Type -> TyArgs -> Type Source #
Apply the type arguments to a head type (e.g. a route/subroute type
constructor), left to right. This replaces the ad-hoc
that recurred across the
generators.foldl' AppT con (fst <$> tyargs)
Since: 1.7.0.0
Helper functions
resourceMulti :: Resource typ -> Maybe typ Source #
resourceTreePieces :: ResourceTree typ -> [Piece typ] Source #
resourceTreeName :: ResourceTree typ -> String Source #
flatten :: [ResourceTree a] -> [FlatResource a] Source #