如何在Mono中安装和使用F#Powerpack? [英] How to install and use F# Powerpack in Mono?
问题描述
我需要使用 F#powerpack 安装. 我在Mac上使用单声道版本2.10.2.
I need to install use F# powerpack. I use mono version 2.10.2 on Mac.
mono --version
Mono JIT compiler version 2.10.2 (tarball Mon Apr 18 09:14:01 MDT 2011)
Copyright (C) 2002-2011 Novell, Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: normal
Notification: kqueue
Architecture: x86
Disabled: none
Misc: debugger softdebug
LLVM: yes(2.9svn-mono)
GC: Included Boehm (with typed GC)
安装.
-
从此处下载powerpack zip文件.
Download the powerpack zip file from here.
将文件解压缩到目录~/bin
.
使用Powerpack
我在此页面中使用示例代码进行了测试.我命名为linq.fs
Using the powerpack
I tested with the sample code in this page. I name it linq.fs
open Microsoft.FSharp.Linq
let adderExpr = <@ fun i -> i + 1 @>.ToLinqExpression()
let adder = <@ fun i -> i + 1 @>.Compile()
问题
-
我遇到了
fsc linq.fs /r:FSharp.PowerPack.Linq.dll
错误.可能是什么问题?
I got errors with
fsc linq.fs /r:FSharp.PowerPack.Linq.dll
. What might be wrong?
/Users/smcho/Desktop/fs/powerpack/linq.fs(1,38):错误FS0039:未定义字段,构造函数或成员"ToLinqExpression"
/Users/smcho/Desktop/fs/powerpack/linq.fs(1,38): error FS0039: The field, constructor or member 'ToLinqExpression' is not defined
/Users/smcho/Desktop/fs/powerpack/linq.fs(2,34):错误FS0039:未定义字段,构造函数或成员"Compile"
/Users/smcho/Desktop/fs/powerpack/linq.fs(2,34): error FS0039: The field, constructor or member 'Compile' is not defined
我是否需要使用gacutil -i
安装所有dll?或者,仅将dll路径附加到PATH/MONO_PATH环境变量就足够了吗?
Do I need to install all the dll with gacutil -i
? Or, just appending the dll path to the PATH/MONO_PATH environment variable is just good enough?
推荐答案
您的安装过程似乎正确(只需解压缩并使用gacutil -i
安装).我认为该示例仅存在一个小问题-ToLinqExpression
扩展方法在需要显式打开的模块中可用,因此您的文件应为:
Your installation procedure seems to be correct (just unzip and install using gacutil -i
). I think there is just a minor issue with the sample - the ToLinqExpression
extension method is available in a module that needs to be explicitly opened, so your file should be:
编辑正确的模块名称实际上是Microsoft.FSharp.Linq.QuotationEvaluation
:
EDIT The right module name is actually Microsoft.FSharp.Linq.QuotationEvaluation
:
open Microsoft.FSharp.Linq.QuotationEvaluation
let adderExpr = <@ fun i -> i + 1 @>.ToLinqExpression()
let adder = <@ fun i -> i + 1 @>.Compile()
这篇关于如何在Mono中安装和使用F#Powerpack?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!