I recently added a loops example showing how to implement Ableton Live loops using purescript-wags
and the compilation time for the file Loops.purs
, a ~300 line file, is upwards of 30 seconds on my pretty-powerful Ubuntu machine. The reason, which I’ve talked about a bit on the community Slack as well, is its heavy use of typeclasses.
The way that I’ve combatted wait times in the past is by splitting large files into modules, but here, I’m not sure what an equivalent splitting process for typeclass constraints would be.
This leads me to a few questions that I’d like to start a thread on:
- Does anyone else struggle with high compile times for typeclass-heavy workloads?
- Are there any strategies folks have found for getting these times down? Ie a sort of “modularization” or caching of typeclass constraints that allows them not to be entirely re-solved when there’s a small change to a type (ie adding or removing a key from a row).
- Would anyone be interested in pairing up on a PR to
Types.hs
to try to optimize parts of it? @natefaubion gave me some good suggestions, but it is a sensitive part of the compiler and it’d be helpful to work with a couple other people that are interested in improving this area of PureScript.
Thanks in advance for your answers/suggestions/comments!