  Quipper is a practical programming language for describing families of
quantum circuits. In this paper, we formalize a small, but useful fragment of
Quipper called Proto-Quipper-M. Unlike its parent Quipper, this language is
type-safe and has a formal denotational and operational semantics.
Proto-Quipper-M is also more general than Quipper, in that it can describe
families of morphisms in any symmetric monoidal category, of which quantum
circuits are but one example. We design Proto-Quipper-M from the ground up, by
first giving a general categorical model of parameters and state. The
distinction between parameters and state is also known from hardware
description languages. A parameter is a value that is known at circuit
generation time, whereas a state is a value that is known at circuit execution
time. After finding some interesting categorical structures in the model, we
then define the programming language to fit the model. We cement the connection
between the language and the model by proving type safety, soundness, and
adequacy properties.
