A compositional semantics for CHR