[web-devel] [Yesod] Abstracting permissions with Yesod

Michael Snoyman michael at snoyman.com
Sun Sep 9 13:40:38 CEST 2012


On Sun, Sep 9, 2012 at 2:15 PM, Arthur Clemens <arthurclemens at gmail.com> wrote:
> /admin AdminR:
>    /product/#ProductId AdminProductR GET POST
>    ...
>
>
> So if I have:
>
> /admin AdminR:
>     / AdminRootR GET
>     /categories AdminCategoriesR GET
>
> and the handlers are specified as:
>
> getAdminRootR :: Handler RepHtml
> getAdminRootR = do
>     ..
>
> getAdminCategoriesR :: Handler RepHtml
> getAdminCategoriesR = do
>     ..
>
> what more is needed to create links?
> Currently I use <a href=@{AdminRootR}> but that results in
>
> Handler/Admin.hs:14:22:
>     Not in scope: data constructor `AdminRootR'
>
> Arthur

You'll need the AdminR constructor: AdminR AdminRootR. If you use
-ddump-splices when compiling, GHC will spit out the generated
code/data types, which should give a good idea of what's going on
under the surface.

Michael



More information about the web-devel mailing list