This invention relates to compounds of formula (I). The compounds of the invention are tyrosine kinase inhibitors. Specifically the compounds of the invention are useful as inhibitors of Bruton s tyrosine kinase (BTK). The invention also contemplates the use of the compounds for treating conditions treatable by the inhibition of Bruton s tyrosine kinase for example cancer lymphoma leukemia and immunological diseases.