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

Highlight difference between steps #32

Open
roboguy13 opened this issue Aug 19, 2015 · 2 comments
Open

Highlight difference between steps #32

roboguy13 opened this issue Aug 19, 2015 · 2 comments

Comments

@roboguy13
Copy link
Member

This might be quite a bit more trouble than it would be worth (implementation-wise), but it would be nice if you could turn on an option to highlight the difference between the results of each consecutive pair of steps in a script:

($) ▲ ▲ send
    (($) ▲ ▲ loop
         ((>>=) ▲ $fMonadR ▲ ▲ (buttonE (I# 0))
                (λ r →
                   (>>=) ▲ $fMonadR ▲ ▲
                         ((λ x → return ▲ $fMonadR ▲ (unLit x)) r)
                         (λ b →
                            (>>) ▲ $fMonadR ▲ ▲ (ledE (I# 0) (lit b))
                                 ((>>) ▲ $fMonadR ▲ ▲
                                       (ledE (I# 1) (lit (not b)))
                                       (wait (I# 100)))))))
[Done]

($) ▲ ▲ send
    (($) ▲ ▲ loop
         ((>>=) ▲ $fMonadR ▲ ▲ (buttonE (I# 0))
                (λ r →
                   (>>=) ▲ $fMonadR ▲ ▲
                         ((λ x → return ▲ $fMonadR ▲ (unLit x)) r)
                         (λ b →
                            (>>) ▲ $fMonadR ▲ ▲ (ledE (I# 0) (lit b))
                                 ((>>) ▲ $fMonadR ▲ ▲
                                       (ledE (I# 1) (notE (lit b)))
                                       (wait (I# 100)))))))
[Done]

This would also work together with #30 well, if we decide to implement that.

@xich
Copy link
Member

xich commented Aug 19, 2015

The old shell had the command diff for this. If you gave it two AST ids (the number printed in the hermit prompt... hermit<30> means you are transforming AST id 30), it would show the diff between the pretty printed output. If you want this always, you could use set-pp-diffonly True.

It's not the greatest diff (it diffs by line), but I used it quite a bit. I have an idea for using the fold machinery to do semantic diff, but haven't gotten around to it yet.

@andygill
Copy link
Member

We have a plan here. Because we (will) return the HDoc by default to the Shell, there can be a function

diff :: HDoc -> HDoc -> IO HDoc

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

No branches or pull requests

3 participants