Closed dcastro closed 2 years ago
Where we should store mk.... functions? We just importing parsers From CLI.Parser into other pkg? Or we should make some upper logic file?
Where we should store mk.... functions?
The mkQualifiedPath
functions should live next to the QualifiedPath
type (similar to how mkPath
lives next to Path
).
We just importing parsers From CLI.Parser into other pkg?
Preferably, yes.
Though we might run into some issues. For example, right now we have:
Filter
type defined in CLI.Types
parseFilter
defined in CLI.Parser
instance FromHttpApiData Filter
defined in CLI.Types
Reusing parseFilter
to implement instance FromHttpApiData Filter
would create a cyclic dependency between the two modules (CLI.Parser
depends on CLI.Types
, CLI.Types
depends on CLI.Parser
). To avoid this cyclic dep, we should move parseFilter
to CLI.Types
.
Clarification and motivation
The Web API reimplements some parsing logic to parse things like
Filter
(see theinstance FromHttpApiData Filter
).We should reuse the same parsers we used in the CLI modules.
Additionally, the logic to parse a
QualifiedPath
is duplicated inFromHttpApiData (QualifiedPath path)
and inCLI.Parser.readQualifiedEntryPath
. We should try to have a singlemkQualifiedPath
function that is reused in theFromHttpApiData
instance and in the CLI parser.Acceptance criteria