alexwl / haskell-code-explorer

Web application for exploring and understanding Haskell codebases
MIT License
509 stars 20 forks source link

No cabal files #43

Closed ilyakooo0 closed 5 years ago

ilyakooo0 commented 5 years ago

I get this error when trying to index one of the packages in a project.

cabal-helper-wrapper: user error (Pattern match failure in do expression at src/CabalHelper/Compiletime/Wrapper.hs:164:7-13)

After adding a trace to the line:

[cfile] <- traceShowId . filter isCabalFile <$> getDirectoryContents projdir

I get [].

alexwl commented 5 years ago

It seems that there's no .cabal file in the package directory (projdir).

isCabalFile function from cabal-helper:

isCabalFile :: FilePath -> Bool
isCabalFile f = takeExtension' f == ".cabal"

takeExtension' :: FilePath -> String
takeExtension' p =
    if takeFileName p == takeExtension p
      then "" -- just ".cabal" is not a valid cabal file
      else takeExtension p

cabal-helper needs .cabal file to get package description.

Is there a package.yaml (https://github.com/sol/hpack) file in the package directory? hpack can generate .cabal file from package.yaml.

ilyakooo0 commented 5 years ago

Yeah, this was related to me not specifying the full dist path. I essentially left it at .stack-work/dist. There should be a more descriptive error for this though.

alexwl commented 5 years ago

I agree that the error message should be more descriptive. I've added the check for .cabal file (6c6d96288f41b7c44657e265dc98e519505e357c)

alexwl commented 5 years ago

I think the issue is fixed.