title: Mutability in functional programming
body: <p>First I am a Haskell newbie.
  I've read this:
  <a href="https://stackoverflow.com/questions/166379/immutable-functional-objects-in-highly-mutable-domain">Immutable functional objects in highly mutable domain</a>
  And my question is nearly the same -- how to efficiently write algorithms where the state is supposed to change. Let's take for example Dijkstra's algorithm. There will be new paths found and distances should be updated. And in traditional languages this is simple while in Haskell for example I can only think of creating entirely new distances which will be too slow and memory consuming. Are there something like design patterns for such cases where one should implement algorithm with mutable data structure and speed and memory usage are main concerns?</p>