Haskell倍数,如果不是
您好,我正在尝试使用叠瓦条件,但我发现解析错误:Haskell倍数,如果不是,haskell,Haskell,您好,我正在尝试使用叠瓦条件,但我发现解析错误: parse error on input ‘|’ isAssignMent::String->Bool isAssignMent a | a == "" = False | otherwise | (head trimmed) == '=' = True | otherwise = False where trimmed = trimRightSid
parse error on input ‘|’
isAssignMent::String->Bool
isAssignMent a
| a == "" = False
| otherwise
| (head trimmed) == '=' = True
| otherwise = False
where
trimmed = trimRightSide a [' ', '\n']
我做错了什么?谢谢你这是你想要的吗
isAssignMent::String->Bool
isAssignMent a
| a == "" = False
| (head trimmed) == '=' = True
| otherwise = False
where
trimmed = trimRightSide a [' ', '\n']
按顺序检查保护子句。你只需要在末尾加一个否则
子句。这就是你想要的吗
isAssignMent::String->Bool
isAssignMent a
| a == "" = False
| (head trimmed) == '=' = True
| otherwise = False
where
trimmed = trimRightSide a [' ', '\n']
按顺序检查保护子句。您只需要在结尾处添加一个
或子句。您还可以使用模式匹配更习惯地编写此语句:
isAssignMent::String->Bool
isAssignMent "" = False
isAssignMent a
| '=':_ <- trimmed = True
| otherwise = False
where
trimmed = trimRightSide a [' ', '\n']
isAssignMent::String->Bool
isAssignMent“”=错误
分配a
|“=”:您还可以使用模式匹配更习惯地编写:
isAssignMent::String->Bool
isAssignMent "" = False
isAssignMent a
| '=':_ <- trimmed = True
| otherwise = False
where
trimmed = trimRightSide a [' ', '\n']
isAssignMent::String->Bool
isAssignMent“”=错误
分配a
|“=”:(否则
只是真的同义词
否则
只是真的同义词