Skip to content

Should Harp.Match be auto-imported? #4

Description

@niklasbroberg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions