I have a list of elements and I wish to update them:
from this: [\"Off\",\"Off\",\"Off\",\"Off\"]
[\"Off\",\"Off\",\"Off\",\"Off\"]
to this: [\"Off\",\"Off\",\"On\",\"Off\
[\"Off\",\"Off\",\"On\",\"Off\
I think you should consider using a data structure other than List. For example, if you just want to have a state of four on/off switches then:
data State = St { sw1, sw2, sw3, sw4 :: Bool }
For a dynamic number of switches then consider a mapping from switch name to Bool.
switch name
Bool