[Haskell-cafe] I just don't get it (data structures and OO)

Bulat Ziganshin bulat.ziganshin at gmail.com
Sun Jun 3 05:14:43 EDT 2007

Hello Phlex,

Sunday, June 3, 2007, 12:34:26 PM, you wrote:
> So i need to do something like this :

> changePlanetAge universe galaxy planet age = ...lots of code, returning
> a new universe
> And the same code for all functions updating any of the properties of my
> planet ...
> And the same code for all functions updating properties of a country on
> this planet...

> while in the OO paradigm, i only need to do

> changlePlanetAge planet age = ...just what you wrote

i think that problem is that you think in imperative paradigm. you
want to update the whole universe structure each time when one
children is born. the solution is to work on lower levels and change
your algorithms to group changes in substructures together

just one example: i parse config file in my program, i.e. i need
function that returns setting given section and entry name:

configData configFileContents sectionName entryName

in imperative paradigm i will probably scan whole file each time i
need an entry. in Haskell, i just split the whole config file into
sections and extract entries from appropriate sections. imagine the
opposite task, i will probably group entries together and concat them
into sections and then concat sections into the whole config file
while in imperative programming each new update will change the global

change your mind, Neo! ;)

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list