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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:39:32+00:00 2026-05-20T03:39:32+00:00

Using F# for the first time for a production thing and need a little

  • 0

Using F# for the first time for a production thing and need a little help. Please see this code where I added the warnings I get as comments on each line:

type AssetClass = 
    | Corp
    | Corp_SME
    | Res_Mort
    | Qual_Ret
    | Ret_Oth

let Correlation assetClass pd sales = 
    match assetClass with 
    | Corp -> 0.12 
    | CORP_SME -> 0.24 // warning FS0049: Uppercase variable identifiers
    | Res_Mort -> 0.15 // warning FS0026: This rule will never be matched
    | Qual_Ret -> 0.04 // warning FS0026: This rule will never be matched
    | Ret_Oth  -> 0.03 // warning FS0026: This rule will never be matched

I checked and it’s not bluffing, the third and other cases really are ignored. What am I not getting here? (The pd and sales inputs I do use in the real implementation, I just left out the formulas here.)

What I want to do is use the discriminated union as I would use an enum in C#, and then switch on it. So in C# I would have typed this:

    enum AssetClass {
        Corp,
        Corp_SME,
        Ret_Oth
    }

    float Correlation(AssetClass assetClass){
        switch(assetClass){
            case Corp: return 0.12; 
            case Corp_SME: return 0.12;
            case Ret_Oth: return 0.12; 
        }
    }

Could someone help me out?

Thanks in advance,

Gert-Jan

  • 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-20T03:39:32+00:00Added an answer on May 20, 2026 at 3:39 am

    You called your constructor Corp_SME but try to match it with CORP_SME (all caps). Since this is not the name of any constructor, F# assumes it’s a variable name (thus the warning about upper case variable names), which then of course matches everything not previously matched (thus the subsequent warnings).

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

Sidebar

Related Questions

this is my first time using StAX for parsing XML documents (still in the
Sorry, this is my first time using this forum. Apparently people can edit my
Creating a simple RPG game, first time using XNA. Trying to get my character
This is my first time using Drupal and I am loving it, but there
I've just starting using Autofac DI for the first time on a large production
This is not the first time I'm using this method to send a POST
First time using Asp.net-mvc and originally followed the NerdDinner tutorial. My form submit button
I am using JSON for first time... and want to fill my datagrid with
I want to deploy a website the first time using Rails 3.2.1 with capistrano
I'm writing a facebook desktop application for the first time using the PyFacebook api.

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.