rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 96 forks source link

Nested case splitting doesn't work #610

Open L7R7 opened 3 years ago

L7R7 commented 3 years ago

image

I was hoping for the case split to work on the Bool inside the newtype resulting in

foo :: Bar -> String
foo (Bar True) = ""
foo (Bar False) = ""
rikvdkleij commented 3 years ago

Thanks for reporting!

Because the Bool is not explicitly defined in type signature of foo the current implementation does not work for this case. Will take a look how to fix this soon.

mbwgh commented 3 years ago

But that is probably not the only criterion, right?

For instance, I can't seem to trigger the case split intention for

bla :: Maybe Int -> IO ()
bla m = undefined

either.

rikvdkleij commented 3 years ago

@mbwgh Thanks for reporting!

That should work. Have to fix that.

rikvdkleij commented 3 years ago

@mbwgh Should be fixed in next release.

rikvdkleij commented 3 years ago

@mbwgh Fixed in beta84 which is uploaded to alpha plugin repo.

mbwgh commented 3 years ago

That's great news!

I wanted to try it out right away actually, but unfortunately it did not seem to work. It appears that the alpha repo now has beta83 as latest version.

rikvdkleij commented 3 years ago

Jetbrains first has to approve this version before it’s available. You can also download the plugin from Releases, https://github.com/rikvdkleij/intellij-haskell/releases/tag/v1.0.0-beta84

mbwgh commented 3 years ago

I was able to try it out and found two issues.

2020-11-03-064421_371x131_scrot

rikvdkleij commented 3 years ago

Thanks for your feedback!

Type synonyms are not resolved. For instance, there is no option to case-split on String, but it works on [Char].

Yes, type synonyms are not resolved. I wonder if I should put effort into that.

Maybe this makes sense when the constructors are actually available, but probably not in general.

Yeah okay but it doesn't hurt 😄 Otherwise I have to make an exception.