Migrate `Finder` component to `OsPath`
Summary
It is no secret, a GHC session keeps a lot of Strings alive. One such source of Strings is ModLocation which is kept alive in the GHCi session via ModSummary.
Take for example the agda codebase, with roughly 420 modules. That means we keep alive 420 ModLocations, where five out of six fields contain long FilePaths. How long depends on the location of the agda repository in the filesystem, but to give an example, in my system the repository is cloned into /home/hugin/Documents/haskell/agda and, thus, the average path length is 133 characters
To get the number of bytes kept alive, we calculate:
- 420 modules
- 133 length per entry in
ModLocation - 40 bytes for a cons cell
- 5 fields in
ModLocationthat are populated
Summing that up, we have around 11MB of String values alive in a GHCi session that otherwise needs ~500MB.
We propose to migrate ModLocation to OsPath as it is more memory efficient.
ModLocation and the finder service are well encapsulated, thus we can keep OsPath as an implementation detail of ModLocation.