#4191: Replace -fstrict-dicts with programmer-custom strictness annotations for
class contexts
---------------------------------+------------------------------------------
    Reporter:  LouisWasserman    |        Owner:              
        Type:  feature request   |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  6.12.3      
    Keywords:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Testcase:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by LouisWasserman):

 Here's what I imagine should happen when I have a stack of dictionaries,
 each depending on the next.  (Let's assume for the moment that there are
 no cycles, or at least, that we have chosen to break the cycle at some
 particular point.)

 (By stack of dictionaries, I mean "in the Core expression that generates
 the dictionary, I have a stack of functions of the form f (g (h (...))),
 or something of the sort -- you get the idea.)

 I'm working on a generalized trie library, and I'm getting non-recursive
 dictionary stacks of size 30 when I try to auto-generate trie instances,
 and even by hand I get monstrosities like
              Maybe `O` Either ((,) Word `App` Bs a)
                 `O` (K0 Word :*: K0 Word :*: I0 :*: I0)

 That type requires 17 dictionaries -- pretty much one for each token in
 that string -- and as it stands, I essentially have to rebuild each of
 them in order to perform any method at all.  Normally, I think this sort
 of thing would be done with specialization, but that's not applicable
 here, given the range of possible iterations.

 A simple solution would be to desugar (instance context => Foo a) as
 forcing the dictionaries in the context, modulo dependency loops.  That
 way, the dictionaries get built exactly once and never again, reducing the
 overhead significantly.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4191#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to