Implementing simple business model in Haskell

Posted by elmes on Stack Overflow See other posts from Stack Overflow or by elmes
Published on 2012-04-09T16:47:23Z Indexed on 2012/04/09 17:29 UTC
Read the original article Hit count: 263

Filed under:
|

Supose we have a very simple model:

Station has at least one Train
Train has at least two Stations

The model has to allow to check what stations any given train visits and to check what trains visit a particular station.

How to model it in Haskell?


I am a Haskell newbie, so please correct me: once an object is created, you cannot modify it - you can only make a new object based on that one (~immutability). Am I right? If so, I'll have to create a lot of temporary variables with semi-initialized objects (during deserialization or even in unit tests).

Basically what I need is an example of modeling domain classes in Haskell - after reading "Learn you a haskell.." I still have no idea how to use this language.

© Stack Overflow or respective owner

Related posts about haskell

Related posts about data-modeling