input-output-hk / io-sim

Haskell's IO simulator which closely follows core packages (base, async, stm).
https://hackage.haskell.org/package/io-sim
Apache License 2.0
37 stars 15 forks source link

Improve `show` of `ScheduleMod` #175

Closed jasagredo closed 2 weeks ago

jasagredo commented 2 weeks ago

Goes from this:

Schedule control: ControlAwait [ScheduleMod (RacyThreadId [2],1) ControlDefault [(RacyThreadId [1],0),(RacyThreadId [1],1)],ScheduleMod (RacyThreadId [2],5) ControlDefault [(RacyThreadId [1],4),(RacyThreadId [1],5),(ThreadId [],12),(ThreadId [],13),(ThreadId [],14),(RacyThreadId [1],6),(ThreadId [],15),(RacyThreadId [1],7),(RacyThreadId [1],8)]]

to this

Schedule control: ControlAwait [ScheduleMod (Thread {2}.1) ControlDefault [Thread {1}.0,Thread {1}.1],ScheduleMod (Thread {2}.5) ControlDefault [Thread {1}.4,Thread {1}.5,Thread [].12,Thread [].13,Thread [].14,Thread {1}.6,Thread [].15,Thread {1}.7,Thread {1}.8]]
bolt12 commented 2 weeks ago

I'd argue it is useful to know which threads are Racy or not. Is not that large of an overhead

jasagredo commented 2 weeks ago

That doesn't change. Racy threads use curly braces, non-racy ones use square brackets.

bolt12 commented 2 weeks ago

Ah good point!