Hacker News new | ask | show | jobs
by yoyohello13 428 days ago
You can type `:doc $` in ghci and it will tell you how the function is defined and give you usage examples.
1 comments

We aren’t enthusiastic about having to do that either
Why? It’s the official documentation. Most haskellers have gchi open at all times when coding.
Because (as far as I know) that's not the case for most other languages. It's an interesting (and certainly not necessarily "wrong") way to program when you aren't sure about how to write something. Python has something similar, that I will occasionally utilize for this purpose, but it doesn't show documentation (as far as I know) or anything like that while it sounds like gchi has functionality kind of like CLI tools' "--help"?

With C#, intellisense takes the role of gchi and does pop up say the valid methods and properties of a class, and iirc includes documentation text.

So it's less about that haskell has "coding help" built in and more about how that's presented to and interacted by the developer.

Python does indeed have similar functionality:

    $ py
    >>> help(print)

    $ ghci
    λ> :doc $
This returns the same documentation provided by intellisense.
Right on.

To be clear, the core "issue" is whether developers use or like to use that functionality, and to that end I say I never use it for Python (obviously- since I didn't know of its existence). More succinctly, it seems like other languages have "more popular" alternatives.

Agreed! I've never found myself making much use of Python's help feature, but I do all the time in Haskell! Wonder why?