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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:38:34+00:00 2026-05-18T12:38:34+00:00

I am writing a conversion function for units of measurements in F#. The information

  • 0

I am writing a conversion function for units of measurements in F#. The information regarding the values is coming from an ASP.NET web application.

The function I am creating is defined like this:

let convert (x:float<_>) (toType : string) =
  // Do conversion here.

The first problem I am running into involves the toType : string definition. Is there any way I can make define it to accept a float<_> type…particularly coming from the web application? (I know it’s part of the CLR based on Andrew Kennedy’s excellent articles, but I don’t see how to generically define it in the function.

Thanks for any help you can provide.

  • 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-18T12:38:35+00:00Added an answer on May 18, 2026 at 12:38 pm

    If you just want to be able to read in “2.0 ft” and “5.0 m” then

    • you should write code that parses the strings and does some conditional logic (e.g. if “ft” then turn into float<ft> or whatever)

    • once you have the data converted into the F# type system you can do things in a typesafe way

    This is typical of every app that wants to get strongly-typed data in from the outside world; there is an input component that must parse and validate the input and store it into a strongly-typed data structure, but then the program can use that data henceforth.

    (There’s no magical parser/input validator in any library, you just do it for your data types.)

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

Sidebar

Related Questions

I'm wondering if there is an equivalent function to PHP's call_user_func() in ASP.NET application.
Writing a .NET DLL how do I find Application.ProductName ? EDIT: Obviously, importing Windows.Forms
I'm writing a function to take shorthand values and convert them into a standardized
I am writing client for TCP connection and conversion from IP to socket_addr makes
I was writing a function for conversion between Decimal and Binary base number systems
In writing a function to convert between strings of different encodings (e.g. from UTF-8
I am writing a calendar-based web application and am working on some code that
I am writing a function decorator that will apply a conversion to the first
I'm writing a program which will use scan conversion on triangles to fill in
I'd like to add video conversion capabilities to a program I'm writing. FFmpeg's command

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.