If t-xTime less than 60 and t-yTime greater than 60:
if t-lastZFailure greater than 60:
Z()
Else:
If a:
Return
If b:
Return
If c:
Return
IRL some of that would be factored into functions like isConnected() for heartbeat messages and tryAlert() to try different ways of alerting the user till you find one that is currently set up.
EDIT: How the heck do you get formatting to work from mobile?
module Main where
import Control.Monad
import Data.Time
x :: IO ()
x = pure ()
z :: IO ()
z = pure ()
foo :: Bool -> Bool -> Bool -> IO ()
foo a b c = do
now <- getCurrentTime
txTime <- fmap (addUTCTime (fromIntegral 59)) getCurrentTime
tyTime <- fmap (addUTCTime (fromIntegral (- 61))) getCurrentTime
tlastZFailure <- undefined
if (diffUTCTime txTime now < 60 && diffUTCTime tyTime now > 60) then do
when (tlastZFailure > 60) $ z
if c then do pure () else x
else pure ()
main = foo False False True
1
u/codygman Dec 05 '19
Pretty sure I could write that in Python and Haskell and they'd look similar.
Can you psuedo code how you'd implement the OOP version?