The present disclosure provides compounds having affinity for the 5-HT6 receptor which are of the formula (I): wherein Q, R1, R4, m and Ar are as defined herein. The disclosure also relates to methods of preparing such compounds, compositions containing such compounds, and methods of use thereof.