Open L7R7 opened 4 years ago
Thanks for reporting!
Currently only case splitting on top-level is supported. So I have to not show the case split action in this case or make it work in this case. Will take a look soon.
Got this case also working. Will release a new version soon.
Seems to be fixed, except that the cursor jumps to a weird position after case splitting. The above example results in
foo :: FooType -> Base -> String
foo a b = undefined
where
bar :: FooType -> Base -> String x
bar Foo _ = undefined
bar (Bar n) _ = undefined
where x
is the position of the cursor after the case split. Haven't tried more examples, but I guess it's a general problem
Thanks! You're a great tester 👍
I got a fix which puts the cursor directly after bar :: FooType -> Base -> String
Don't get this better in current implementation.
Hopefully you can live with that 😄
I noticed that you are able to case split on functions now (tested with beta84), given that it is mentioned in a where block.
For instance, if you have then all is good.
But putting the f
inside a where block makes case-splitting available.
And then you end up with something like this:
The same thing happens when you change the argument type to Int
and it will pattern match on the constructor.
It does not happen for ()
.
@mbwgh Thanks! Will try to fix this.
With Haskell you never know if there is yet another clever way of writing things.
But what I would expect is that I would be able to case split on the e
in
myFun = putStrLn . f
where
f :: Either Int Bool -> String
f e = undefined
Preferrably something like that should work even if the type signature for f
was omitted, but maybe that is a trickier case.
But yeah, the case split on the f
itself was a little surprising for me, but that's subjective as always.
But what I would expect is that I would be able to case split on the e in
Yes, that's right but not supported at the moment.
But yeah, the case split on the f itself was a little surprising for me, but that's subjective as always.
Yep, In that case the option to apply case splitting should not be available.
When case splitting on the implementation line of
bar
, I end up with:So it correctly splits the cases, but it doesn't generate the correct code.
Also, I can't case split when there's no type annotation for
bar
. Especially in cases like this I often don't use explicit type annotations. It would be great to have case splitting there