Skip to content
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

DataKinds is not enabled #11

Closed
athanclark opened this issue Oct 26, 2015 · 4 comments
Closed

DataKinds is not enabled #11

athanclark opened this issue Oct 26, 2015 · 4 comments

Comments

@athanclark
Copy link

Is this related to how the cyclomatic complexity algorithm is designed? Does DataKinds bork everything because expressions become types? I have no idea how the complexity analysis works, I will read up on it to catch up.

@rubik
Copy link
Owner

rubik commented Oct 26, 2015

The latest version on Hackage (0.2.0.0) of Argon uses Haskell-Src-Exts to parse the code. The problem with this approach is that one has to tell Haskell-Src-Exts which extensions should be loaded at compile time! This is unfortunate, since one cannot simply enable all extensions, as some extend the syntax in different ways. Argon had a very comprehensive extension list, see:

customExts = EnableExtension `map`

But, as you have seen, it's not enough.

Fortunately, this has been solved. I managed to replace Haskell-Src-Exts with the GHC API, and now Argon should be able to parse every valid module (one that hasn't syntax errors).
The new version is not available yet on Hackage. The only issue blocking the release is #3. It's not really a problem but it would make installation with Stack much easier.

If you try the version from master, it should work. If instead it does not, can you provide the code that Argon cannot parse? I tried with the first snippet at
https://www.fpcomplete.com/user/k_bx/playing-with-datakinds
and it worked.

@athanclark
Copy link
Author

That sounds wonderful :) I've had issues with Haskell-Src-Exts in the past as well - another issue they (actually get right and GHC gets wrong) is with -XMultiParamTypeClasses and contexts - the following is valid:

{-# LANGUAGE MultiParamTypeClasses #-}

foo :: Foo a b => a -> b

But GHC doesn't need the LANGUAGE pragma, while Haskell-Src-Exts does. Anyway, I'm glad you were able to switch over! Are you using hint for the api? Or just raw GHC?

I'll try compiling the master branch, thank you for all your work! This tool is amazing!

@rubik
Copy link
Owner

rubik commented Oct 26, 2015

I'm glad that you're finding Argon useful! It's actually in a very early stage and can be improved a lot.

As of now I'm using plain GHC API. One major problem is that I'm only sure it works for GHC >=7.10. I've seen in Hint code it's possible to support previous versions, although this requires adding a lot of ugly #if directives. I'm confident that soon Argon will run at least from GHC 7.8 onwards.

P.S. That issue you mention is a weird one! It's odd that GHC does not require the pragma.

@rubik
Copy link
Owner

rubik commented Oct 29, 2015

I'm closing this as it's working with GHC >= 7.8. If you experience any problems, feel free to reopen or open a new issue altogether.

@rubik rubik closed this as completed Oct 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants