If the transformer finds any occurrence of regular patterns in the AST, it will automatically add the import import qualified Harp.Match as HaRPMatch. This is consistent with the view that Harp.Match is the "Prelude" of regular patterns, and it intends to ensure that no name clashes happen, but in practice this leads to some issues.
Firstly, if the harp package is not installed, users get an error saying that Harp.Match could not be found in any package - without Harp.Match being mentioned by the user's code. By forcing users to explicitly import, they will also (at least in theory) realize that they need harp installed.
Second, and perhaps more academic in nature, not forcing a specific import of the "backend" would open for the possibility of using different backends. This is the justification we used for removing the auto-import of HSP when transforming code containing XmlSyntax. Now, the backend for HaRP is very simple and specific and it might not even make sense in practice to replace it with something else.
I'm not sure what the correct way is here, but I want to document these thoughts somewhere.
If the transformer finds any occurrence of regular patterns in the AST, it will automatically add the import
import qualified Harp.Match as HaRPMatch. This is consistent with the view thatHarp.Matchis the "Prelude" of regular patterns, and it intends to ensure that no name clashes happen, but in practice this leads to some issues.Firstly, if the
harppackage is not installed, users get an error saying thatHarp.Matchcould not be found in any package - withoutHarp.Matchbeing mentioned by the user's code. By forcing users to explicitly import, they will also (at least in theory) realize that they needharpinstalled.Second, and perhaps more academic in nature, not forcing a specific import of the "backend" would open for the possibility of using different backends. This is the justification we used for removing the auto-import of HSP when transforming code containing
XmlSyntax. Now, the backend for HaRP is very simple and specific and it might not even make sense in practice to replace it with something else.I'm not sure what the correct way is here, but I want to document these thoughts somewhere.