在GHCi中,如何键入在函数定义之外使用的保护方程式?
我什么时候不能
Prelude> c | False == True = 0 | otherwise = 1
<interactive>:28:26: error:
• Could not deduce (Num Bool) arising from a use of ‘otherwise’
from the context: Num t
bound by the inferred type of c :: Num t => t
at <interactive>:28:1-38
• In the expression: otherwise
In a stmt of a pattern guard for
an equation for ‘c’:
otherwise
In an equation for ‘c’:
c | False == True = 0
| otherwise = 1
Prelude> c | False == True = 0 |
<interactive>:29:25: error:
parse error (possibly incorrect indentation or mismatched brackets)
和
Prelude> c | False == True = 0
Prelude> | otherwise = 1
<interactive>:31:13: error: parse error on input ‘|’
谢谢。