|
F# comes with three libraries.
-
The .NET Library. F#'s true library is the vast platform that comes
standard as part of any .NET installation and which can be readily used from F#.
-
The Core Primitives (fslib.dll). F# provides a core library that contains some inbuilt-F#
constructs. This library also contains all the primitives you need to build
your own functional programming library without any dependencies on MLLib (you may want
to do this in order to develop a functional programming library that feels more natural to use from other
languages such as C#). Most of the constructs defined in this library live under
Microsoft.FSharp.Primitives, though some are in the namespace Microsoft.FSharp. In the future
this library will be expanded to contain more of the core constructs needed to build
alternative functional programming libraries.
-
The ML Library (mllib.dll). The third is the set of modules contained
under Microsoft.FSharp.MLLib, a library roughly compatible
with the design of a subset of the modules of the OCaml 3.06 library,
which is in turn similar to many other functional programming language
libraries developed over the years. Often these just wrap
the corresponding .NET libraries. One main purpose of the library is to
make cross-development between OCaml and F# code feasible. An additional aim
is to add additional constructs to give a more complete ML-style programming library.
The source code for both fslib.dll and mllib.dll is included
as sample code. MLLib give a minimalist but powerful standard functional progrmaming library that
lets you write code that will cross-compile as both OCaml and F# code. However,
you don't need to use MLLib, since you for most constructs you can program directly against
the .NET libraries. However, if you do not use it you will probably need to replace it
with a set of definitions or another library of your own design, since even simple operators like '+'
are defined in this library, though they are typically defined in terms of core
functionality provided in 'fslib.dll'.
All compilations currently implicitly reference
both mllib.dll and fslib.dll, though the former can be disabled
using the --no-mllib command line option.
You can use MLLib to programming such as I/O and data structure processing.
The data structures in the library (e.g. lists and hash tables)
are designed to work well in the context
of the ML-style mixed imperative/functional programming paradigm.
It is often
simpler often to access the .NET libraries dirctly, and in particular
the .NET counterpart to many other OCaml libraries tend to be easier to
use in practice, e.g. it may (or may not) be easier to
use System.Text.RegularExpressions
than to use the OCaml Regexp package, of
System.Net.Sockets
for the socket portion of the OCaml Unix library and
System.Windows.Forms
as a basic windowing package.
The modules in FSLib for this release are:
-
Idioms - C#-style idioms such as typeof, lock, foreach, box, unbox;
-
Compatibility.CompatArray - .NET compatible arrays, for use
if you need to access .NET code that uses array types from
when compiling your F# code to target version 1.0 or 1.1 of the CLR.
-
Math.BigNumber - Arbitrary precision rationals;
-
Math.BigInt - Arbitrary precision integers;
-
Experimental.Reflection - Access F# values using a generic representation
-
Primitives - Compiler-specific constructs and other primitive functionality for building a richer programming library
The modules supported in MLLib in this release are:
-
Arg -- argument processing
-
Array - polymorphic arrays
-
Buffer - string buffers, type equivalent to System.Text.StringBuilder;
-
Char - 16-bit unicode characters;
-
Filename - basic filename manipulations
-
Hashtbl - hashtables based on the polymorphic equality and hash operations. From v0.7 onwards
the module also supports general purpose hash tbale components where
the hash/equality functions are specified at the point of component-construction.
-
Byte, Int32, UInt32, Int64, UInt64 - Basic operations for fixed size integers
-
Float, Float32 - Basic operations for IEEE64 and IEEE32 floating point numbers
-
Lazy - Delayed computations, with sanity checking for recursive dependencies
-
List - Basic functional programming over lists
-
Map - immutable dictionaries using binary trees based on polymorphic comparison, also
general purpose map components where the comparison function is specified at
the point of component-construction.
-
Option - basic operations on the option type
-
Pervasives - basic I/O, and other definitions available in every scope
-
Printf- typesafe formatted printing
-
Set - immutable sets using balanced binary trees based on polymorphic comparison, also
general purpose set components where the comparison function is specified at
the point of component-construction.
-
Stream - immutable lazy streams, similar to Haskell lazy lists
-
String - basic operations on immutable strings
-
Vector - immutable arrays
The following additional modules are primarily of interest only for those cross-compiling OCaml code. The
fslib and/or .NET equivalents are recommended for those writing only F# code.
-
Printexc - printing exception values
-
Obj - OCaml-style operations on uniform representations of values
-
Sys - OCaml-style basic system calls
-
Big_int - OCaml-style interface to arbitrary sized integers
-
Num - OCaml-style interface to arbitrary sized rationals
-
Lexing, Parsing - OCaml-style interface to basic functionality related to fslex and fsyacc
|