Hi Dushyant,
The problem most likely is
[m | m <- [5,7..], m <= (truncate (sqrt (fromInteger x)))]
This is because, the filter condition (the last part) does a very simple thing: It filters out any element that does not fulfil the criteria. You are operating on a list that is monotonically increasing. However, the filter isn't aware of this property. Hence, this list comprehension never ends because it doesn't know that once the condition fails, it will always fail.
Thus, the solution would be to generate a finite set (or take a part of the infinite set using takeWhile or something like that), instead of using an infinite one.