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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:45:36+00:00 2026-05-26T16:45:36+00:00

Trying to figure out how to create a method that takes in a list

  • 0

Trying to figure out how to create a method that takes in a list of methods and another parameter. I have my method that I created in C# that I’m trying to carry over to F#:

public interface IValidator
{
    MethodResult Validate(IList<Func<userModel, MethodResult>> validationMethods
      , userModeltoValidate);
}

I’ve tried something like:

type public IValidator =
  abstract Validate : IList<(BasicUserModel -> MethodResult<'a>)>, BasicUserModel 
    -> MethodResult<'a>

But it doesn’t like the syntax even if I surround the parameter signature with parentheses. The end goal is to have a method that takes in a list of methods and run them by iterating through the list.

public MethodResult Validate(IList<Func<BasicUserModel, MethodResult>> validationMethods, 
   BasicUserModel toValidate)
{
   ...
}

The looping part I can get easily with F#, it’s the method signature syntax for both the abstract type and the type that’s implementing the method that’s killing me.

  • 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-26T16:45:37+00:00Added an answer on May 26, 2026 at 4:45 pm

    In the abstract method declaration, rather than separating the argument types with commas they should be separated by asterisks, as if the method took a tuple:

    abstract Validate : IList<(BasicUserModel -> MethodResult<'a>)> * BasicUserModel 
                             -> MethodResult<'a>  
    

    Here are a few other thoughts:

    1. Types are public by default, so you can omit the public keyword on your type declaration.
    2. It would be more idiomatic (and more flexible for callers) to take a seq<_> than an IList<_>, unless you’re likely to need random access rather than looping.
    3. I assume it’s intentional, but your F# validate method will be generic (since it returns a MethodResult<'a> using an undeclared type parameter 'a). If you want a non-generic method on a generic type, then add the 'a parameter to the type declaration: type IValidator<'a> = ....
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to figure out how to create a method that takes a
I am trying to figure out how to create 3 divs and have them
I'm trying to figure out the best way to create a class that can
I'm trying to figure out how to create additional calculated properties that are exposed
i am trying to figure out how to create a javascript alert box asking
I'm trying to figure out how to create personalized urls for double-byte languages. For
I am very new to Python, and trying to figure out how to create
I am trying to figure out the best way to create a view like
I am trying to figure out the best way to create a navigation menu
I am trying to figure out how to accomplish the following task: Create a

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.