Hi how could one implement a function in concurrent haskell that either returns 'a' successfully or due timeout 'b'?

timed :: Int → IO a → b → IO (Either a b)
timed max act def = do

Best Regards,
Cetin Sert