Favorite Tags
View questions based on your favorite tags across the Stack Exchange network

1 answer

Async POST fails on WP7 and F#

When I do let! read = from.AsyncRead buf in F#, it blocks and doesn't return until the TCP socket is dead. Why? And how do I fix it? Its code: module StreamUtil open System.IO /// copy from 'from' …

1 answer

F# compiler throws OutOfMemoryException

The project I use contains a lot of classes inherited from single base class. In unit tests I need to compare received results by types and data. When I use match comparison by types in the case when …

1 answer

F# compiler throws exception when invoked from spawned process

I spawn a new process and have it invoke the F# compiler like this: var exeName = args[0]; var commandLine = args[1]; using (var process = new Process()) { process.StartInfo = new ...

yesterday
4 answers

Where can I get the F# Compiler and FSI v4.0?

I know I can download the "April CTP" to get F# 2.0 for .NET 2.0. But I need FSC and F# Interactive for .NET 4.0. On a machine with VS 2010 installed, it ends up in C:\Program Files (x86)\Microsoft …

yesterday
2 answers

Generic functions in F#

I'm still trying to wrap my head around how F# generalizes (or not) functions and types, and there's a case that's bugging me: let min(a, b) = if a < b then a else b let add(a, b) = a + b let …

1 answer

Type inference: functions vs types

I am learning F# and I don't understand how type inference and generics work in this language. For example, I can declare a generic min function and use it with parameters of different types: let min …

yesterday
4 answers

Scala only language with overloaded extractors?

In at least some of the ML family languages, you can define records on which you can perform pattern matching e.g. http://learnyouahaskell.com/making-our-own-types-and-typeclasses - the basic idea is …

2 answers

Is it possible to pass parameters to F# modules?

I'm new to F# and learning the basics. I have two modules. A generic one for tree data structures called Tree: module Tree let rec getDescendants getChildren node = seq { yield node …

2 days ago
2 answers

Converting OCaml to F#: can F# map a list of values directly to a list of identifiers?

I am converting several modules based on OCaml to F# and ran into something like this let [x; y; z] = map func1 ["a"; "b"; "c"] where [x; y; z] is a list of identifiers and map func1 ["a"; "b"; …

2 days ago
1 answer

Bogus “Duplicate definition of value” error from the F# compiler

The F# compiler sometimes rejects my code with a compile-time error of the form Duplicate definition of value foo pointing at a definition like this: let foo = ref 0 even though this is not a ...

2 days ago
4 answers

F# pattern matching on types of tuples

I have a curried function that I'd like it to support different types of parameters, that are not on a inheritance relationship: type MyType1 = A | B of float type MyType2 = C | D of int What I ...

May 13 at 4:53
2 answers

TypeProviders and [<Generate>] type not defined

I am playing a little with type providers using DemoScripts from http://blogs.msdn.com/b/dsyme/archive/2011/10/05/demo-scripts-from-the-f-3-0-build-talk.aspx and I am getting message which is really …

May 12 at 19:47
0 answers

Resolving compile-time references to different versions of the same .NET assembly in the same application

Using PowerPack in F# application targeting .NET 4.0 causes some pain FSharp.PowerPack.dll is still (Why? Are they going to give up with it?) referencing only FSharp.Core.dll 2.0 which targets .NET …

May 12 at 12:41
1 answer

Reflection error when using F# sprintf “%A” on Windows Phone

I have a set of F# record types like this: type Course = { Id : int Title : string Instructor : string Duration : string StartDate : string IconUrl : string …

May 11 at 20:45
2 answers

F# quotations on Windows Phone

I'm using Daniel Mohl's F# templates for Windows phone, but it seems the bundled FSharp.Core doesn't have some of the quotations code. I'm trying to port this code from regular .NET: open ...

May 11 at 20:43
2 answers

F# converting a string to a float

I have a simple problem that I haven't been able to figure out. I have a program that's supposed to read a float from input. Problem is it will come as string and I can't for the life of me figure out …

1 answer

pipe record to object param list

Given i have the type: type NewsMessage(identifier:string, headline:string) and this record: type NewsMessageParams = { identifier:string headline:string } Is there an implicit way to …

May 11 at 18:16
9 answers

What's wrong with F#?

What's wrong with F#? That is, what about the language would make it unsuitable for production environments (excluding the fact that it's not yet officially graduated from MS Research)? I'm ...

1 answer

different output with mono on linux as on visual studio on win7 with calling a webservice

I use the Exchange webservices to extract attachments from exchange mailserver. When i call the code on linux with mono a certain text attachment contain some mixed-up strings. like so "sam winglin …

May 11 at 12:51
1 answer

F# Debugging. CLR

I want to have a bit more of a look at the resulting ASM (F#->IL->ASM) that is generated for certain functions, purely out of curiosity & learning. Answer in my mind is to use SOS.dll, but I have …

May 11 at 2:35
5 answers

How can I make a function for solving a factorial using F#?

A factorial is a number that multiplies itself and minus one and so on and so forth until it reaches zero. For example !5! = 5 * 4 * 3 * 2 * 1 How would I declare a recursive function for this? ...

May 10 at 21:38
5 answers

F# exception handling constructs

Why doesn't F# naturally support a try/with/finally block? Doesn't it make sense to try something, deal with whatever exception it throws, at least to log the exception, and then be sure that some …

May 10 at 19:02
2 answers

Using F# to calculate triangle

I'm trying to write a program to calculate triangles. Can anyone give me a short code in F# sharp for this calculation? This is what I have so far, but I'm not convinced it's the best way: let ...

May 10 at 13:24
4 answers

Idiomatic way to “merge” multiple lists of the same length in F#?

I have a number of lists - each instance of which contains 9 floating point numbers. What I effectively need to do is produce one new list that takes the first element from each of my lists and adds …

2 answers

Loading an unmanaged DLL using LoadLibrary in an ASP.NET web site

I'm working on an ASP.NET web site, developing in Visual Studio 2010. Most of the site is written in managed code (F# and C#), but it uses an unmanaged DLL (QuickPDF) for some of its functionality. …

May 9 at 21:23
5 answers

Seq.iter vs for - what difference?

I can do for event in linq.Deltas do or I can do linq.Deltas |> Seq.iter(fun event -> So I'm not sure if that is the same. If that is not the same I want to know the difference. I can't …

May 9 at 20:32
3 answers

Constructing the Connection String for the DataContext Class

I see a couple of DataContext connection string questions. I'm going to try to differentiate this one a bit: How does one construct a generic connection string to a database, localhost | ...

4 answers

sum 2 lists and get 3rd in f#, please correct my syntax

I'm trying to achieve this: 7 2 3 5 10 12 20 res = 10 + max(7,2) ; 12 + max(2,3); 20 + max(3,5) this is my code so far: //prevline.count is always currLine.count+1 let getResLine currLine ...

May 9 at 9:09
2 answers

Stub a record in F#

Since F# records are really sealed classes, i cannot stub a record type. Is there an attribute i can put on a record in F# so that it is not compiled as sealed so that i can stub the record? type ...

May 8 at 21:47
4 answers

Does the Microsoft's .net CLR inline small functions at run-time?

Does such feature exist? Something like Java HotSpot running in server mode, but for .Net applications. EDIT: Little more information. I have small application (written in F#) and I have lots of ...

May 8 at 15:42
15 30 50 per page
1 2 3