The Show/Read combination is a tremendously easy way of serializing and deserializing the internal state of your application, and because of purity it basically always works too. Furthermore, you'll get good practice writing functions that slice and dice lists, since you'll be able to treat the list as if it is entirely loaded into memory (and maybe if you want to play with some more efficient data structures, you can look at ways to optimize different queries. ) For example, if I want to find all items that are due before some date, I can write this using a filter on due: dueBefore (ToDoList ts) d = ToDoList (filter (\t -> due t Created...) get dumped into the module-wide namespace, it's good style to prefix/suffix them with the name of the record, such as todoId, todoDie.In this particular case id is a real function, so you shouldn't shadow it!
ToDoList is a single constructor datatype with one value; you probably actually just want a newtype or type synonym.(Exercise: rewrite the above snippet to work with a type synonym. ) You probably want an Ord instance on Priority and Status.
The Show/Read combination is a tremendously easy way of serializing and deserializing the internal state of your application, and because of purity it basically always works too. Furthermore, you'll get good practice writing functions that slice and dice lists, since you'll be able to treat the list as if it is entirely loaded into memory (and maybe if you want to play with some more efficient data structures, you can look at ways to optimize different queries. ) For example, if I want to find all items that are due before some date, I can write this using a filter on due: dueBefore (ToDoList ts) d = ToDoList (filter (\t -> due t Created...) get dumped into the module-wide namespace, it's good style to prefix/suffix them with the name of the record, such as todoId, todoDie.In this particular case, id is a real function, so you shouldn't shadow it!
ToDoList is a single constructor datatype with one value; you probably actually just want a newtype or type synonym.(Exercise: rewrite the above snippet to work with a type synonym. ) You probably want an Ord instance on Priority and Status.
I've used binary search trees, heaps, and tries, but none of those seem to really apply here and I'm not sure where to look for guidance on a better option. – Pygmalion Dec 8 '10 at 2:37 For the realistic likely size of a todo list a flat list with various filters and sorts is all you need. However as a learning experience you might like to create a look-up table that keeps a list for each priority, for example.
See "Data. Map" and think about "Map Priority ToDoList" – Paul Johnson Dec 8 '10 at 6:28 See "sortBy" and the "comparing" function in Data.Ord. It lets you write things like "sortBy (comparing todoPriority) theList" – Paul Johnson Dec 8 '10 at 6:30.
I think that a flat file will make your like easier, and will work just as well, unless you have such a terrible backlog of work that you need a database to hold it all ;P I would recomend reading Learn You a Haskell, or at least, this chapter. It even contains a short TODO application similar to what you are trying to write. Now, you should have no problems writing and reading all your values to a file, so long as they all derive Show and Read.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.