DanielG / ghc-mod

Happy Haskell Hacking for editors. DEPRECATED
Other
677 stars 175 forks source link

Cannot refine #506

Open meditans opened 9 years ago

meditans commented 9 years ago

I'm using ghc-mod from this repo with ghc-7.10. I am not able to refine with C-cC-f as in this example at http://www.mew.org/~kazu/proj/ghc-mod/en/emacs.html

filterNothing :: [Maybe a] -> [a]
filterNothing xs = _body

When I try to refine, I get a message saying "Cannot refine"

meditans commented 9 years ago

Moreover, I don't seem to be able to obtain a refinement even in ghc-mod command line or in ghc-modi

DanielG commented 9 years ago

Related: https://github.com/kazu-yamamoto/ghc-mod/issues/438

meditans commented 9 years ago

I traced back the issue to the ghc-mod warning: Could not find a component assignment, falling back to guessed GHC options. This warning is issued in the code in Target.hs.

@DanielG, could you explain me what it means and why is it generated?

alanz commented 9 years ago

I understand it to be generated if the file being processed is not listed in any of the cabal targets, each of which has a GHC configuration associated with it.

meditans commented 9 years ago

ok, thanks to @alanz, I understood that the problem was that ghc-mod should be executed in the folder containing the cabal file. So, the problem is now that when I try to use the refine command, I get no output.

I understand that the problem is generated in FillSig.hs, in the refine function:

where
  handler (SomeException _) = emptyResult =<< options

@DanielG, how can I debug this to understand better where the error is coming from?

Edit: If I modify the line in

where
  handler (SomeException exception) = (\opt -> traceShow exception (emptyResult opt)) =<< options

the exception returned for the example contained in ghc-mod --help in the refine case, returns:

Not in scope: ‘filter’

And I made sure that I imported Data.List into my module. It seems that ghc-mod isn't able to locate the filter function I'm talking about.

meditans commented 9 years ago

maybe @serras too.

DanielG commented 9 years ago

@meditans ping me when you have time to look at this more closely

meditans commented 9 years ago

@DanielG, I may have a couple hours to throw in later this afternoon (GMT+1), and I'll gladly look at this issue. I'll ping you in a few hours, ok?

DanielG commented 9 years ago

That wont do, GMT+9 here by then I'll be asleep.

meditans commented 9 years ago

Ah, you are already there. Good then, let's do tomorrow in the interval between 11.15 am and 14.00 (GMT+1)? Otherwise propose another time and I'll try to be there! :)

DanielG commented 9 years ago

I'll already be out of the office by then: It would have to be somewhere between 2:00 and 11:00 for you :/

http://clock.darkhorseanalytics.com/?a%5B0%5D%5Bname%5D=Tokyo&a%5B0%5D%5Btz%5D=Asia%2FTokyo&a%5B0%5D%5BisHome%5D=true&a%5B1%5D%5Bname%5D=Berlin&a%5B1%5D%5Btz%5D=Europe%2FBerlin&a%5B1%5D%5BisHome%5D=false

meditans commented 9 years ago

Ok then, I'll try to connect at about 7:00 here. I'll ping you here on github shortly thereafter.

meditans commented 9 years ago

Ok, I'm ready to do some work. What are we going to do? Edit: I'm also on the irc channel.