I'm trying to define any simple function that spans multiple lines in ghci, take the following as an example:
let abs n | n >= 0 = n
| otherwise = -n
So far I've tried pressing Enter after the first line:
Prelude> let abs n | n >= 0 = n
Prelude> | otherwise = -n
<interactive>:1:0: parse error on input `|'
I've also attempted to use the :{
and :}
commands but I don't get far:
Prelude> :{
unknown command ':{'
use :? for help.
I'm using GHC Interactive version 6.6 for Haskell 98 on Linux, what am I missing?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…