Ticket #7253 (new feature request)
Top-level bindings in ghci
| Reported by: | Feuerbach | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.8.1 |
| Component: | GHCi | Version: | 7.6.1 |
| Keywords: | Cc: | roma@…, patrick@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Other | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
ghci now supports most of the declarations. However, it doesn't support the most basic and common type of declaraion — pattern and function bindings!
E.g.
Prelude> a = 1 <interactive>:2:3: parse error on input `='
I realise that, if implemented, they would have somewhat different semantics than in Haskell modules — e.g. with respect to recursion.
But even if they behaved in the same way as top-level monadic let-bindings, they would still be very useful for two reasons:
1. If you're doing quick experiments in ghci, "let a=1" is more than twice as long as "a=1", and that makes a difference.
2. Novices are often confused when they are told that they have to use one syntax for definitions in modules and another in ghci.
