purescript-debug icon indicating copy to clipboard operation
purescript-debug copied to clipboard

Add spyM

Open ad-si opened this issue 1 year ago • 2 comments

I feel like this is actually the most useful one. So it's even more surprising that it's missing 😅

spyM :: forall m a. DebugWarning => Monad m => String -> a -> m Unit

ad-si avatar Feb 03 '24 17:02 ad-si

The spy functions are meant for inserting into the midst of an expression such that you don't have to break it up to observe some value passing through it - so this would be a trace, I guess it's the tag/label argument you want?

I usually do traceM { label: value } for that kind of thing. 🙂

garyb avatar Feb 03 '24 18:02 garyb

Yeah right, it's probably closer to trace. Yes I'm missing the label!

Ok sure, that works too I guess. Although I'm not sure about its discoverability and if you want to tell beginners that this is the canonical way 😅 Let's at least mention it in the docs?

ad-si avatar Feb 03 '24 19:02 ad-si