
#9872: Runing type functions is too slow -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by goldfire): In thinking about this issue, the Right Way to get type families to be faster is to optimize them properly. By this, I mean taking the type family definitions and performing an optimization pass on them during type-checking/desugaring. We've essentially just implemented a tiny interpreter inside of !TcFlatten, and the whole thing could be more principled in approach. I'm not making a concrete proposal, just musing on the fact that we have here a classic problem -- how to write a fast interpreter for a given programming language. It just happens to be the language of type families. I suppose there is a body of research and experience on this very issue, and if we want to be serious about fast compilation times in the presence of heavy type-level computation, it would do well to use that body of knowledge. In any case, I'm done dwelling on performance for a while, but I'm quite pleased with my end result. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9872#comment:25 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler