Adapted for an older Haskell platform.