ComposableExtensions


FSharp Composable Extensions

inlined composable fsharp functions around BCL static methods. Supports F# 3.0 or later with .NET runtimes v2.0,v4.0, Sliverlight 5.0 and WinRT

Examples

Composable.Linq.Enumerable

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
open Composable.Linq

seq { 1 .. 5 } |> Enumerable.reverse // seq [5; 4; 3; 2; ...]

Seq.empty<int> |> Enumerable.defaultIfEmpty // seq [0]

[("Rust", "Cohle"); ("Marty", "Hart"); ("Maggie", "Hart")]
    |> Enumerable.orderBy snd
    |> Enumerable.thenBy fst
  //seq [("Rust", "Cohle"); ("Maggie", "Hart"); ("Marty", "Hart")]

Composable.System.String

1: 
2: 
3: 
4: 
open Composable.System

["One";"Two";"Three"]
   |> Seq.filter (String.startsWith "T") // seq ["Two";"Three"]

API

See api-docs for wrapper functions

Use

To use precompiled dll, add with nuget

1: 
PM> Install-Package ComposableExtensions

Contribute

The generate target of the F# make file Make.fsx provides a mechansim to identify static base class libraries and alter their parameter order and write out the module on a per class basis.

The tool/Generate.fsx script provides the generalized api for generating those wrappers.

Note: inline non-mutating instance method

FSUnit xUnit tests can be added in .fsx files in the test directory.

Build

To build on Mono Build Status

1: 
./build.fsx

or on Windows Build status

1: 
fsi --exec build.fsx
namespace Composable
namespace Composable.Linq
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
module Enumerable

from Composable.Linq
val reverse : source:System.Collections.Generic.IEnumerable<'a> -> System.Collections.Generic.IEnumerable<'a>

Full name: Composable.Linq.Enumerable.reverse
module Seq

from Microsoft.FSharp.Collections
val empty<'T> : seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.empty
Multiple items
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
val defaultIfEmpty : source:System.Collections.Generic.IEnumerable<'a> -> System.Collections.Generic.IEnumerable<'a>

Full name: Composable.Linq.Enumerable.defaultIfEmpty
val orderBy : keySelector:('TSource -> 'TKey) -> source:System.Collections.Generic.IEnumerable<'TSource> -> System.Linq.IOrderedEnumerable<'TSource>

Full name: Composable.Linq.Enumerable.orderBy
val snd : tuple:('T1 * 'T2) -> 'T2

Full name: Microsoft.FSharp.Core.Operators.snd
val thenBy : keySelector:('TSource -> 'TKey) -> source:System.Linq.IOrderedEnumerable<'TSource> -> System.Linq.IOrderedEnumerable<'TSource>

Full name: Composable.Linq.Enumerable.thenBy
val fst : tuple:('T1 * 'T2) -> 'T1

Full name: Microsoft.FSharp.Core.Operators.fst
namespace Composable.System
val filter : predicate:('T -> bool) -> source:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.filter
Multiple items
module String

from Composable.System

--------------------
module String

from Microsoft.FSharp.Core
val startsWith : value:string -> {instance}:System.String -> bool

Full name: Composable.System.String.startsWith
namespace ComposableExtensions
Fork me on GitHub