我已经使用Widget
声明设置了几乎所有的HTML(大约250行代码),而且我的Main.hs文件对我来说有点大。很自然地,我尝试将整个窗口小部件业务移动到新的Widgets.hs
文件。
但是,Yesod不知何故拒绝让我。我得到的第一件事是
Widgets.hs:17:30: error:
Not in scope: type constructor or class ‘Widget’
Perhaps you meant one of these:
‘WidgetT’ (imported from Yesod), ‘ToWidget’ (imported from Yesod)
我的Widget
声明中的每一个。我尝试导入Widget
和ToWidget
,导致下一个错误:
Widgets.hs:11:1: error:
Failed to load interface for ‘Yesod.WidgetT’
Use -v to see a list of the files searched for.
Widgets.hs:12:1: error:
Failed to load interface for ‘Yesod.ToWidget’
Perhaps you meant Yesod.Core.Widget (from yesod-core-1.4.36)
Use -v to see a list of the files searched for.
Yesod书谈到Widget
只是一种类型的同义词:
type Widget = WidgetT MyApp IO ()
但我不知道这对我有什么帮助,或者从那里去哪里。我是否需要对.cabal
文件执行某些操作?我正在使用yesod-minimal堆栈模板。
提前致谢=)