Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8097551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:47:53+00:00 2026-06-05T21:47:53+00:00

Edit : Note that, as Daniel and latkin noted in an answer and a

  • 0

Edit: Note that, as Daniel and latkin noted in an answer and a comment below, this question involved a bug in F# that seems to have been fixed in early 2014.

I’m trying to write a curried wrapper for Observable.StartWith. I’m using the prerelease Reactive Extensions 2.0, and the VS11 beta. My desired result would be startWith : 'a -> IObservable<'a> -> IObservable<'a>. The obvious implementation would be something like:

let startWith 
        (value : 'a) 
        (observable : IObservable<'a>) 
        : IObservable<'a> =
    Observable.StartWith(observable, [| value |])

The intended overload of Observable.StartWith is StartWith<'TSource>(source : IObservable<'TSource>, params values: 'TSource[]) : IObservable<'TSource>.

The compiler throws a confusing error: This method expects a CLI 'params' parameter in this position. 'params' is a way of passing a variable number of arguments to a method in languages such as C#. Consider passing an array for this argument.

I am passing an array. I also tried not passing an array, by omitting the [| |], which leads to a unique-overload-resolution failure. (Presumably due to the possibility that 'a could be System.Reactive.Concurrency.IScheduler, matching the other overload.) I also tried using F# 2.0/VS2010, which gives the same result. I couldn’t locate any online discussion of this sort of situation or of the compiler error message.

I can’t think of any other way to implement this. Note that in cases where the type parameter can be determined, it’s not a problem. For instance, let prependZero : int -> IObservable<int> -> IObservable<int> = fun n o -> o.StartWith(n) works fine. But a generic version would be nice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:47:54+00:00Added an answer on June 5, 2026 at 9:47 pm

    It looks like a problem with type inference surrounding generic param arrays. Even a simple case, not involving overload resolution, has problems:

    type A() = 
      static member M<'T>([<ParamArray>] args: 'T[]) = args
    
    //None of these work
    let m1 arg = A.M([|arg|])
    let m2 args = A.M(args)
    let m3<'T> (args:'T[]) = A.M<'T>(args)
    

    Non-generic versions work:

    type B() = 
      static member M([<ParamArray>] args: obj[]) = args
    
    //Both of these are okay
    let m1 arg = B.M([|arg|])
    let m2 args = B.M(args)
    

    EDIT

    I emailed fsbugs and they responded that this is a bug. Here are some workarounds they suggested.

    let m1 arg = A.M<obj>([|arg|])
    let m2 args = A.M<obj>(args)
    let m3 (args:obj[]) = A.M<obj>(args)
    let m4 (arg:obj) = A.M<obj>(arg)
    let m5 arg1 arg2 = A.M<obj>(arg1,arg2)
    let m6 (arg1:'T) = A.M<'T>(arg1)
    let m7 (arg1:'T) (arg2:'T) = A.M<'T>(arg1,arg2)
    let m8 (arg1:'T) (arg2:'T) = A.M(arg1,arg2)
    let m9 (arg1:'T) = A.M(arg1)
    let m10<'T> arg1 arg2 = A.M<'T>(arg1,arg2)
    let m11<'T> (arg1:'T) (arg2:'T) = A.M<'T>(arg1,arg2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
EDIT: See my answer below--> I am wanting to have a view that when
EDIT I added this note to explain why I keep this question here. I
[NOTE: I'm using ASP.NET MVC2 RC2.] I have URLs like this: /customers/123/orders/456/items/index /customers/123/orders/456/items/789/edit My
Edit (updated question) I have a simple C program: // it is not important
EDIT : It turned out that this can only be done through an external
EDIT: Note that due to the way hard drives actually write data, none of
EDIT: Please note that the app comes up just fine in Passenger/Apache2. Just not
Edit : Note that my final purpose here is not having the class working,
Edit note: After a seemingly enourmous amount of bad feedback MS got from their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.