We present an offline partial evaluator for a higher-order subset of ML with reference types. Its novel feature is the ability to perform assignments to local and global variables at specialization time. The presented technology applies directly to realistic programming languages, such as Scheme and Standard ML. It is an instance of a novel monad-based partial-evaluation framework, which generalizes all known approaches to partial evaluation for functional languages to date. The particular instance here is a continuation/store monad which provides the necessary control and store operators. Store operators are implemented efficiently by means of first-class stores. To render the partial evaluator completely automatic we use program analyses ...