Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Drop pathtype, part two #689

Merged
merged 7 commits into from
Jul 21, 2022
Merged

Drop pathtype, part two #689

merged 7 commits into from
Jul 21, 2022

Conversation

robrix
Copy link
Contributor

@robrix robrix commented Jul 15, 2022

This PR removes uses of and dependencies on pathtype from the rest of the repo.

Depends on #687. In particular, CI won't succeed until we publish semantic-source 0.2 to hackage.

Base automatically changed from pathological,-part-one to main July 18, 2022 16:27
@robrix robrix marked this pull request as ready for review July 19, 2022 18:12
@robrix robrix requested a review from a team as a code owner July 19, 2022 18:12
Copy link
Contributor Author

@robrix robrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for review!

Comment on lines -11 to +15
import Analysis.File as A
import Analysis.Reference as A
import Data.Aeson
import Source.Language as Language
import Source.Source as Source
import qualified System.Path as Path
import qualified System.Path.PartClass as Path.PartClass
import Analysis.File as A
import Analysis.Reference as A
import Data.Aeson
import Source.Language as Language
import Source.Source as Source
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expect lots of this sort of thing due to autoformatter. Apologies.

Comment on lines -28 to +26
Right pth <- fmap Path.parse (b .: "path")
pth <- b .: "path"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simpler terms.

Comment on lines -36 to +34
fromSource :: Path.PartClass.AbsRel ar => Path.File ar -> Language -> Source -> Blob
fromSource :: FilePath -> Language -> Source -> Blob
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simpler types.

Comment on lines -48 to +46
blobFilePath = Path.toString . blobPath
blobFilePath = blobPath
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted not to eliminate this in favour of blobPath because I didn't want to get dragged into that refactoring in the same PR. Still, it would be nice.

Comment on lines -17 to +20
let ?project = Path.relDir "external/tree-sitter-ql"
let ?project = "external/tree-sitter-ql"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We aren't currently building with bazel, but I did my best to keep these changes bazel-friendly at least.

Comment on lines -42 to +41
useJD <- (Path.hasExtension ".json" (Path.absRel ref) &&) <$> fmap isJust (Path.findExecutable "jd")
useJD <- (takeExtension ref == ".json" &&) <$> fmap isJust (findExecutable "jd")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pathtype generally mimics filepath's API pretty closely, so most of the changes either just drop conversions to/from strings, or drop the module prefix and use the mimicked symbol. In this case, pathtype does something completely different for some reason, so there's some actual logic to this change.

I did double-check that takeExtension returns the ..

@robrix robrix merged commit c820de1 into main Jul 21, 2022
@robrix robrix deleted the pathological,-part-two branch July 21, 2022 13:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants