[GHC] #12833: GHCi

#12833: GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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> }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12833 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12833: GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): Well the simple answer is because `let type A = Int` is not valid Haskell, and the same for your other examples. I suppose we could implement this, but it seems needless (when `:{` exists) and confusing (it is irregular, and presumably wouldn't be supported in a Haskell source file). (Also, the title of this ticket is not very good.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12833#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12833: GHCi -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by monoidal): * status: new => closed * resolution: => invalid Comment: I agree with [comment:1 comment:1]. In ghci, standalone "let" refers to "let" in do-notation, so current behavior is consistent. We could allow local type and pattern synonyms in let and where clauses, but this is ticketed as #4020. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12833#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC