【问题标题】:parse error on input `{' in haskell yesod framework在haskell yesod框架中输入“{”解析错误
【发布时间】:2019-02-25 19:09:04
【问题描述】:

我不明白为什么会发生这个错误
我已经使用 stack 命令创建了 yesod-sqlite 项目,按照创建后 yesod 快速启动中的说明进行操作,它工作正常。但我想按照this 示例中的说明和示例添加我的页面

Echo.hs 处理程序代码如下:

模块Handler.Echo在哪里

import Import
import           Data.Text (Text)
import qualified Data.Text as T
import           Yesod

getEchoR :: Text -> Handler Html
getEchoR theText = defaultLayout [whamlet|<h1>Hello #{theText}!|]

当我在命令提示符下运行 yesod devel 时,出现以下错误:

E:\haskell\yesod-new\src\Handler\Echo.hs:9:58:错误:解析错误 输入'{' | 9 | getEchoR theText = defaultLayout [whamlet|你好#{theText}!|] |
^

-- 在为包 yesod-new-0.0.0 构建自定义 Setup.hs 时,使用: C:\Users\RajeshTarle\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\ Cabal-simple_Z6RU0evB_2.2.0.1_ghc-8.4.3.exe --builddir=.stack-work\dist\7d103d30 构建库:yesod-new --ghc-options "-ddump-hi -ddump-to-file" 进程以代码退出:ExitFailure 1 键入可用命令的帮助。按 enter 强制重建。

我正在使用 Windows,请帮助我。 谢谢。

【问题讨论】:

    标签: haskell yesod


    【解决方案1】:

    将以下内容放在文件顶部:

    {-# LANGUAGE QuasiQuotes #-}
    

    https://wiki.haskell.org/Quasiquotation

    【讨论】:

    • @Rajesh 太好了,请随时接受答案:)
    猜你喜欢
    • 2013-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-07
    • 2014-09-18
    • 2013-05-28
    • 2016-01-11
    相关资源
    最近更新 更多