Re: [Snowdrift-dev] Go to Definition?

2017-11-19 Thread jake
Thank you everybody for your input!

I'm sorry for the delay: I've been making Christmas cards, etc. (Go 
LibreOffice!)



I wish I had something satisfying to report, but I'm still fiddling. If I get a 
well-working setup, and it's not already in TEXTEDITORS.md, I'll definitely add 
it.



~ Anyhow: ~



Currently, I am fiddling with the HaskForce plugin, which supposedly seeks out 
declarations on its own, without the use of ctags or any external tool.

And it would appear that neither IntelliJ, nor any plugin thereof, supports 
ctags. 

Note: I already tried the intellij-haskell plugin (that's its actual name). It 
cannot find declarations outside the project.



If HaskForce fails to get me to definitions (not looking good so far), I 
suppose I'll try hasktags + vim from within the built-in terminal of IntelliJ.

I honestly find definition lookup to be more important than syntax highlighting.



Also, I was surprised that no one Hoogle does it. Thank you for the links, 
Bryan.



For me, it would really be worth it to get IntelliJ working well with Haskell. 
But I'll abstain from explaining my reasons in this thread.


Again, thank you. You folks really showed up!



Cheers,

Jake






___
Dev mailing list
Dev@lists.snowdrift.coop
https://lists.snowdrift.coop/mailman/listinfo/dev


Re: [Snowdrift-dev] Go to Definition?

2017-11-15 Thread Aaron Wolf
In general, please anyone on this thread:

If you clarify suggestions that can be good for new contributors with
little or no qualifications, submit merge-request changes to the
TEXTEDITORS.md document.

While we can't take on every issue in the Haskell ecosystem, we
certainly have an interest in lowering the barriers to productive
contributions from volunteers.

Thanks!



signature.asc
Description: OpenPGP digital signature
___
Dev mailing list
Dev@lists.snowdrift.coop
https://lists.snowdrift.coop/mailman/listinfo/dev


Re: [Snowdrift-dev] Go to Definition?

2017-11-15 Thread Samuel Tay
>
>
> haskdogs sounds like it's solving a similar problem to codex. Any
> insight to their relative strengths and weaknesses?
>
>
Oh wow. I was not aware of codex, so I can't compare them, but I'll
definitely be trying that out. At first glance, I think haskdogs is stack
specific and codex is not, so that's a point for codex. Thanks for
mentioning!
___
Dev mailing list
Dev@lists.snowdrift.coop
https://lists.snowdrift.coop/mailman/listinfo/dev


Re: [Snowdrift-dev] Go to Definition?

2017-11-15 Thread Bryan Richter
On 11/14/2017 11:04 AM, Samuel Tay wrote:
> Hasktags generates pretty much all the tags you want relevant to
> your project. If you have git submodules, forks of other projects
> locally, etc. then you can pass these directly via the CLI, e.g.
>
> hasktags -b "src deps/package1 deps/package2 /some/other/location"
>
> Another cool tool built off hasktags is haskdogs, which recursively
> generates tags. Might only be for stack projects, and also might
> only be viable for smaller projects, but I use it locally and it's
> awesome! You'll get jump-to for all of base as well (you get sent to
> some file in your .stack-work directory).
>
> https://hackage.haskell.org/package/hasktags
> https://hackage.haskell.org/package/haskdogs

Thanks, I'm gonna try this out!

haskdogs sounds like it's solving a similar problem to codex. Any
insight to their relative strengths and weaknesses?



signature.asc
Description: OpenPGP digital signature
___
Dev mailing list
Dev@lists.snowdrift.coop
https://lists.snowdrift.coop/mailman/listinfo/dev


Re: [Snowdrift-dev] Go to Definition?

2017-11-15 Thread Bryan Richter
On 11/14/2017 12:02 PM, David Thomas wrote:
> While the general case for TH is intractable, it would probably be
> pretty simple to write a script that can generate tags locations for
> identifiers generated by specific, known cases - particularly
> Persistent.
>
> At work I took a bit of a different approach, and wrote a generator
> that looks at the TH output and writes out code to different modules
> for each model.  This lets the tooling just work.  Probably
> overkill in the context of Snowdrift, though...

Sounds like something Haskell needs in general! I agree that the case
of persistent and routes is much simpler, though.



signature.asc
Description: OpenPGP digital signature
___
Dev mailing list
Dev@lists.snowdrift.coop
https://lists.snowdrift.coop/mailman/listinfo/dev


