[GHC] #13035: GHC enters a loop when partial type signatures and advanced type level code mix
GHC
ghc-devs at haskell.org
Tue Dec 27 16:45:44 UTC 2016
#13035: GHC enters a loop when partial type signatures and advanced type level code
mix
-------------------------------------+-------------------------------------
Reporter: xcmw | Owner:
Type: bug | 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 RyanGlScott):
FWIW, I don't think this is causing the typechecker to loop, but rather it
causes it to take an extremely long time to complete. I discovered this by
trying to minimize the test case by commenting some lines in the
definition of `RecipeT`:
{{{#!hs
type RecipeT
= Name =: String
$ Author =: String
{-
$ Image =: String
$ Description =: String
$ CookTime =: Maybe Int
$ PrepTime =: Maybe Int
$ TotalTime =: Maybe Int
$ Yield =: String
-}
$ Nutrition =: NutritionRec
{-
$ Tags =: [String]
$ Url =: String
-}
$ GNone
}}}
When I compiled this, it lagged noticeably, but it completed in finite
time:
{{{
$ time /opt/ghc/8.0.1/bin/ghc -fforce-recomp Wat.hs[1 of 1] Compiling Wat
( Wat.hs, Wat.o )
Wat.hs:140:28: warning: [-Wpartial-type-signatures]
• Found type wildcard ‘_’ standing for ‘'['Author]’
• In the type signature:
g :: MyRec RecipeFormatter _
• Relevant bindings include
g :: MyRec RecipeFormatter '['Author] (bound at Wat.hs:141:1)
real 0m1.973s
user 0m1.940s
sys 0m0.028s
}}}
I then uncommented one more line (`Image := String`):
{{{#!hs
type RecipeT
= Name =: String
$ Author =: String
$ Image =: String
{-
$ Description =: String
$ CookTime =: Maybe Int
$ PrepTime =: Maybe Int
$ TotalTime =: Maybe Int
$ Yield =: String
-}
$ Nutrition =: NutritionRec
{-
$ Tags =: [String]
$ Url =: String
-}
$ GNone
}}}
And that contributed to the compilation time significantly (almost
doubling it):
{{{
$ time /opt/ghc/8.0.1/bin/ghc -fforce-recomp Wat.hs[1 of 1] Compiling Wat
( Wat.hs, Wat.o )
Wat.hs:140:28: warning: [-Wpartial-type-signatures]
• Found type wildcard ‘_’ standing for ‘'['Author]’
• In the type signature:
g :: MyRec RecipeFormatter _
• Relevant bindings include
g :: MyRec RecipeFormatter '['Author] (bound at Wat.hs:141:1)
real 0m3.635s
user 0m3.564s
sys 0m0.068s
}}}
Similarly, uncommented out more and more lines seems to approximately
double the compilation time for each line.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13035#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list