[GHC] #13835: ghci with ":set +t" should print type before starting evaluation

#13835: ghci with ":set +t" should print type before starting evaluation -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: GHCi | Version: 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: -------------------------------------+------------------------------------- Not an actual bug, but questionable design perhaps. I think this is backwards, as static analysis comes before evaluation, not after: {{{ Prelude> :set +t Prelude> reverse [True] [True] it :: [Bool] }}} When evaluation raises an exception, no type is printed. {{{ Prelude> :set +t Prelude> True && undefined *** Exception: Prelude.undefined CallStack (from HasCallStack): error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err undefined, called at <interactive>:8:9 in interactive:Ghci4 }}} For teaching (and for my own sanity) I'd much prefer output in logical succession. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13835 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13835: ghci with ":set +t" should print type before starting evaluation -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 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 vanto): Hello,\\ If you write this, you have\\ {{{ Prelude> :set + t Prelude> let y = reverse [True] y :: [Bool] Prelude> y [True] it :: [Bool] Prelude> let z = True && undefined z :: Bool Prelude> z *** Exception: Prelude.undefined CallStack (from HasCallStack): error, called at libraries\base\GHC\Err.hs:79:14 in base:GHC.Err undefined, called at <interactive>:8:17 in interactive:Ghci6 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13835#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13835: ghci with ":set +t" should print type before starting evaluation -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 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 j.waldmann): Yes, that's a work-around. But it requires more typing, and the invention of an extra name. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13835#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13835: ghci with ":set +t" should print type before starting evaluation -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: GHCi | Version: 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 j.waldmann): Here is a somewhat longer explanation: With the current behaviour (print type after value), a naive user (student) thinks * 1. expression e has value v, and then * 2. value v has type t, suggesting that 1 is somehow a precondition for 2, and that a type is a property of a value. But the truth is * 1. expression e has type t, and then * 2. expression e has value v. This 1 //is// a precondition for 2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13835#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC