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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:31:59+00:00 2026-06-11T19:31:59+00:00

let inline myfunction x y = … let inline mycurried = myfunction x //

  • 0
let inline myfunction x y = ...

let inline mycurried = myfunction x // error, only functions may be marked inline

It seems impossible to explicitly inline curried functions.
So whenever mycurried is called, it won’t get inlined even if myfunction is inlined properly, is it correct?

So can this be regarded as one of the drawback of curried function?

  • 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-11T19:32:01+00:00Added an answer on June 11, 2026 at 7:32 pm

    I think your question is whether a point-free function can be inlined or not.

    The limitation you found is not because of the curried function.
    Note that in your example the curried function is on the right side, on the left side you have a point-free function.

    F# only allows functions to be inline, not constants.

    I principle you may think this could be considered as a bug given that type inference is smart enough to find out that is a (point-free) function, but read the notes from Tomas regarding side-effects.

    Apparently when the compiler finds on the left side only an identifier it fails with this error:

    let inline myfunction x y = x + y
    
    let inline mycurried  = myfunction 1
    
    --> Only functions may be marked 'inline'
    

    As Brian said a workaround is adding an explicit parameter on both sides:

    let inline mycurried x  = (myfunction 1) x
    

    but then your function is no longer point-free, it’s the same as:

    let inline mycurried x  = myfunction 1 x
    

    Another way might be to add an explicit generic parameter:

    let inline mycurried<'a>  = myfunction 1
    

    when generic parameters are present explicitly on the left side it compiles.

    I wish they remove the error message and turn it a warning, something like:

    Since only functions can be 'inline' this value will be compiled as a function.
    

    UPDATE

    Thanks Tomas for your answer (and your downvote).

    My personal opinion is this should be a warning, so you are aware that the semantic of your code will eventually change, but then it’s up to you to decide what to do.

    You say that inline is “just an optimization” but that’s not entirely true:

    . Simply turning all your functions inline does not guarantee optimal code.

    . You may want to use static constraints and then you have to use inline.

    I would like to be able to define my (kind-of) generic constants, as F# library already does (ie: GenericZero and GenericOne). I know my code will be pure, so I don’t care if it is executed each time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let's say i have 3 functions inside a class : class Foo { inline
Let's assume my ASPX page has no inline C# code blocks. So, I can
I tried the following: let inline (|OpAdd|_|) (aty:Type, x:obj, y:obj) = if aty.Equals(typeof<'a>) then
I had to write 2 operators : let inline (|/>) (seqinit:seq<'a*'T>) f = seqinit
Let's say I have two functions: void foo() { // A big function }
F#'s inline functions with statically resolved generic parameters seem to be similar to C++'s
I'm using jqGrid with inline row editing and I want to let the user
I have this code let inline ProcessExpendableADGroups (input : ('a * SPUser) seq) =
Let there is a (display:inline) image on a white background: <a href=#><img src=...></a> Then
Manifest version 2 Content Security Policy do not let extension to run inline script.

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.