These are chat archives for YoEight/eventstore

23rd
Jan 2017
Akii
@Akii
Jan 23 2017 10:04
just checked both bugs and they're gone \o/
well done
Yorick Laupa
@YoEight
Jan 23 2017 10:08
thanks for taking the time !
Akii
@Akii
Jan 23 2017 18:19
instance IsString EventType
  -- Defined in ‘eventstore-0.14.0.1:Database.EventStore.Internal.Types’
haha
I was like "wat" for a moment
well done
Akii
@Akii
Jan 23 2017 19:21
btw, how can I handle an exception during sending events?
currently stuck
can't wrap my head around it
ppl suggest to just forkIO wait
Yorick Laupa
@YoEight
Jan 23 2017 19:43
nope
in Control.Exception
you have try
try :: Exception e => IO a -> IO (Either e a)
if you want to catch any exception, ask for SomeException type
Akii
@Akii
Jan 23 2017 20:00
yes but sendEvent(s) gives me back an Async WriteResult
from what I understand try would be out-of-scope for any exception thrown by performing the async
Yorick Laupa
@YoEight
Jan 23 2017 20:02
I meant res <- try $ wait a
nope because it will be captured by the atomically call of wait
Akii
@Akii
Jan 23 2017 20:10
yep
what I did is forkIO a waitCatch
appendTrackingsToStore con evs =
  void . forkIO $ do
    res <- waitCatch =<< appendTrackings con evs

    case res of
      Left err -> print err
      Right _ -> return ()
appendTrackings is just a wrapper for sendEvents
threads are very lightweight in Haskell but I still thought that's weird
now the async itself spawns a thread and waiting on its completion uses another thread
Akii
@Akii
Jan 23 2017 21:54
I might've found another thing
Akii
@Akii
Jan 23 2017 22:03
nope nvm
although it was weird
okay, applying 80k events is nothing
very pleased :D
although it looks like lazy evaluation again :D