haskell / haskell/haskell-language-server

hls-eval-plugin should support working with the expression preceding the comment

Open
#3,436 0 comments 0 reactions 0 assignees View on GitHub
component: hls-eval-plugin type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

Whenever I'm writing a long expression split in multiple logical pieces and spanning over multiple lines, I wish I could see the type of each piece, autogenerated by my IDE.

For instance I may write:

```haskell
value
& toSend fn1
& groupBy fn2
& sequence
& ...
```

And I wish I could see:

```haskell
value -- m a
& toSnd fn1 -- m (a, b)
& groupBy fn2 -- m [(a, b)]]
& sequence -- [m (a, b)]
& ... -- ...
```

I believe that what I'm asking for here, is similar to what #709 is about, but a bit more specific.

A possible solution for my needs, that I believe would be easy to implement, would be extending the ability of hls-eval-plugin to:

1. support working with the expression that precedes it,
2. write the result in the same line as the comment.

For instance, for the above case, I could write something similar to:

```haskell
value -- !> :t #
& toSnd fn1 -- !> :t #
& groupBy fn2 -- !> :t #
& sequence -- !> :t #
& ... -- !> :t #
```

where `!>` tells the hls-eval-plugin to place the result in the same line, and `#` represents the preceding expression (please come up with a better syntax than what I suggested). And the result would look like:

```haskell
value -- !> :t # -- m a
& toSnd fn1 -- !> :t # -- m (a, b)
& groupBy fn2 -- !> :t # -- m [(a, b)]
& sequence -- !> :t # -- [m (a, b)]
& ... -- !> :t # -- ...
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.