o-clock
o-clock copied to clipboard
Explore more API design choices for 'threadDelay'
Currently we have several ways to call threadDelay function:
threadDelay $ sec 5
threadDelay (5 :: Time Second)
threadDelay @Second 5
But we can have more! We can have other functions so it would be possible to write something like this:
timeDelay1 5 sec
timeDelay2 5 @Second
Does it look convenient? What do you think?
Inspired by this tweet:
- https://twitter.com/Axman6/status/959196484498472965
I think we can have both threadDelay @Second 5 and threadDelay 5 @Second work if we change the type signature like this:
threadDelay :: forall (unit :: Rat) m. (KnownDivRat unit Microsecond, MonadIO m) => Time unit -> forall unit'. (unit ~ unit') => m ()
I am not sure it's worth to complicate it for this minor convenience.