yesod-core-1.6.26.0: 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 #

Constructors

Resource |

Fields

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

#### Instances

Instances details

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

data ResourceTree typ #

Constructors

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

#### Instances

Instances details

Functor ResourceTree # |
Instance details Defined in Yesod.Routes.TH.Types Methods fmap :: (a -> b) -> ResourceTree a -> ResourceTree b # (<$) :: a -> ResourceTree b -> ResourceTree a #
Lift typ => Lift (ResourceTree typ :: Type) # |
Instance details 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) # |
Instance details Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> ResourceTree typ -> ShowS # show :: ResourceTree typ -> String # showList :: [ResourceTree typ] -> ShowS #

data Piece typ #

Constructors

Static String |
Dynamic typ |

#### Instances

Instances details

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

data Dispatch typ #

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

type CheckOverlap = Bool #

data FlatResource a #

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) # |
Instance details Defined in Yesod.Routes.TH.Types Methods showsPrec :: Int -> FlatResource a -> ShowS # show :: FlatResource a -> String # showList :: [FlatResource a] -> ShowS #

## Helper functions

resourceMulti :: Resource typ -> Maybe typ #

resourceTreePieces :: ResourceTree typ -> [Piece typ] #

resourceTreeName :: ResourceTree typ -> String #

flatten :: [ResourceTree a] -> [FlatResource a] #