Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add haskell support #35

Open
meditans opened this issue Aug 9, 2016 · 5 comments
Open

Please add haskell support #35

meditans opened this issue Aug 9, 2016 · 5 comments

Comments

@meditans
Copy link

meditans commented Aug 9, 2016

It would be great to have a simple solution for haskell folding. The current solution, based on indentation, has many of the problems already highlighted in the python issue. Is there an example parser from where I could start?

@vyp
Copy link

vyp commented Aug 9, 2016

It would be nice to be able to fold up function definitions to just their type annotation line (if they have it), as a thought.

@meditans
Copy link
Author

meditans commented Aug 9, 2016

@vyp the current behaviour does that, if the type annotation is preceded by a blank line. My main problem with this indentation is that if there is a haddock comment in the lines directly above the signature, the code gets folded to the first line of the haddock.

@vyp
Copy link

vyp commented Aug 9, 2016

Ah I see! I haven't actually used origami yet! (soon) So I assumed it didn't work with haskell at all because of this ticket.. 😑

@gregsexton
Copy link
Owner

Take a look at the parsers in https://github.com/gregsexton/origami.el/blob/master/origami-parsers.el

The problem with Haskell is that there isn't a keyword used when defining a function, so this may be tricky. Unless you're willing to write an elisp Haskell parser (which would be cool) or one already exists (I have no idea), then you're probably left with adding some heuristics to the indentation parser. Maybe you could generalise this so we can add python support easily. Then the python guys will stop harassing me and I will be forever in your debt. :)

I'll try and help out with specific questions as much as possible.

@wbolster
Copy link

with #69 and haskell-mode, the example code from https://hackage.haskell.org/package/base-4.11.0.0/docs/src/Data.Foldable.html looks like this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants