[web-devel] [Yesod] Abstracting permissions with Yesod
Michael Snoyman
michael at snoyman.com
Mon Sep 10 11:54:25 CEST 2012
On Mon, Sep 10, 2012 at 9:56 AM, Michael Snoyman <michael at snoyman.com>wrote:
>
>
> On Sun, Sep 9, 2012 at 5:48 PM, Arthur Clemens <arthurclemens at gmail.com>wrote:
>
>> You'll need the AdminR constructor: AdminR AdminRootR.
>>
>>
>> It doesn't work in the scaffolded site, whereas it works as expected in a
>> single file site like
>> https://github.com/yesodweb/yesod/wiki/Hierarchical-routes-and-breadcrumbs
>>
>> I created a new scaffolded site, used add-handler to create
>> Handler/Admin.hs, and changed the route in config/routes to
>>
>> /admin AdminR:
>> / AdminRootR GET
>>
>> yesod devel results in Application.hs:27:1: Not in scope: data
>> constructor `AdminRootR'
>>
>> changing that to
>>
>> /admin AdminRootR GET
>>
>> runs without errors.
>>
>>
>>
> Just to confirm: does your `cabal` file state Yesod version 1.0 or 1.1?
>
>
>> Actually, I bet I know what the problem is: the export list in
Foundation.hs doesn't include the AdminR datatype. Try adding:
AdminR (..)
> 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.
>>
>>
>> I can't, it results in
>>
>> Import.hs:10:2: lexical error at character 'i'
>>
>> Using ghc -cpp -ddump-splices main.hs
>>
>> results in Model.hs:13:1: Parse error: naked expression at top level
>>
>> Arthur
>>
>>
> Sorry, I should have clarified: you can do something like:
>
> cabal configure --ghc-option=-ddump-splices
>
> Then `cabal build` will pass in that option. You get the "naked
> expression" error because TemplateHaskell isn't enabled.
>
> Michael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20120910/f00619b5/attachment.htm>
More information about the web-devel
mailing list