Haskell 记录语法“输入上的分析错误‘=’`
我的YesSOD测试中有一个do块,我想用预期的响应测试响应 我试图在此do块中创建预期的响应Haskell 记录语法“输入上的分析错误‘=’`,haskell,Haskell,我的YesSOD测试中有一个do块,我想用预期的响应测试响应 我试图在此do块中创建预期的响应 let expectedUser = User [authorized = true, ident = "AdminUser", displayName = Nothing, id = 1, avatar = Nothing] 在这条线上我得到了错误 parse error on input ‘=’ Perhaps you need a 'let' in a 'do' block? 在=经过授权后
let expectedUser = User [authorized = true, ident = "AdminUser", displayName = Nothing, id = 1, avatar = Nothing]
在这条线上我得到了错误
parse error on input ‘=’
Perhaps you need a 'let' in a 'do' block?
在=经过
授权后
。如何重写这一行,使其在do块中工作?编译错误中得到的建议基本上是无关的,因为解析器根本不知道您在这里要做什么。记录语法使用大括号{
和}
,而不是[
和]
。所以它应该看起来像:
let expectedUser = User {authorized = true, ident = "AdminUser", displayName = Nothing, id = 1, avatar = Nothing}
我会建议一些换行:)
您在编译错误中得到的建议基本上是不相关的,因为解析器实际上不知道您在这里要做什么。记录语法使用大括号
{
和}
,而不是[
和]
。所以它应该看起来像:
let expectedUser = User {authorized = true, ident = "AdminUser", displayName = Nothing, id = 1, avatar = Nothing}
我会建议一些换行:)