Evolution without exchange or other method

how to evolve a pokemon like a haunter to gengar without exchanging in pokemon sun?