This is close to cheating and must have terrible space and runtime complexity:
isAnagram word1 word2 = word1 `elem` permutations word2
The solution based on sort:
isAnagram word1 word2 = sort word1 == sort word2
The library functions sort and permutations seem to be such an integral part of the solution, they should be implemented, here. :)
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.