[GHC] #11197: Overeager deferred type errors
GHC
ghc-devs at haskell.org
Fri May 18 13:18:26 UTC 2018
#11197: Overeager deferred type errors
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: goldfire
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler (Type | Version: 7.11
checker) |
Resolution: | Keywords: TypeInType
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 simonpj):
Here's what is happening. In the former case we get
{{{
main
= let {
$dNum_a1d8 :: Num String
[LclId]
$dNum_a1d8 = Control.Exception.Base.typeError
@ 'GHC.Types.LiftedRep @ (Num String) "blah blah
blah
} in
let {
$dMonad_axl :: Monad IO
[LclId]
$dMonad_axl = GHC.Base.$fMonadIO } in
letrec {
main_a1da :: IO ()
[LclId]
main_a1da
= >>
@ IO
$dMonad_axl
@ ()
@ ()
(putStrLn (GHC.CString.unpackCString# "Hi there."#))
(putStrLn (fromInteger @ String $dNum_a1d8 1)); } in
main_a1da
}}}
and the binding for `dNum_a1d8` can float inwards/be inlined. In the
latter case we get
{{{
main
= case Control.Exception.Base.typeError
@ ('GHC.Types.TupleRep '[])
@ ((Bool :: *) GHC.Prim.~# ([Char] :: *))
"blah blah blah"
of co_a11b
{ __DEFAULT ->
>>
@ IO
GHC.Base.$fMonadIO
@ ()
@ ()
(putStrLn (GHC.CString.unpackCString# "Hi there."#))
(putStrLn
(GHC.Types.True
`cast` (Sub co_a11b :: (Bool :: *) ~R# ([Char] :: *))))
}
}}}
and the simplifier does not float in arbitrary case-expressions, for fear
of changing
error/termination behaviour.
What do to? All I can think of is to make a special case for coercions,
and be willing
to float them in, on the grounds that evidence bindings are added by the
compiler and
should have as narrow scope as possible. Any objections?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11197#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list