f#

How to use namespace or type alias/abbreviation?

北慕城南 提交于 2019-12-08 14:35:53
问题 What's the equivalent F# declaration to this C# declaration: using NR = ICSharpCode.NRefactory; 回答1: abbreviations in F# can be applied to modules: module ES = Microsoft.FSharp.Quotations.ExprShape and types type Thread = System.Threading.Thread unfortunatly just namespaces cannot be abbreviated 回答2: Equivalent F# declaration would be: type NR = ICSharpCode.NRefactory In F# it's called a type abreviation : http://msdn.microsoft.com/en-us/library/dd233246.aspx But ICSharpCode.NRefactory has to

Run F# 3.1 on Visual Studio 2012 (not express)

瘦欲@ 提交于 2019-12-08 13:37:12
问题 I was wondering if it is possible to run F# 3.1 on Visual studio 2012? if possible then what is the best way to do this? Thanks 回答1: You can't run the 3.1 Visual Studio integration components (e.g. the language service, project system, editor integration) on VS 2012, no. So any bug fixes or features there will not be available. But you can still build, run, debug projects against the F# 3.1 compiler and runtime from VS 2012. Install the latest release (3.1.1) from here. Create a new project

What should I know about the F# CTP?

别等时光非礼了梦想. 提交于 2019-12-08 13:17:06
问题 I want to start playing with f#. What is the CTP of F# about? Is it something I can use to install in vs2008? What about express? 回答1: CTP = Community Technology Preview The CTP should install ok into VS2008. I've installed it into the Visual Studio Shell with no problems (it works fine so long as the shell is installed prior to the CTP) See this blog entry for more info re. the CTP and the VS installation. 回答2: CTP = Community Technology Preview. You can download the F# msi and install it

How To Call WekaSharp Commands From C#

浪尽此生 提交于 2019-12-08 12:59:43
问题 Thank you all for you help on my F# and C# question and am really beginning to enjoy the fruits of the learning. I have asked a question like this before and I know these are on the line of the purposes of this forum, but I think this is useful and would provide some help to all us F# data miners out there :-). I am utilizing Yin Zhu's WekaSharp for my experiments and am interested in the rates of computation between F# and C#. I have written a snippet based on his example in the F# and would

F# Data Type Provider - Create with string variable

一个人想着一个人 提交于 2019-12-08 08:09:55
问题 In F# I have the following bit of code [<Literal>] let fname=fstFile.FullName.ToString() type genomeFile = CsvProvider<fname> Where fstFile is an instance of the FileInfo class. However, this fails with: This is not a valid constant expression or custom attribute value And I can't seem to create the type without an actual hard coded string. Does anyone know how to fix this? 回答1: The parameter to the CSV type provider needs to be a constant, so that the types can be generated at compile-time

Exception upon using FsCheck

孤街醉人 提交于 2019-12-08 07:40:53
问题 Upon running with xUnit the simplest test from FsCheck open FsCheck [<Property>] let revRevIsOrig (xs:list<int>) = List.rev(List.rev xs) = xs I receive the exception ---- System.InvalidCastException : Unable to cast object of type 'FsList@303[System.Int32]' to type 'FsCheck.Arbitrary`1[Microsoft.FSharp.Collections.FSharpList`1[System.Int32]]'. I tried to catch the exception and debug, but occurs before Would anyone have any clue on how to solve this ? Way to reproduce: make a new project

F# - “Not a valid property expression”

只愿长相守 提交于 2019-12-08 07:28:53
问题 I'm having this method which takes a Expr as parameter: member x.HasSeq (expr:Expr<'a -> 'b seq>) = let casted = <@ fun z -> (%expr) z :?> ICollection<'b> @> ManyNavPropertyInfo(cfg.HasMany <| toLinq casted) What I want is to cast the 'b seq to an ICollection<'b> , which seems to work as it should, however when it reaches the line where it's going to convert the Expr to LINQ (need to do this since cfg.HasMany excepts a System.Expression<Func<'a,ICollection<'b>>> ) it simply throws an

Error in example grammar for Fsyacc?

强颜欢笑 提交于 2019-12-08 07:21:04
问题 So I am trying to write a compiler in F# and have been looking at the Fslex and Fsyacc tools that come with the F# powerpack. There is a sample project that takes care of the external build tools that I have been trying to understand. It can be downloaded here. The example compiles and runs for me, but I think there is a subtle error in the grammar. I say subtle, because the grammar looks similar to what I have seen in the Dragon book for parsing expressions and I don't have the experience to

Automatic generation of record type based on MySql database tables, for use in FSharpDAL

你离开我真会死。 提交于 2019-12-08 07:07:15
问题 I have been using FSharpDAL to read data tables in Mysql database. It works well, but you have to provide it the record type. Which means for every table you have to define a record type. I would like to get the record type generated automaticly from the table schema. Also when the table column is nullable i would like the coresponding record field to be an option type. Is there something out there that can do this ? (until type providers arrive) Thanks a lot Note I have tried to do my

Implement CCR Interleave Arbiter in F#

旧巷老猫 提交于 2019-12-08 06:45:27
问题 I want to implement the concept of a Port of the CCR Framework in F# (as CCR is not officially supported for .Net 4.0). I know that one can use the MailboxProcessor class in F# to do this. This works perfectly for simple Receive Arbiters but I need the concept of the Interleave Arbiter, i.e. I want to control which messages are processed exclusively and which are processed concurrently. So far I've got no idea to implement this in F# and I would be grateful for your help. 回答1: I'm not very