Yesod.Routes.TH.Types

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

Safe Haskell | None
Language | Haskell98

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

Functor Resource # |
Methods fmap :: (a -> b) -> Resource a -> Resource b # (<$) :: a -> Resource b -> Resource a #
Show typ => Show (Resource typ) # |
Methods showsPrec :: Int -> Resource typ -> ShowS # show :: Resource typ -> String # showList :: [Resource typ] -> ShowS #
Lift t => Lift (Resource t) # |
Methods lift :: Resource t -> Q Exp #

data ResourceTree typ #

Constructors

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

Instances

Functor ResourceTree # |
Methods fmap :: (a -> b) -> ResourceTree a -> ResourceTree b # (<$) :: a -> ResourceTree b -> ResourceTree a #
Lift t => Lift (ResourceTree t) # |
Methods lift :: ResourceTree t -> Q Exp #

data Piece typ #

Constructors

Static String |
Dynamic typ |

Instances

Functor Piece # |
Methods fmap :: (a -> b) -> Piece a -> Piece b # (<$) :: a -> Piece b -> Piece a #
Show typ => Show (Piece typ) # |
Methods showsPrec :: Int -> Piece typ -> ShowS # show :: Piece typ -> String # showList :: [Piece typ] -> ShowS #
Lift t => Lift (Piece t) # |
Methods lift :: Piece t -> Q Exp #

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

Functor Dispatch # |
Methods fmap :: (a -> b) -> Dispatch a -> Dispatch b # (<$) :: a -> Dispatch b -> Dispatch a #
Show typ => Show (Dispatch typ) # |
Methods showsPrec :: Int -> Dispatch typ -> ShowS # show :: Dispatch typ -> String # showList :: [Dispatch typ] -> ShowS #
Lift t => Lift (Dispatch t) # |
Methods lift :: Dispatch t -> Q Exp #

type CheckOverlap = Bool #

data FlatResource a #

Constructors

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

## Helper functions

resourceMulti :: Resource typ -> Maybe typ #

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

resourceTreeName :: ResourceTree typ -> String #

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