A compound of formula II or a pharmaceutically acceptable salt thereof, wherein: X is N or CR; R, R 2, R 3, and R 4 are each independently H, 2 H, halo, hydroxyl (-OH), C 1-3 alkoxy, C 1-3 haloalkyl or C 1-3 alkyl, said C 1-3 alkyl optionally substituted with hydroxyl, halo, C 1-3 alkoxy, or C 1-3 haloalkoxy; R 5 is independently H, 2 H, CH 3, CH 2 F, CHF 2, CF 3, CH 2 OH, or C 1-3 alkyl, said C 1-3 alkyl optionally substituted with F, OH, C 1-3 alkoxy, or C 1-3 haloalkoxy; R 5a and R 5b are each independently H, 2 H, or C 1-3 alkyl, said C 1-3 alkyl optionally substituted with F, OH, or C 1-3 alkoxy, or R 5a and R 5b are joined together forming a methylene or ethylene bridging group; R 5c and R 5d are each independently H, 2 H, F, -OH, C 1-3 alkoxy, or C 1-3 alkyl, said C 1-3 alkyl optionally substituted with F, OH, or C 1-3 alkoxy, or R 5c and R 5d are joined together forming a methylene, ethylene, or -CH 2 -O- bridging group; and R 6, R 7 and R 8 are each independently selected from H, 2 H, halo, C 1-3 alkyl, C 1-3 haloalkyl, C 1-3 alkoxy, C 1-3 haloalkoxy, C 3-7 cycloalkyl, and 4-7 membered heterocyclyl having 1 to 3 heteroatoms selected from N, O, and S, said C 1-3 alkyl optionally substituted with F, OH, C 1-3 alkoxy, or C 1-3 haloalkoxy; or R 6 and R 8 optionally forms a partially saturated carbobicyclic ring or heterobicyclic ring with the heteroaryl ring, said carbobicyclic ring or heterobicyclic ring optionally substituted with 1 to 3 groups selected from: 2 H, halo, C 1-3 haloalkyl, C 1-3 alkoxy, C 1-3 haloalkoxy, C 3-7 cycloalkyl, and 4-7 membered heterocyclyl having 1 to 3 heteroatoms selected from N, O, and S, for use in the treatment of a cancer selected from melanoma, uveal melanoma, lymphoma, diffuse large B-cell lymphoma, ibrutinib resistant cancers, papillary cancer, thyroid cancer, ovarian cancer, colon cancer, pancreatic cancer, non-small cell lung cancer, hematological cancers, chronic myelogenous leukemia, acute lymphoblastic leukemia, and acute myeloid leukemia in a subject in recognized need of such treatment. X is N or CR; R, R 2, R 3, and R 4 are each independently H, 2 H, halo, hydroxyl (-OH), C 1-3 alkoxy, C 1-3 haloalkyl or C 1-3 alkyl, said C 1-3 alkyl optionally substituted with hydroxyl, halo, C 1-3 alkoxy, or C 1-3 haloalkoxy; R 5 is independently H, 2 H, CH 3, CH 2 F, CHF 2, CF 3, CH 2 OH, or C 1-3 alkyl, said C 1-3 alkyl optionally substituted with F, OH, C 1-3 alkoxy, or C 1-3 haloalkoxy; R 5a and R 5b are each independently H, 2 H, or C 1-3 alkyl, said C 1-3 alkyl optionally substituted with F, OH, or C 1-3 alkoxy, or R 5a and R 5b are joined together forming a methylene or ethylene bridging group; R 5c and R 5d are each independently H, 2 H, F, -OH, C 1-3 alkoxy, or C 1-3 alkyl, said C 1-3 alkyl optionally substituted with F, OH, or C 1-3 alkoxy, or R 5c and R 5d are joined together forming a methylene, ethylene, or -CH 2 -O- bridging group; and R 6, R 7 and R 8 are each independently selected from H, 2 H, halo, C 1-3 alkyl, C 1-3 haloalkyl, C 1-3 alkoxy, C 1-3 haloalkoxy, C 3-7 cycloalkyl, and 4-7 membered heterocyclyl having 1 to 3 heteroatoms selected from N, O, and S, said C 1-3 alkyl optionally substituted with F, OH, C 1-3 alkoxy, or C 1-3 haloalkoxy; or R 6 and R 8 optionally forms a partially saturated carbobicyclic ring or heterobicyclic ring with the heteroaryl ring, said carbobicyclic ring or heterobicyclic ring optionally substituted with 1 to 3 groups selected from: 2 H, halo, C 1-3 haloalkyl, C 1-3 alkoxy, C 1-3 haloalkoxy, C 3-7 cycloalkyl, and 4-7 membered heterocyclyl having 1 to 3 heteroatoms selected from N, O, and S, for use in the treatment of a cancer selected from melanoma, uveal melanoma, lymphoma, diffuse large B-cell lymphoma, ibrutinib resistant cancers, papillary cancer, thyroid cancer, ovarian cancer, colon cancer, pancreatic cancer, non-small cell lung cancer, hematological cancers, chronic myelogenous leukemia, acute lymphoblastic leukemia, and acute myeloid leukemia in a subject in recognized need of such treatment.