[GHC] #11994: ghci not applying defaulting when showing type
GHC
ghc-devs at haskell.org
Thu Apr 28 16:20:59 UTC 2016
#11994: ghci not applying defaulting when showing type
-------------------------------------+-------------------------------------
Reporter: j.waldmann | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 7.10.3
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 aavogt):
You could (ab)use do notation to get the defaulted type:
{{{
> :set +t
Prelude> x <- return $ 1+1
x :: Integer
}}}
The `it` variable is actually generalized, so the reported type is right.
After all this works:
{{{
Prelude> :set +t
Prelude> 1+1
2
it :: Num a => a
Prelude> (it :: Int, it :: Double)
(2,2.0)
it :: (Int, Double)
}}}
`-XMonoLocalBinds` keeps let from being generalized in files (ie. `let x =
1 in (x::Int,x::Integer)` becomes a type error), so I thought it might
make a difference with respect to generalizing `it`. But it has no effect
in ghci, not even for the `let x = ...` expression above. At least Richard
Eisenberg seems to have said that `MonoLocalBinds` is irrelevant for ghci
in a slightly different scenario: <https://mail.haskell.org/pipermail/ghc-
devs/2015-August/009636.html>).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11994#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list