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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:12:59+00:00 2026-06-09T22:12:59+00:00

This active pattern compiles with F# 2.0: let (|Value|_|) value = // ‘a ->

  • 0

This active pattern compiles with F# 2.0:

let (|Value|_|) value = // 'a -> 'T option
  match box value with
  | :? 'T as x -> Some x
  | _ -> None

but, in F# 3.0, emits the error:

Active pattern ‘|Value|_|’ has a result type containing type variables that are not determined by the input. The common cause is a [sic] when a result case is not mentioned, e.g. ‘let (|A|B|) (x:int) = A x’. This can be fixed with a type constraint, e.g. ‘let (|A|B|) (x:int) : Choice = A x’

I tried:

let (|Value|_|) value : 'T option = ...

and:

let (|Value|_|) (value: 'U) = ...

How can it be fixed?

Environments: Visual Studio 2012 (RTM) and FSI v11.0.50727.1

EDIT: Here’s a simpler repro:

let (|X|) x = unbox x
  • 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-09T22:13:01+00:00Added an answer on June 9, 2026 at 10:13 pm

    There was a bug in the F# 2.0 compiler where the compiler did incorrect analysis and bad code generation for certain Active Patterns with free type variables in the result; a simple repro is

    let (|Check|) (a : int) = a, None
    //let (|Check|) (a : int) = a, (None : int option)
    
    let check a = 
        match a with
        | Check (10, None) -> System.Console.WriteLine "10"
        | Check (20, None) -> System.Console.WriteLine "20"
    
    check 10
    check 20
    

    which generates a weird warning at compile-time and compiles into seemingly incorrect code. I am guessing that our attempt to fix this bug (and restrict some crazy cases) in F# 3.0 also broke some legal code as collateral damage of the fix.

    I’ll file another bug, but for F# 3.0, it sounds like you’ll need to use one of the workarounds mentioned in other answers.

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

Sidebar

Related Questions

I defined the active pattern Expression as follows: let (|Expression|_|) expression _ = Some(expression)
I'm rendering this Cmenu but the active class isn't showing on the li element
I have asked this question before - but I have spent some time thinking
I'm looking for something similar to this: Active navigation with jQuery - can't apply
The recommended solution is this: config.active_record.whitelist_attributes = true But this only works if you
I have the following: Javascript: $(.bg .thumb_wrapper).click(function() { $(.bg .thumb_wrapper).removeClass(active); $(this).addClass(active); }); So every
Here's my function to load my content: $(#site-nav .nav1).on('click', function () { $(this).addClass(nav-active); $('ul.top-level').load('assets/includes/recent.php',
This is my first time playing with Active Directory, as well as the Ajax
in this example http://sorgalla.com/projects/jcarousel/examples/static_controls.html i need an active state on li so it should
This function works as it should, window.setInterval(function(){ var active = $('#frontpageControls a.active'); var next

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.