fun producer _ NONE = LazyNil | producer nextState (SOME state) = LazyCons(state, fn () => producer nextState (nextState state));