6

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?

prosseek
  • 182,215
  • 215
  • 566
  • 871

1 Answers1

4

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()
Tomas Petricek
  • 240,744
  • 19
  • 378
  • 553
  • I stumbled on this recently too. Was this changed in 2.0? – Daniel Jun 01 '11 at 19:59
  • I got `/Users/smcho/Desktop/fs/powerpack/linq.fs(1,28): error FS0039: The namespace 'QuotationEvaluator' is not defined` together with the original error message. I'm not sure I had to run `gacuitl -i` for the dlls not in the gac directory. – prosseek Jun 01 '11 at 20:00
  • @prosseek - Sorry, I got the module name wrong (should be `QuotationEvaluation`! Adding files to the GAC is not strictly necessary, you can just reference them with a full path and them copy them to the output location (same directory as your application). – Tomas Petricek Jun 01 '11 at 20:15
  • @Daniel - I don't know exactly, but I also think it must have changed. The feature is a bit limited, so my guess is that the F# team doesn't want to overly emphasize it... – Tomas Petricek Jun 01 '11 at 20:17
  • Thanks it works. BWT, I got some reference related error with the dll, so I asked another question at http://stackoverflow.com/questions/6207270/referencing-net-dll-when-compiliationwith-mono – prosseek Jun 01 '11 at 20:32
  • `gacutil -i Error: Option -i takes 1 argument` – mcandre Jan 20 '13 at 18:09