Sound-imitative words are also called "onomatopoeia" (象声词).
哈 is a sound imitation of:
1) a laugh. In this case, it’s usually used with repetition: “ha-ha”
Examples
哈哈,太搞笑!
Haha, how funny!
hāhā, tài gǎoxiào
我只说了一句话之后,他突然哈哈大笑起来
I only said one sentence and he suddenly laughed out loud
wǒ zhǐ shuō le yí jù huà zhīhòu, tā túrán hāhā dà xiàoqilái
2) an exhalation: “whew”, “phew”.
Examples
哈,考试结束了,可以休息了
Phew, exams are over. Now we can rest!
hā, kǎoshì jiéshù le, kěyǐ xiūxi le
The interjection 哈
Pay attention
An interjection (感叹词) is a word or expression that occurs as an utterance on its own and expresses a spontaneous feeling or reaction. It expresses feelings and emotions but does not name them. It is usually placed at the beginning of a sentence.
The interjection 哈 expresses:
1) satisfaction or delight, usually used with repetition.
Examples
哈哈,我猜到了!
Haha, I guessed it!
hāhā, wǒ cāidào le
哈哈,我成功了!
Haha, I got it!
hāhā, wǒ chénggōng le
2) Exclamation or loud shouting. It can be translated as “aha”, “there you go!”.