title: how can I make a recursive async function in F#?
body: <p>I have the following:</p>
  <pre><code>let getCandlesFrom (exchange: IExchange) (instrument: Instrument) (interval: TimeSpan) (fromTime: DateTime) =
      let rec get (c: CandleData array) (f: DateTime) =
          let now = DateTime.UtcNow
          //info $&quot;requesting {f} - {now}&quot;
          let candles = exchange.GetCandles(instrument, interval, f, now)
          if candles.IsError then
              failwith candles.GetError.Describe
          else
              //info $&quot;received data {candles.Get.[0].Timestamp} - {candles.Get.[^0].Timestamp}&quot;
              let c = Array.append c candles.Get
              if c.[^0].Timestamp &lt; now - interval then
                  get c (c.[^0].Timestamp + interval)
              else
                  c
  
      get [||] fromTime
  </code></pre>
  <p>I would like to move the line:</p>
  <pre><code>let candles = exchange.GetCandles(instrument, interval, f, now)
  </code></pre>
  <p>to an async call:</p>
  <pre><code>let! candles = exchange.GetCandlesAsync(instrument, interval, f, now)
  </code></pre>
  <p>but if I wrap the whole function in an async block, the recursive function doesn't compile and I get this error:</p>
  <blockquote>
  <p>DataSource.fs(14, 13): [FS0588] The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result.</p>
  </blockquote>