<div dir="ltr"><div><div><div><div><div><div>First, make statement structure richer. Instead of just String, make its' parameter a list of something like this:<br></div>data SExpr = Underscore | Word String<br><br></div><div>and Stmt thus:<br></div><div>data Stmt = Stmt [SExpr]<br></div><div><br></div>This way it is easier to construct and/or combine.<br><br></div>Second, make graph operations to operate on bulk of data. Singleton data is a special case of bulk data and bulk operations are much more efficient in general.<br><br></div>So instead of <span class="">addRelIdxToNode</span> <span class="">::</span> <span class="">RelIdx</span> <span class="">-></span> <span class="">Node</span> <span class="">-></span> <span class="">Node create something like </span><span class="">addRelIdxToNodes</span> <span class="">::</span> <span class="">RelIdx</span> <span class="">-></span> [<span class="">Node</span>] <span class="">-></span> [<span class="">Node] (use your collection of choice instead of lists).<br><br></span></div><span class="">This will pay rather quickly (in terms of performance and brevity).<br><br></span></div><div><span class="">Those are my two humble suggestions.<br></span></div><span class=""></span><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-07-17 9:19 GMT+03:00 Jeffrey Brown <span dir="ltr"><<a href="mailto:jeffbrown.the@gmail.com" target="_blank">jeffbrown.the@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I'm writing a graph class that generalizes the traditional mathematical graph: Nodes can be statements or relationships, and relationships ("edges") can involve any number of nodes, including other relationships. [1] describes the motivation in a little more detail.</div><div><br></div><div>[2] explains the idea behind the major types -- Graph, Node, Stmt, and Rel.</div><div><br></div><div>Of the .hs files in the project, at this time I believe only the primary one, Dwt.hs [3], deserves your attention.  It is only about 100 lines of code.</div><div><br></div><div>I am interested in any kind of feedback at all, no matter how minute in detail or expansive in scope.</div><div><br></div><div>[4] lists what I already think might be likely problems and solutions. In particular I wonder whether I should interpret these two patterns:</div><div>  "case ni of Rel -> .. Stmt -> .."</div><div>and </div><div>  "if (Maybe.isJust nMb) ... else error ..."</div><div>as signs that I'm not completely solving the problem. </div><div><br></div><div>I suspect it might be helpful to make the graph operations Maybe or Either, and use <|> on them -- but while I can monkey those words, I don't really know what I'm saying.</div><div><br></div><div>[1] <a href="https://github.com/JeffreyBenjaminBrown/digraphs-with-text/blob/master/english/motivation.txt" target="_blank">https://github.com/JeffreyBenjaminBrown/digraphs-with-text/blob/master/english/motivation.txt</a></div><div>[2] <a href="https://github.com/JeffreyBenjaminBrown/digraphs-with-text/blob/master/english/how_it_works.txt" target="_blank">https://github.com/JeffreyBenjaminBrown/digraphs-with-text/blob/master/english/how_it_works.txt</a></div><div>[3] <a href="https://github.com/JeffreyBenjaminBrown/digraphs-with-text/blob/master/src/Dwt.hs" target="_blank">https://github.com/JeffreyBenjaminBrown/digraphs-with-text/blob/master/src/Dwt.hs</a></div><div>[4] <a href="https://github.com/JeffreyBenjaminBrown/digraphs-with-text/blob/master/english/todo%2Cmaybe.txt" target="_blank">https://github.com/JeffreyBenjaminBrown/digraphs-with-text/blob/master/english/todo%2Cmaybe.txt</a></div><div><br></div><div>Thank you,</div><div>Jeff</div></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>