+--------------------+--------------------+-------------------------+--------------------+
|Operation | F#+ / F# |F#+ Haskell Compatibility|Haskell |
+====================+====================+=========================+====================+
|List.append | @ | | ++ |
+--------------------+--------------------+-------------------------+--------------------+
|Function composition| f << g | f . (g) | f . g |
+--------------------+--------------------+-------------------------+--------------------+
| | <| | $ | $ |
+--------------------+--------------------+-------------------------+--------------------+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* =================================== | |
Code from my series of posts "Six approaches to dependency injection" | |
=================================== *) | |
open System | |
(* | |
## The requirements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#load @".paket\load\net452\FSharpPlus.fsx" | |
open FSharpPlus | |
open System | |
[<AutoOpen>] | |
module SideEffects = | |
let private r = Random() | |
let printLn text = async { printfn "%s" text } | |
let readLn() = async { return Console.ReadLine() } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r @"bin\Debug\FsControl.Core.dll" // from https://github.com/gmpl/FsControl | |
let inline return' x = Inline.instance FsControl.Core.TypeMethods.Applicative.Pure x | |
let inline (>>=) x (f:_->'R) : 'R = Inline.instance (FsControl.Core.TypeMethods.Monad.Bind, x) f | |
let inline mzero () = Inline.instance FsControl.Core.TypeMethods.MonadPlus.Mzero () | |
let inline mplus (x:'a) (y:'a) : 'a = Inline.instance (FsControl.Core.TypeMethods.MonadPlus.Mplus, x) y | |
module Monad = | |
open FsControl.Core.TypeMethods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r @"c:/packages/FSharpPlus.1.0.0-CI00099/lib/net45/FSharpPlus.dll" | |
open System | |
open FSharpPlus | |
// Validation definition | |
type Validation<'a,'e> = Success of 'a | Failure of 'e | |
with | |
// Validation is an instance of Applicative | |
static member inline Return x = Success x |