https://github.com/bos/filemanip/blame/1ed1659a6459aeb66f4cec588ea1519bb6c26828/System/FilePath/GlobPattern.hs#L127
I haven't looked at it in detail yet, but shouldn't we replace O(n²) nub by e.g. an ordNub?