Re: [Snowdrift-dev] Go to Definition?

2017-11-14 Thread Samuel Tay
Hasktags generates pretty much all the tags you want relevant to your
project. If you have git submodules, forks of other projects locally, etc.
then you can pass these directly via the CLI, e.g.

hasktags -b "src deps/package1 deps/package2 /some/other/location"

Another cool tool built off hasktags is haskdogs, which recursively
generates tags. Might only be for stack projects, and also might only be
viable for smaller projects, but I use it locally and it's awesome! You'll
get jump-to for all of base as well (you get sent to some file in your
.stack-work directory).

https://hackage.haskell.org/package/hasktags
https://hackage.haskell.org/package/haskdogs

I have never actually written code for snowdrift, just on the mailing list,
but perhaps one of these days I can spin up a script for this.

Samuel Tay
(631) 291-3866
sam.chong@gmail.com

On Tue, Nov 14, 2017 at 7:54 AM, Bryan Richter  wrote:

> Hi!
>
> On 11/13/2017 06:30 AM, jake wrote:
>
> > In Haskell code, I'd like the ability to click an identifier and go
> > to its definition. How do I do this?
>
> You're not alone in your frustration. I think the only people who have
> a really good answer to this question are users of emacs + intero (+
> stack).
>
> https://commercialhaskell.github.io/intero/
>
> If you're willing, I'd suggest giving it a try.
>
> Unfortunately for me, I use vim, and I haven't plunged into emacs yet.
> I'm also frustrated with a lack of good go-to-definition support.
> Here's my solution so far:
>
> 1. Use vim. Vanilla vim has:
>
> -  keyword search (# and *) in a single file
> -  keyword expansion (^p, ^n) across all loaded files
> -  grep integration (:grep)
> -  creates a quickfix list, navigable with :cnext and :cprev
> -  support for ctags, which *does* provide go-to-defintion for the
>local project (see following)
>
> 2. Use fast-tags to generate ctags
>
> -  Works on the local project, with caveats due to Template Haskell:
> -  Doesn't support yesod routes (generated with TH)
> -  Doesn't support persistent model types (generated with TH)
>
> 3. Use all the web search engines
>
> -  For reasons unknown to me, different engines index different parts
>of hackage. I try:
> -  Stackage search https://www.stackage.org/
> -  Hoogle https://www.haskell.org/hoogle/
> -  Hayoo http://hayoo.fh-wedel.de/
>
> 4. Use codex https://hackage.haskell.org/package/codex
>
> -  Theoretically, this indexes all of your dependencies, and provides
>ctags go-to-definition for *everything*. I've tried it before, and
>it was quite nice!
> -  I don't use it right now, but maybe that's just because I changed
>operating systems and didn't load it back up yet.
>
> > I would like to know what your methods are,
> > since mine aren't working too well.  This issue
> >  may
> > explain some of my problems, but I'd like to hear your solutions.
> >
> > If you're interested, here's what I've tried:
> >
> >
> > Recently, I have installed IntelliJ and its Haskell plugin: the
> > above being my primary motivation -- supposedly, this IDE/plugin
> > combo has the feature.  Problem: only rarely does it work.
>
> I don't know anybody who uses IntelliJ + the Haskell plugin. :( I am
> not sure what state it is in. It might be a lost cause.
>
> Free/open source Haskell developers almost exclusively do not use
> IDEs. Some people *defend* this state of affairs, but I think the only
> real reason is that nobody has poured the intense time, money, and
> effort into creating one that *works* and is well-integrated with the
> compiler.
>
> > To give my actual case:
> >
> > I was perusing sdb.hs and saw:
> >
> > -- | Seeing as I use this everywhere toText_ :: FilePath -> Text
> > toText_ = format fp
> >
> > And I though to myself, "Hmm. I wonder where fp is defined? And
> > format?" So I use the "Go to Declaration" feature.
>
> Just for reference, here's how I figured out the answer to this
> myself. (Off the top of my head, I had no idea what 'fp' was.)
>
> First, I opened the file in vim and did a keyword search with *
> (http://vimhelp.appspot.com/pattern.txt.html#star). I found nothing,
> so I knew it wasn't a file-local definition. I knew for a fact that I
> would not export a name as meaningless as 'fp', so I didn't bother
> searching elsewhere in the project. Finally, I looked at the import
> list. Luckily, this file has really good imports, and there are only
> two possibilities:
>
> import Turtle hiding (need, opt)
> import Development.Shake
>
> Since fp is being used by 'format', which I knew was part of Turtle,
> I had a strong feeling that fp was part of Turtle, too.
>
> Sure enough, I searched Stackage and there it was, the second hit:
>
> search result:
> https://www.stackage.org/lts-9.13/hoogle?q=fp
>
> definition:
> https://www.stackage.org/haddock/lts-9.13/turtle-1.3.6/
> Turtle-Format.html#v:fp
>
>
> Hope that helps!
>
>
> 

Re: [Snowdrift-dev] Go to Definition?

2017-11-14 Thread Bryan Richter
Hi!

On 11/13/2017 06:30 AM, jake wrote:

> In Haskell code, I'd like the ability to click an identifier and go
> to its definition. How do I do this?

You're not alone in your frustration. I think the only people who have
a really good answer to this question are users of emacs + intero (+
stack).

https://commercialhaskell.github.io/intero/

If you're willing, I'd suggest giving it a try.

Unfortunately for me, I use vim, and I haven't plunged into emacs yet.
I'm also frustrated with a lack of good go-to-definition support.
Here's my solution so far:

1. Use vim. Vanilla vim has:

-  keyword search (# and *) in a single file
-  keyword expansion (^p, ^n) across all loaded files
-  grep integration (:grep)
-  creates a quickfix list, navigable with :cnext and :cprev
-  support for ctags, which *does* provide go-to-defintion for the
   local project (see following)

2. Use fast-tags to generate ctags

-  Works on the local project, with caveats due to Template Haskell:
-  Doesn't support yesod routes (generated with TH)
-  Doesn't support persistent model types (generated with TH)

3. Use all the web search engines

-  For reasons unknown to me, different engines index different parts
   of hackage. I try:
-  Stackage search https://www.stackage.org/
-  Hoogle https://www.haskell.org/hoogle/
-  Hayoo http://hayoo.fh-wedel.de/

4. Use codex https://hackage.haskell.org/package/codex

-  Theoretically, this indexes all of your dependencies, and provides
   ctags go-to-definition for *everything*. I've tried it before, and
   it was quite nice!
-  I don't use it right now, but maybe that's just because I changed
   operating systems and didn't load it back up yet.

> I would like to know what your methods are,
> since mine aren't working too well.  This issue
>  may
> explain some of my problems, but I'd like to hear your solutions.
>
> If you're interested, here's what I've tried:
>
>
> Recently, I have installed IntelliJ and its Haskell plugin: the
> above being my primary motivation -- supposedly, this IDE/plugin
> combo has the feature.  Problem: only rarely does it work.

I don't know anybody who uses IntelliJ + the Haskell plugin. :( I am
not sure what state it is in. It might be a lost cause.

Free/open source Haskell developers almost exclusively do not use
IDEs. Some people *defend* this state of affairs, but I think the only
real reason is that nobody has poured the intense time, money, and
effort into creating one that *works* and is well-integrated with the
compiler.

> To give my actual case:
>
> I was perusing sdb.hs and saw:
>
> -- | Seeing as I use this everywhere toText_ :: FilePath -> Text
> toText_ = format fp
>
> And I though to myself, "Hmm. I wonder where fp is defined? And
> format?" So I use the "Go to Declaration" feature.

Just for reference, here's how I figured out the answer to this
myself. (Off the top of my head, I had no idea what 'fp' was.)

First, I opened the file in vim and did a keyword search with *
(http://vimhelp.appspot.com/pattern.txt.html#star). I found nothing,
so I knew it wasn't a file-local definition. I knew for a fact that I
would not export a name as meaningless as 'fp', so I didn't bother
searching elsewhere in the project. Finally, I looked at the import
list. Luckily, this file has really good imports, and there are only
two possibilities:

import Turtle hiding (need, opt)
import Development.Shake

Since fp is being used by 'format', which I knew was part of Turtle,
I had a strong feeling that fp was part of Turtle, too.

Sure enough, I searched Stackage and there it was, the second hit:

search result:
https://www.stackage.org/lts-9.13/hoogle?q=fp

definition:

https://www.stackage.org/haddock/lts-9.13/turtle-1.3.6/Turtle-Format.html#v:fp


Hope that helps!



signature.asc
Description: OpenPGP digital signature
___
Dev mailing list
Dev@lists.snowdrift.coop
https://lists.snowdrift.coop/mailman/listinfo/dev