Implementing simple business model in Haskell
- by elmes
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.