Skip to content

Instantly share code, notes, and snippets.

@itkovian itkovian/m.hs
Created Apr 5, 2019

Embed
What would you like to do?
messageSink
messageSink success failure messageCount frequency = loop
where
loop = do
v <- await
case v of
Just n -> case n of
Right json -> do
Data.Conduit.yield (encodeNormalisedRsyslog json) $$ success
Data.Conduit.yield (SBS.pack "\n") $$ success
liftIO $ increaseCount (1, 0) messageCount frequency
loop
Left l -> do
Data.Conduit.yield l $$ failure
Data.Conduit.yield (SBS.pack "\n") $$ failure
liftIO $ increaseCount (0, 1) messageCount frequency
loop
Nothing -> return ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.