Levi Stephen wrote:
Hi,
I'm was wondering how most people work during when designing a
functional program. Do you create data structures/types first? Do you
work from some type signatures?
For example, take a blog. Is the first step likely to be something like:
data BlogEntry = BlogEntry {
title::String,content::String,comments::[Comment] }
type Blog = [BlogEntry]
or more likely thinking about what functions will be required:
addEntry :: BlogEntry -> Blog -> Blog
displayBlog :: Blog -> HTML
displayEntry :: BlogEntry -> HTML
I think you can work either way around, or both, or a mixture.
If I had to choose between the two, I would *definitely* choose the
second. Writing a program is like defining a custom language. Start by
defining your primitives (functions). The data types are just "whatever
you need to make it work".
YMMV :)
Jules
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe