<div dir="ltr"><div>I once improved Seq-based code by changing them to lists. The improvement was about 10x in both memory and speed and all can be attributed to just constant factors.</div><div><br></div><div>When I saw the same error again above I can't help myself.<br></div><br></div><br><div class="gmail_quote"><div dir="ltr">сб, 8 дек. 2018 г. в 22:48, Ian Denhardt <<a href="mailto:ian@zenhack.net">ian@zenhack.net</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Quoting Serguey Zefirov (2018-12-08 09:33:35)<br>
> The list as usually constructed (head and tail) is a stack.<br>
<br>
This was my reaction as well; except for the over and under operations,<br>
everything in the file would have as-good or better asymptotic<br>
complexity as a simple list, and probably better constant factors too.<br>
The docs for Data.Sequence even say:<br>
<br>
> Note that sequences are typically slower than lists when using only<br>
> operations for which they have the same big-(O) complexity: sequences<br>
> make rather mediocre stacks!<br>
<br>
It would also likely be more readable to use a list, in that every<br>
Haskeller knows the list APIs, whereas Data.Sequence is less likely to<br>
be familiar.<br>
<br>
TBH, most cases where I would want a stack I wouldn't even bother with<br>
the extra layer of abstraction over lists -- I'd probably use the<br>
directly.<br>
<br>
You mention being unsatisfied with the existing libraries -- what was<br>
your use case?<br>
</blockquote></div>