Interesting idea Neil. Roman: I think you only need deep specialisation on non-recursive constructors, don't you?
Simon | -----Original Message----- | From: Mitchell, Neil [mailto:[EMAIL PROTECTED] | Sent: 15 September 2008 17:51 | To: Simon Peyton-Jones; [email protected] | Cc: Roman Leshchinskiy | Subject: RE: too many specialisations for one function | | > OK I have this figured out. Consider this (from | > haddock/src/Haddock/Backends/Hoogle.hs): | > | > dropComment (' ':'-':'-':' ':_) = [] | > dropComment (x:xs) = x : dropComment xs | > dropComment [] = [] | > | > This desugars thus: | > | > dropComment xs | > = case xs of | > (C# x1 : xs1) -> | > case x1 of | > ' '# -> | > case xs1 of | > (C# x2:xs2) -> | > case x2 of | > '-' -> .... | > DEFAULT -> dropComment (C# x2 : xs2) | > DEFAULT -> ... | > [] -> ... | | One possible heuristic would be to never specialise down recursive | components. That way you would only ever obtain the specialisations: | | [] | _:_ | ' ':_ | '-':_ | | Which seems like a sensible set. By using a size bound as well, your | definition of recursive components can be very weak - directly recursive | should catch most examples. I'm not sure how this work with other | examples - it seems sufficient for the classic 'last' example though. | | Thanks | | Neil | | ============================================================================== | Please access the attached hyperlink for an important electronic communications disclaimer: | | http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html | ============================================================================== | _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
