title: Convert C# Array type web builder to F#
body: <p>I am new to F# and trying to convert the following Service Fabric Asp.Net core code from C# into F# and failing terribly. Can anyone help?</p>
  
  <pre><code>protected override IEnumerable&lt;ServiceInstanceListener&gt; CreateServiceInstanceListeners()
      {
          return new[]
          {
              new ServiceInstanceListener(serviceContext =&gt;
                  new KestrelCommunicationListener(serviceContext, "ServiceEndpoint", (url, listener) =&gt;
                  {
                      ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting Kestrel on {url}");
  
                      return Microsoft.AspNetCore.WebHost.CreateDefaultBuilder()
                                  .ConfigureAppConfiguration((builderContext, config) =&gt;
                                  {
                                      config.SetBasePath(builderContext.HostingEnvironment.ContentRootPath);
                                      config.AddJsonFile("appsettings.json", false);
                                      config.AddJsonFile($"appsettings.{builderContext.HostingEnvironment.EnvironmentName}.json", true);
                                      config.AddJsonFile("PackageRoot/Config/eventFlowConfig.json", optional: true, reloadOnChange: true);
                                      config.AddEnvironmentVariables();
                                  })
                                  .ConfigureServices(
                                      services =&gt;
                                      {
                                          services.AddSingleton&lt;StatelessServiceContext&gt;(serviceContext);
                                      })
                                  .UseStartup&lt;Startup&gt;()
                                  .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)
                                  .UseUrls(url)
                                  .Build();
                  }))
          };
      }
  </code></pre>
  
  <p>F#</p>
  
  <pre><code>module Service
  
  open Microsoft.ServiceFabric.Services.Runtime
  open Microsoft.ServiceFabric.Services.Communication.Runtime
  open Microsoft.ServiceFabric.Services.Communication.AspNetCore
  open Microsoft.AspNetCore.Hosting
  
  type Service(context) =
      inherit StatelessService(context)
  
      let builder = (fun url listener -&gt;  
          Microsoft.AspNetCore.WebHost.CreateDefaultBuilder().UseUrls(url).Build())
  
      let kestrelCommunicationListener ctx builder = new KestrelCommunicationListener(ctx, "ServiceEndPoint", builder)
      let serviceInstanceListener context ()  =  new ServiceInstanceListener(context kestrelCommunicationListener);
  
      override __.CreateServiceInstanceListeners() = 
          seq {
                  yield serviceInstanceListener(fun context -&gt; kestrelCommunicationListener builder)
              }
  </code></pre>