yesod-core-1.6.28.1: Creation of type-safe, RESTful web applications.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Yesod.Routes.TH.Types

Contents

- Data types
  - Helper functions

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 [Piece typ] [ResourceTree typ]
- data Piece typ
  - = Static String
  - | Dynamic typ
- data Dispatch typ
  - = Methods {
    - methodsMulti :: Maybe typ
    - methodsMethods :: [String]
    }
  - | Subsite {
    - subsiteType :: typ
    - subsiteFunc :: String
    }
- type CheckOverlap = Bool
- data FlatResource a = FlatResource {
  - frParentPieces :: [(String, [Piece a])]
  - frName :: String
  - frPieces :: [Piece a]
  - frDispatch :: Dispatch a
  - frCheck :: Bool
  }
- resourceMulti :: Resource typ -> Maybe typ
- resourceTreePieces :: ResourceTree typ -> [Piece typ]
- resourceTreeName :: ResourceTree typ -> String
- flatten :: [ResourceTree a] -> [FlatResource a]

# Data types

data Resource typ Source #

Constructors

Resource |

Fields

- resourceName :: String
- resourcePieces :: [Piece typ]
- resourceDispatch :: Dispatch typ
- resourceAttrs :: [String]
- resourceCheck :: CheckOverlap

#### Instances

Instances details

Functor Resource Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods fmap :: (a -> b) -> Resource a -> Resource b Source # (<$) :: a -> Resource b -> Resource a Source #
Lift typ => Lift (Resource typ :: Type) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods lift :: Quote m => Resource typ -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Resource typ -> Code m (Resource typ) Source #
Show typ => Show (Resource typ) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> Resource typ -> ShowS Source # show :: Resource typ -> String Source # showList :: [Resource typ] -> ShowS Source #

data ResourceTree typ Source #

Constructors

ResourceLeaf (Resource typ) |
ResourceParent String CheckOverlap [Piece typ] [ResourceTree typ] |

#### Instances

Instances details

Functor ResourceTree Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods fmap :: (a -> b) -> ResourceTree a -> ResourceTree b Source # (<$) :: a -> ResourceTree b -> ResourceTree a Source #
Lift typ => Lift (ResourceTree typ :: Type) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods lift :: Quote m => ResourceTree typ -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => ResourceTree typ -> Code m (ResourceTree typ) Source #
Show typ => Show (ResourceTree typ) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> ResourceTree typ -> ShowS Source # show :: ResourceTree typ -> String Source # showList :: [ResourceTree typ] -> ShowS Source #

data Piece typ Source #

Constructors

Static String |
Dynamic typ |

#### Instances

Instances details

Functor Piece Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods fmap :: (a -> b) -> Piece a -> Piece b Source # (<$) :: a -> Piece b -> Piece a Source #
Lift typ => Lift (Piece typ :: Type) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods lift :: Quote m => Piece typ -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Piece typ -> Code m (Piece typ) Source #
Show typ => Show (Piece typ) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> Piece typ -> ShowS Source # show :: Piece typ -> String Source # showList :: [Piece typ] -> ShowS Source #

data Dispatch typ Source #

Constructors

Methods |

Fields

- methodsMulti :: Maybe typ

  type of the multi piece at the end

- methodsMethods :: [String]

  supported request methods

Subsite |

Fields

- subsiteType :: typ
- subsiteFunc :: String

#### Instances

Instances details

Functor Dispatch Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods fmap :: (a -> b) -> Dispatch a -> Dispatch b Source # (<$) :: a -> Dispatch b -> Dispatch a Source #
Lift typ => Lift (Dispatch typ :: Type) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods lift :: Quote m => Dispatch typ -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Dispatch typ -> Code m (Dispatch typ) Source #
Show typ => Show (Dispatch typ) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> Dispatch typ -> ShowS Source # show :: Dispatch typ -> String Source # showList :: [Dispatch typ] -> ShowS Source #

type CheckOverlap = Bool Source #

data FlatResource a Source #

Constructors

FlatResource |

Fields

- frParentPieces :: [(String, [Piece a])]
- frName :: String
- frPieces :: [Piece a]
- frDispatch :: Dispatch a
- frCheck :: Bool

#### Instances

Instances details

Show a => Show (FlatResource a) Source # |
Instance details Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> FlatResource a -> ShowS Source # show :: FlatResource a -> String Source # showList :: [FlatResource a] -> ShowS Source #

## 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 #