use AForm in a subsite Yesod

155 Views Asked by At

I want create a subsite to all CRUD operation in my project, I have the following code

{-# LANGUAGE FlexibleInstances     #-}

module Demo (
   module Demo.Data,
   module Demo
   )where

import Data.Maybe   (Maybe)


import Demo.Data
import Yesod
import Prelude (IO,($))

import Model
import Crud.FormsC


getDemoNewR :: Yesod master => HandlerT YesodDemo (HandlerT master IO) Html
getDemoNewR = do 
           (widget, encoding) <- generateFormPost $ renderBootstrap3 BootstrapBasicForm $ demoForm  Nothing
           defaultLayout $ do                        
                $(widgetFile "Exam/createExam") 

but have this error Not in scope: type constructor or class ‘Handler’

I can't import the Foundation because generate a cycle reference because I have a import Demo in my Foundation.hs

import Demo
import Demo.Data 

data App = App
{ appSettings    :: AppSettings
, appStatic      :: Static -- ^ Settings for static file serving.
, appConnPool    :: ConnectionPool -- ^ Database connection pool.
, appHttpManager :: Manager
, appLogger      :: Logger
, getDemo        :: YesodDemo
}

so what have import to use Handler o how I create a subSite?

1

There are 1 best solutions below

0
On

When you are in a SubSite use (HandlerT master IO)