adinapoli / threads-supervisor

Simple, IO-based Haskell library for Erlang-inspired thread supervisors
MIT License
29 stars 4 forks source link

export QueueLike #8

Closed srijs closed 8 years ago

srijs commented 8 years ago

QueueLike is currently not exported. That means that it doesn't show up in the documentation, and it is not possible to actually read from the event queue.

adinapoli commented 8 years ago

Hey @srijs , thanks, good catch!

It's not exactly right to say that it's not possibly to read from the event stream; in fact it will work if you know a priori the inner implementation and use the concrete typeclass implementation. This in an except of code I have in production which indeed compiles:

--------------------------------------------------------------------------------
logSupervisionEvents :: Config -> TQueue SupervisionEvent -> IO ()
logSupervisionEvents cfg q = do
  evt <- atomically $ readTQueue q
  case evt of
      [...] -- redacted

And this also explains why I didn't realise sooner of the problem; I introduced the QueueLike abstraction in 1.0.4.0 and my production code didn't break during the version bump from 1.0.3.0. An eventful coincidence!

I will let Travis finish the build and then merge. Thanks!

srijs commented 8 years ago

Thanks for merging so quickly! Yes, you're right, I can use it if I know what QueueLike can be (i.e. read the source) and monomorphize it, but for me it partly defeats the purpose of having it be polymorphic in the first place ;)

Can I expect a patch version on Hackage soon?

adinapoli commented 8 years ago

@srijs I will do my best to upload this on Hackage later today or tomorrow!

I will expand the changelog with your fix and release 1.0.4.1 :wink: