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

  • SEARCH
  • Home
  • 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 8095409
In Process

The Archive Base Latest Questions

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

I keep running into the following problem: (System.Console.ReadLine ()).Split [|'(‘; ‘)’|] |> Array.filter (fun

  • 0

I keep running into the following problem:

(System.Console.ReadLine ()).Split [|'('; ')'|]
|> Array.filter (fun s -> not (System.String.IsNullOrEmpty (s)))
|> Array.map (fun s -> s.Split [|','|])
|> Array.map (fun s -> Array.map (fun t -> t.Trim ()) s) (* t.Trim () is underlined with a red squiggly line *)
|> [MORE CODE]

The error associated with the red squiggly line is:

Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.

But when the mouse pointer hovers over t, IntelliSense correctly says that t is of type string.

I can bypass the error by writing fun (t : string) -> [CODE], but I wonder why Visual Studio draws the squiggly line at all when it is already detecting the type of the variable correctly. Is this a simple bug in the trial build, or am I misunderstanding something about F#’s type inferencing?

Thanks in advance for your responses.

  • 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:07:12+00:00Added an answer on June 5, 2026 at 9:07 pm

    There is some gap between F# intellisense and F# type checker.

    The type checker works from left to right in order. Your problem can be fixed be changing:

    fun s -> Array.map (fun t -> t.Trim()) s
    

    to

    fun s -> s |> Array.map (fun t -> t.Trim())
    

    Since type of s is available before using Array.map, the type checker is able to infer type of t.

    Remarks:

    This error usually occurs when using instance methods. You could replace these methods by static functions with extra type annotation and refactor to make your code more composable:

    let split arr (s: string) = s.Split arr
    let trim (s: string) = s.Trim()
    
    System.Console.ReadLine()
    |> split [|'('; ')'|]
    |> Array.filter (not << System.String.IsNullOrEmpty)
    |> Array.map (split [|','|])
    |> Array.map (Array.map trim)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep running into this design problem, and I'm not happy with my solution
My application is following the MVC design pattern. The problem I keep running into
I'm trying to conduct a discriminant analysis and keep running into the following error:
TypeError: Result of expression 'this._configure' [undefined] is not a function. I keep running into
A problem I keep running into when writing code that draws images of scientific
I keep running into an error from the following statement: cursor.execute(INSERT into financial_statements (url)
Keep running into When using the multi-mapping APIs ensure you set the splitOn param
I keep running into the same testing Failure, and I can't figure out quite
I keep running into enq: TX - row lock contention, when I run the
I keep running into this error MemCacheError (Broken pipe): Broken pipe on my Rails

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.