News for hackers. Stuff that matters.
Re:Functional Imperative Programming with Elixir (2018) by wwright on Thursday November 21, 2019 @06:57AM (#21593249)
Haskell has monadic loops (https://hackage.haskell.org/package/monad-loops-0.4.3/docs/C...):

    let limit = secondsToDiffTime 60
    start <- getCurrentTime

    iterateUntil id $ andM 
      [ someApplicationLogicReturningBoolean
      , do    
        now <- getCurrentTime
        return $ (diffUtcTime start now) >= limit
      ]
This is a really rough sketch from someone who just looked all this up, of course :-)

Recursion is probably still much more natural here.

There are no comments on this comment yet.