<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-06-29 16:22 GMT+02:00 Silent Leaf <span dir="ltr"><<a href="mailto:silent.leaf0@gmail.com" target="_blank">silent.leaf0@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">hi,<div><br></div><div>what is your personal practice of ordering data/functions/main/hidden functions, etc in a haskell file? like all trivial things they are very hard to decide upon, given that either order of helpers then main function / value, or the other way round, has tempting pros and cons.</div><div><br></div><div>thanks in advance for your opinion!</div></div>
<br></blockquote><div><br></div><div>I've started trying to write my program in a way that makes sense as when reading it from top to bottom, like a story.</div><div>So if you write a function that calls upon other functions, those functions can come immediately afterwards, if they're relevant, or if their names are enough, they could be put in a different file altogether.</div><div>Some functions are bigger, like stories of their own. In those cases I generally put them in a new file, like a new chapter. Those should be coherent in themselves, and not depend on the first file in order to make sense. If chapters are dependent on each other in that way, then maybe they have to be rewritten.</div><div><br></div><div>This is a really course generalization, and I've actually not written code like this for long. But I do think writing code in a way that makes sense as a human reader is important, and humans tend to enjoy reading stories. It doesn't really have to be some sort of magical journey (though it very well could be!), but I think there should be some sort of red thread that goes from one place in the code to the next, without extreme leaps that are hard to understand.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div></div>