小部件位于单独的文件中

时间:2017-08-29 13:56:35

标签: haskell yesod

我已经使用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声明中的每一个。我尝试导入WidgetToWidget,导致下一个错误:

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堆栈模板。

提前致谢=)

0 个答案:

没有答案