Memoized scripting with haskell