-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow changing the root directory for resolving imports #54
Conversation
We can now do `Resolver.resolve(expr)` or `Resolver.resolveRelativeTo(Paths.get("/tmp"))(expr)`
//We add a placeholder filename "package.dhall" for the base directory as a Local import must have a filename | ||
new ResolveImportsVisitor(semanticCache, | ||
semiSemanticCache, | ||
NonEmptyList.one(Local(relativeTo.resolve("package.dhall")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try it out tomorrow, but this will do the right thing if relativeTo
is a file, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good question! The intention was definitely that it be a directory. I suspect it might not work. Will have a think about that one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍, looks good to me, thanks! I'll merge in the morning.
result <- if (mode == ImportMode.LOCATION) importLocation(imp) else importNonLocation(imp, mode, hash) | ||
} yield result | ||
} | ||
} | ||
|
||
private object ResolveImportsVisitor { | ||
def apply[F[_] <: AnyRef: Sync: Client]: F[ResolveImportsVisitor[F]] = | ||
Sync[F].map2(ImportCache[F]("dhall"), ImportCache[F]("dhallj"))(apply[F](_, _)) | ||
def apply[F[_] <: AnyRef: Sync: Client](relativeTo: Path): F[ResolveImportsVisitor[F]] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about keeping around the old method signatures as well, using cwd
as above? MiMa doesn't like the missing apply
s, even though this is a private object. Then we could remove them in 0.3.x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow. I didn't think it would care about a private object. Yeah, that's fine by me
We can now do
Resolver.resolve(expr)
or
Resolver.resolveRelativeTo(Paths.get("/tmp"))(expr)