-
Notifications
You must be signed in to change notification settings - Fork 175
Conversation
I try to compute constraints for "compound" types. While constraint-building itself is simple, types do not match due to different representation between 'internal' and 'exported' signatures.
* Instead of listify, it walks the tree instead, so that constraints are only visible in relevant context. * Uses Map instead of [(,)] * Performs type substitutions in case of one child identifier found (relevant for constructor bindings)
It didn't do much anyway
This is required for GHC<7.10 due to a panic
Okay, this should work reasonably well (at least for some cases). I'm a bit concerned about this part https://github.com/DanielG/ghc-mod/pull/731/files#diff-1d7b042f1347cb873a911bf788cbad95R79, since it assumes that polymorphic and respective monomorphic types have the same number of type variables in the same order. I think it's a reasonable assumption, but I can't be sure. There might be a better way to do this. I'd like some test cases thrown my way, my imagination comes to a grinding halt when I try to invent something reasonably strange to test this on. |
I'll have a look this weekend, I have a bunch of stuff to do this week. |
Sure, no urgency here. |
Argh sorry, I just didn't have any time last weekend and exam period has started now so it's going to be a while until I can find some time :/ |
Can't say I'm in a hurry with this, so take your time. Only concern here is I might forget how all this works eventually, but I doubt it will be that long :) |
Okay, so I've half-forgotten why or how this works... Any updates? |
In fact I have some time :) Do you feel like dropping by IRC so we can discuss this in realtime? |
Okay. Don't exactly have much time atm, though, but I can spare half an hour or so. ghc-mod@irc.freenode.org, right? |
Oh, don't worry about it then I'll just have a play around with it and report back. |
That works. Have fun :) |
Oh and yes |
Sorry I took so long. I was tracking down what I thought to be a bug in optparse-applicative, turns out I had the wrong ghc-mod exe on my PATH, doh! Anyways I can't find anything wrong with this, seems to work with more complex binds which have patterns on the lhs too :) So with the remaining half-knowledge of how this works could you write some docs for When I was working on this something like the thing below seemed to present a major problem since you'd only get AbsBindrs for foo and bar seperately and you'd have to merge them into that larger tuple pattern bind somehow. This seems to work with your code though.
|
I'll try to add some haddock comments to my code later this week (probably should've done this in the first place, but you know how it is sometimes). For a general overview, I just walk whole AST fragment. For As for why this works for pattern bindings, you have to consider how AST represents those: a pattern binding is a left-pattern with essentially several left-bindings in it. Each binding has its own |
Yup, makes sense. Sounds pretty much how I would've done it. I just don't understand what those syb bits are doing since I don't have much of a clue of that so if you could document that when you get around to it that would be awesome :) |
Also some minor code cleaning
@DanielG, I added some comments. Hopefully this more or less explains what's going on there. |
As discussed in #69.
This is quite obviously a work-in-progress.
Travis build will most likely fail, I choose to ignore that for the moment.
P.S. Please take a look at https://github.com/atom-haskell/ghc-mod/commit/966c694dbf9133064c5fc3996eefc51afc3585f7#diff-a6e0dcd858fc676b788ac178c989b8a0R99 --
I have no idea how to proceed there (and if it's at all possible)nvm, it seems I figured it out. Not sure if it work in all cases though.