Re: Displaying a State



"Olivier" <olivier.marechal@xxxxxxxxxxx> writes:

> In fact, I want to create a Structure in which the name could be change. I
> want to set and get the state name.

Are you sure that's what you really want? A Structure where the name
is different, is really a different Structure, so why not treat it as
such? It is probably a better design choice to have something like:

changeName :: Structure -> String -> Structure
changeName s n = s {name = n}

(Or however you choose to implement it - if it's this trivial, you
may not want to bother declaring a separate function for it.)

-k
--
If I haven't seen further, it is by standing in the footprints of giants
.



Relevant Pages


Loading