intellij-haskell icon indicating copy to clipboard operation
intellij-haskell copied to clipboard

Nested case splitting doesn't work

Open L7R7 opened this issue 4 years ago • 9 comments

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) = ""

L7R7 avatar Sep 22 '20 19:09 L7R7

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.

rikvdkleij avatar Sep 23 '20 04:09 rikvdkleij

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.

mbwgh avatar Oct 29 '20 11:10 mbwgh

@mbwgh Thanks for reporting!

That should work. Have to fix that.

rikvdkleij avatar Nov 01 '20 12:11 rikvdkleij

@mbwgh Should be fixed in next release.

rikvdkleij avatar Nov 02 '20 19:11 rikvdkleij

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

rikvdkleij avatar Nov 02 '20 20:11 rikvdkleij

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.

mbwgh avatar Nov 02 '20 22:11 mbwgh

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

rikvdkleij avatar Nov 03 '20 05:11 rikvdkleij

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

  • Type synonyms are not resolved. For instance, there is no option to case-split on String, but it works on [Char].
  • You can now case-split on Char and Int and so on. Maybe this makes sense when the constructors are actually available, but probably not in general.

2020-11-03-064421_371x131_scrot

mbwgh avatar Nov 03 '20 06:11 mbwgh

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.

rikvdkleij avatar Nov 03 '20 18:11 rikvdkleij