strange behaviors when case splitting on `List` and local items
raptazure opened this issue · 4 comments
- Case splitting on _ with type
List a
givesList _
instead ofNil
andx : xs
. - Case splitting on local items doesn't work at first. It seems that treating typed holes as errors can prevent case splitting.
Like this video shows:
2021-02-16.18.19.46.mp4
It would be great for type-driven development if case splitting works better. Thanks!
As far as I can see this is just down to the way case splitting works in purs ide
- and should be raised as an issue in the compiler repo. Holes as errors - yeah if you've not managed to build the file before, there won't be any type info for ColorTy
, not sure if that's what you're seeing there.
@kritzcreek can you shed any light on what's happening with that List
case split - looks to me like Maybe a
case splits fine, but List a
gives (List _)
even though List
is not a type constructor - some issue with recursive datatypes?
Yeah that looks like purescript/purescript#3053. It's finding Lazy.List
which just a newtype and it case splits on that. Case-splitting could probably use a proper re-write but I don't have time for it anytime soon.
Ah, thanks! :)
Ah @kritzcreek yes that looks to be it, worth noting you don't even need anything of Data.List
imported for that to happen - it occurs even with a local List
declaration - but changing to MyList
works fine