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

most values are not captured #7

Open
nickolay opened this issue Mar 4, 2018 · 5 comments
Open

most values are not captured #7

nickolay opened this issue Mar 4, 2018 · 5 comments

Comments

@nickolay
Copy link

nickolay commented Mar 4, 2018

I'm new to Haskell and I don't know if or where I messed up, but none of the examples from the homepage work for me. Even something as simple as:

*Main Debug.Hood.Observe Lib> printO (observe "fun" . id $ 999)
999

-- fun
  _

For functions the output value is displayed, but the input parameters are displayed as _:

*Main Debug.Hood.Observe Lib> runO $ print $ observe "sum xs" (\ xs ys -> sum xs) [0..2] [0..]
3

-- sum xs
  { \ _ _  -> 3
  }

I'm using hood-0.3.1 and:

$ stack ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.2.2

hood-0.3 works fine.

I tried using the GHCi debugger and it seems that the captured events (using 0.3.1) in the first testcase were:

events = [Debug.Hood.Observe.Event
            2 (Debug.Hood.Observe.Parent 1 0)
            (Debug.Hood.Observe.Cons 0 "999"),
          Debug.Hood.Observe.Event
            2 (Debug.Hood.Observe.Parent 1 0) Debug.Hood.Observe.Enter,
          Debug.Hood.Observe.Event
            1 (Debug.Hood.Observe.Parent 0 0)
            (Debug.Hood.Observe.Observe "fun")]

while in the version 0.3 that works, the event with Cons has the ID = 3. Given that eventsToCDS appears to use this ID as an index into the out_arr array, this duplicate event ID seems to be the problem.

Seems to be caused by the change to unsafeWithUniq in #6 -- moving incrementUniq node before the fn call fixes the problem for me.

@RyanGlScott
Copy link
Member

Thoughts, @igrep?

@igrep
Copy link
Contributor

igrep commented Mar 17, 2018

I'm sorry for adding a big bug... I've scarcely used hood since the fix...
Anyway, I think @nickolay's fix would be OK if the test case I wrote passes (runs without error).

Thank you very much!

@nickolay
Copy link
Author

FWIW, I didn't suggest "moving incrementUniq node before the fn call" as a proper fix, as I think it basically undoes the fix from #6: we would no longer "[increment] the node id only when the function is executed without exception". If one wanted to do that, he could revert the whole commit.

@mberkowitz
Copy link

I too am a novice and ra ninto the same bug -- the simple examples print data as _. Very disappointing.
A git rebase that omits all of pull request 6 seems to fix it.

As a beginner, I can't assess hood as a development tool, but it's intriguing and seems useful for learning haskell.
Why is it left in this broken state for 2.5 yrs? Why aren't the examples in the github repo, and what good is running CI when it can't detect this degree of failure?

@smith558
Copy link

The issue is still present in 2021. hood-0.3.1 not functional

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

5 participants