Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install and use F# Powerpack in Mono?

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)

Installation.

  1. Download the powerpack zip file from here.

  2. Unzip the file to directory ~/bin.

  3. Add the ~/bin/FSharpPowerPack-1.9.9.9/bin to the PATH. I also add it to the MONO_PATH just in case. (I'm not sure if this is necessary or not)
  4. For the dlls in the ~/bin/FSharpPowerPack-1.9.9.9/bin/gac, use the command sudo gacutil -i <ALL_THE_FILES_IN_DLL>.dll

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()

Questions

  1. 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): error FS0039: The field, constructor or member 'ToLinqExpression' is not defined

    /Users/smcho/Desktop/fs/powerpack/linq.fs(2,34): error FS0039: The field, constructor or member 'Compile' is not defined

  2. 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?

like image 628
prosseek Avatar asked Jun 01 '11 19:06

prosseek


1 Answers

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:

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()
like image 63
Tomas Petricek Avatar answered Sep 18 '22 12:09

Tomas Petricek