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 784775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:46:00+00:00 2026-05-14T20:46:00+00:00

In F#, given the following class: type Foo() = member this.Bar<‘t> (arg0:string) = ignore()

  • 0

In F#, given the following class:

type Foo() =
    member this.Bar<'t> (arg0:string) = ignore()

Why does the following compile:

let f = new Foo()
f.Bar<Int32> "string"

While the following won’t compile:

let f = new Foo()
"string" |> f.Bar<Int32> //The compiler returns the error: "Unexpected type application"
  • 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-05-14T20:46:00+00:00Added an answer on May 14, 2026 at 8:46 pm

    It looks that providing type parameters when treating method as a first class value isn’t supported. I checked the F# specification and here are some important bits:

    14.2.2 Item-Qualified Lookup
    [If the application expression begins with:]

    • <types> expr, then use <types> as the type arguments and expr as the expression
      argument.
    • expr, then use expr as the expression argument.
    • otherwise use no expression argument or type arguments.
    • If the [method] is labelled with the
      RequiresExplicitTypeArguments attribute then explicit type arguments must have
      been given.

    If you specify type arguments and arguments, then the first case applies, but as you can see, the specification requires some actual arguments too. I’m not quite sure what is the motivation behind this, though.

    Anyway, if you use the type parameter anywhere in the type signature of the member, then you can specify it using type annotations like this:

    type Foo() = 
      member this.Bar<´T> (arg0:string) : ´T = 
        Unchecked.defaultof<´T>
    
    let f = new Foo()
    "string" |> (f.Bar : _ -> Int32)
    

    On the other hand, if you don’t use the type parameter anywhere in the signature, then I’m not quite sure why you need it in the first place. If you need it just for some runtime processing, then you may be able to take the runtime type representation as an argument:

    type Foo() = 
      member this.Bar (t:Type) (arg0:string) = ()
    
    let f = new Foo() 
    "string" |> f.Bar typeof<Int32>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.