Re: Bikeshedding request for GHCi's :type

.. :type should report the real type
What about defaulting? Is it real? https://ghc.haskell.org/trac/ghc/ticket/11994 - J.W.

Currently GHCi shows the "real" type of an expression (i.e., the inferred generalized type), when you ask it: Prelude> :t 1 1 :: Num a => a Note that there is no defaulting happening, at least at the top level---of course if there were local things that needed to be defaulted while the expression was being type-checked then those would be defaulted. If you ask GHCi to *evaluate* a polymorphic expression, then it will try to default the type when it is figuring out how to show the result. The alternative would be to say "sorry, I can't evaluate this, because it is polymorphic, so please tell me what type do you mean". This is probably a bit too inconvenient for practical use. -Iavor On Thu, Apr 28, 2016 at 5:24 AM, Johannes Waldmann < johannes.waldmann@htwk-leipzig.de> wrote:
.. :type should report the real type
What about defaulting? Is it real? https://ghc.haskell.org/trac/ghc/ticket/11994
- J.W. _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Hi,
If you ask GHCi to *evaluate* a polymorphic expression, then it will ...
Sure, I understand the motivation for defaulting, and I am not suggesting to change anything there. What I am saying is that I see no way to have ghci show * the defaulted type, * or the even the fact that defaulting did happen. - J.

Hi, Part of what you would like is already there. If you run ghci with -Wall, you will get warnings about defaulting polymorphic expressions. ``` Prelude> 1 <interactive>:2:1: Warning: Defaulting the following constraint(s) to type ‘Integer’ (Num a0) arising from a use of ‘it’ at <interactive>:2:1 (Show a0) arising from a use of ‘print’ at <interactive>:2:1 In the first argument of ‘print’, namely ‘it’ In a stmt of an interactive GHCi command: print it 1 Prelude> ``` --trevor On Thu, Apr 28, 2016 at 8:05 AM Johannes Waldmann < johannes.waldmann@htwk-leipzig.de> wrote:
Hi,
If you ask GHCi to *evaluate* a polymorphic expression, then it will ...
Sure, I understand the motivation for defaulting, and I am not suggesting to change anything there.
What I am saying is that I see no way to have ghci show * the defaulted type, * or the even the fact that defaulting did happen.
- J.
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (3)
-
Iavor Diatchki
-
Johannes Waldmann
-
Trevor Elliott