RE: log time instead of linear for case matching

2011-10-10 Thread Simon Peyton-Jones
Greg In GHC, big cases are done as tables (if dense) or trees (if sparse). If you have some examples where things go bad, do submit a bug report. For big dispatches on strings, I'm pretty sure we do something linear, top to bottom. I'd be strongly inclined to use a proper Map structure if

Re: log time instead of linear for case matching

2011-10-10 Thread Greg Weber
I thought it could be a nice GHC feature to optimize string lookup, and that using case arrows could be a nice syntax for creating maps. We will be fine using a Map. Making sure that sum types are optimized was the important thing, thanks! On Mon, Oct 10, 2011 at 1:14 AM, Simon Peyton-Jones

Re: log time instead of linear for case matching

2011-10-09 Thread Edward Z. Yang
Excerpts from Greg Weber's message of Sun Oct 09 12:39:03 -0400 2011: So first of all I am wondering if a sum type comparison does in fact scale linearly or if there are optimizations in place to make the lookup constant or logarithmic. Second, I as wondering (for the routing case) if Haskell