<div dir="ltr"><div><div><div><div>Hello All,<br><br></div>I am just getting myself to code in Haskell and would like to design advice.  Below, I have a made up example:<br>                                                                                                                                                                                                                                                            <br>                                                                                                                                                                                                                                                                                  <br>data ClassRoom = ClassRoom { classRoomNo:: Integer, extra_fees::Float, students: Map StudentId Student}<br>data Student = Student {name::String, feesOwed::Float}<br>data StudentId = Integer                                                                                                                                                                                                                                                          <br>                                                                                                                                                                                                                                                                                  <br>get_fees_owed classroom student_id = extra_fees + feesOwed $ (students classroom) M.! studentid                                                                                                                                                                        <br><br>Here the `get_fees_owed`  needs information from the container 'classroom'.  <br><br></div><div>Here is my question/problem:<br>                                                                                                   <br></div><div>I believe I should model most of my code as expressions, rather than storing pre-computed values such as `fees_owed`.  But, <br>defining expressions involve passing the container objects all over. For example, deep down in a function that deals with just<br></div><div>one `student`, I might need the fees owed information. Without, having a reference to the container, I cannot call get_fees_owed.<br><br></div><div>Also, I think it hinders composing of functions that just deal with one student at a time, but end up with some dependency on<br></div><div>the container.<br><br></div>I have several questions related to this design hurdle, but I will start with the one above.<br><br></div>Thanks!<br></div>Guru<br><br><div><div><div><div><br></div></div></div></div></div>