1
我有這樣的常用目錄結構簡單耶索德項目:目錄結構耶索德和堆棧
./Main.hs
./Foundation.hs
./Handler/Home.hs
./Handler/... etc
./config/routes
./templates/home.hamlet
./templates/default-layout.hamlet
./templates/default-layout-wrapper.hamlet
./templates/default-layout-wrapper.cassius
...
我想建立這個項目組,其中典型的Main.hs
程序是app
目錄下。
我試圖將所有的Yesod結構放在app
目錄下(app
目錄是上面的.
)。
項目的小集團文件看起來像這樣:
executable proj-web01-exe
hs-source-dirs: app
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base, bytestring, split, filepath
, stm, data-default, text, conduit, conduit-extra
, containers, resourcet, blaze-html, blaze-markup
, shakespeare, yesod, yesod-static
, proj-web01
default-language: Haskell2010
現在,當我嘗試stack build
,我收到以下錯誤信息:
[1 of 6] Compiling Foundation (app/Foundation.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/proj-web01-exe/proj-web01-exe-tmp/Foundation.o)
/home/me/proj-web01/app/Foundation.hs:46:35:
Exception when trying to run compile-time code:
Called widgetFileNoReload on "default-layout", but no templates were found.
Code: widgetFileNoReload (def) "default-layout"
In the splice: $(widgetFileNoReload def "default-layout")
-- While building package proj-web01-0.1.0.0 using:
/home/me/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build lib:proj-web01 exe:proj-web01-exe --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
widgetFileNoReload
不知道在哪裏可以找到「默認-layout「文件,位於app/templates
目錄中。
我的問題:我應該以不同的方式編寫cabal文件,還是應該將模板,Handler ...文件夾放置在別處(例如在src中)?什麼是使用堆棧時最自然的目錄結構?或者,如何設置堆棧參數(cabal和yaml文件)以適應通常的Yesod目錄結構?