GHCi
In multiline mode you can define a multi-line Haskell function:
Prelude> :set +m
Prelude> let
Prelude| f :: Int -> Int
Prelude| f 0 = 0
Prelude| f n = n - 1
Prelude|
Prelude>
Is there a reason why it couldn't work with other things like
Prelude> :set -XPatternSynonyms
Prelude> let
Prelude| pattern A = 'A'
Prelude|
<interactive>:27:1: error:
Illegal pattern synonym declaration for ‘A’
Pattern synonym declarations are only valid at top level
Prelude> let
Prelude| data A
Prelude| = B
Prelude| | C Int
Prelude|
<interactive>:30:1: error:
parse error (possibly incorrect indentation or mismatched brackets)
Prelude> let
Prelude| type A = Int
Prelude|
<interactive>:48:1: error:
parse error (possibly incorrect indentation or mismatched brackets)
couldn't work, similar to how they work with :{
and :}
:
Prelude> :{
Prelude| data A
Prelude| = B
Prelude| | C Int
Prelude| :}
Prelude>
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |