  We present a new framework for a broad class of affine Hecke algebra modules,
and show that such modules arise in a number of settings involving
representations of $p$-adic groups and $R$-matrices for quantum groups.
Instances of such modules arise from (possibly non-unique) functionals on
$p$-adic groups and their metaplectic covers, such as the Whittaker
functionals. As a byproduct, we obtain new, algebraic proofs of a number of
results concerning metaplectic Whittaker functions. These are thus expressed in
terms of metaplectic versions of Demazure operators, which are built out of
$R$-matrices of quantum groups depending on the cover degree and associated
root system.
