Disclosed are pyrazolo-pyrimidin derivatives of formula (D) that form covalent bonds with Bruton's tyrosine kinase (Btk), which is a member of the Tec family of non-receptor tyrosrne kinaces, and is a key signaling enzyme expressed in all hematopoietic cell types except T lymphocytes and natural killer cells, wherein the variables shown in the structure of formula (D) are as defined in the specification. Also described are irreversible inhibitors of Btk; methods for the preparation of these compounds; and pharmaceutical compositions that include the compounds. These Btk inhibitors are suitable for the treatment of autoimmune diseases or conditions, heteroimmune diseases or conditions, cancer, including lymphoma, and inflammatory diseases or conditions.