val square : x:int -> int

Full name: Index.square
val x : int
val xs : int list

Full name: Index.xs
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member GetSlice : startIndex:int option * endIndex:int option -> 'T list
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
val filter : predicate:('T -> bool) -> list:'T list -> 'T list

Full name: Microsoft.FSharp.Collections.List.filter
val map : mapping:('T -> 'U) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.map
val add : x:int -> y:int -> int

Full name: Index.add
val y : int
val add5 : (int -> int)

Full name: Index.add5
val newResult : int

Full name: Index.newResult
val x : 'a
val f : ('a -> 'b)
val nine : unit

Full name: Index.nine
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val g : ('a -> 'b)
val b : int

Full name: Index.b
val thedarkside : int

Full name: Index.thedarkside
val λ : int

Full name: index.λ
val ( The output of this test shpuld = 💩 ) : int
type Bacon =
  | Uncooked
  | Chewy
  | Crispy

Full name: Index.Bacon
union case Bacon.Uncooked: Bacon
union case Bacon.Chewy: Bacon
union case Bacon.Crispy: Bacon
type Tree<'Data> =
  | Empty
  | Node of Tree<'Data> * 'Data * Tree<'Data>

Full name: Index.Tree<_>
namespace Microsoft.FSharp.Data
union case Tree.Empty: Tree<'Data>
union case Tree.Node: Tree<'Data> * 'Data * Tree<'Data> -> Tree<'Data>
val baconTree : Tree<Bacon>

Full name: Index.baconTree
type value =
  | Bool of bool
  | Int of int
  | Double of double
  | String of string

Full name: Index.value
union case value.Bool: bool -> value
type bool = System.Boolean

Full name: Microsoft.FSharp.Core.bool
union case value.Int: int -> value
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<_>
union case value.Double: double -> value
Multiple items
val double : value:'T -> double (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.double

--------------------
type double = System.Double

Full name: Microsoft.FSharp.Core.double
Multiple items
union case value.String: string -> value

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

from Microsoft.FSharp.Core
Multiple items
val string : value:'T -> string

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

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
type logical =
  | Or
  | And
  | OrElse
  | AndAlso

Full name: Index.logical
union case logical.Or: logical
union case logical.And: logical
union case logical.OrElse: logical
union case logical.AndAlso: logical
type comparison =
  | Eq
  | Neq
  | Gt
  | Lt
  | LtEq
  | GtEq

Full name: Index.comparison
union case comparison.Eq: comparison
union case comparison.Neq: comparison
union case comparison.Gt: comparison
union case comparison.Lt: comparison
union case comparison.LtEq: comparison
union case comparison.GtEq: comparison
type identifier = string

Full name: Index.identifier
type location = | Index of int

Full name: Index.location
union case location.Index: int -> location
type invoke = unit -> unit

Full name: Index.invoke
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
type arithmetic =
  | Add
  | Mul
  | Div
  | Sub

Full name: Index.arithmetic
union case arithmetic.Add: arithmetic
union case arithmetic.Mul: arithmetic
union case arithmetic.Div: arithmetic
union case arithmetic.Sub: arithmetic
type expression =
  | Literal of value
  | Var of identifier
  | GetAt of location
  | Func of invoke
  | Neg of expression
  | Arithmetic of expression * arithmetic * expression
  | Comparison of expression * comparison * expression
  | Logical of expression * logical * expression

Full name: Index.expression
Multiple items
union case expression.Literal: value -> expression

--------------------
type LiteralAttribute =
  inherit Attribute
  new : unit -> LiteralAttribute

Full name: Microsoft.FSharp.Core.LiteralAttribute

--------------------
new : unit -> LiteralAttribute
union case expression.Var: identifier -> expression
union case expression.GetAt: location -> expression
union case expression.Func: invoke -> expression
union case expression.Neg: expression -> expression
union case expression.Arithmetic: expression * arithmetic * expression -> expression
union case expression.Comparison: expression * comparison * expression -> expression
union case expression.Logical: expression * logical * expression -> expression
type label = string

Full name: Index.label
type assign = | Set of identifier * expression

Full name: Index.assign
Multiple items
union case assign.Set: identifier * expression -> assign

--------------------
module Set

from Microsoft.FSharp.Collections

--------------------
type Set<'T (requires comparison)> =
  interface IComparable
  interface IEnumerable
  interface IEnumerable<'T>
  interface ICollection<'T>
  new : elements:seq<'T> -> Set<'T>
  member Add : value:'T -> Set<'T>
  member Contains : value:'T -> bool
  override Equals : obj -> bool
  member IsProperSubsetOf : otherSet:Set<'T> -> bool
  member IsProperSupersetOf : otherSet:Set<'T> -> bool
  ...

Full name: Microsoft.FSharp.Collections.Set<_>

--------------------
new : elements:seq<'T> -> Set<'T>
type instruction =
  | Assign of assign
  | SetAt of location * expression
  | PropertySet of string * string * expression
  | Action of invoke
  | For of assign * expression * expression
  | EndFor
  | If of expression
  | ElseIf of expression
  | Else
  | EndIf
  ...

Full name: Index.instruction
union case instruction.Assign: assign -> instruction
union case instruction.SetAt: location * expression -> instruction
union case instruction.PropertySet: string * string * expression -> instruction
union case instruction.Action: invoke -> instruction
union case instruction.For: assign * expression * expression -> instruction
union case instruction.EndFor: instruction
union case instruction.If: expression -> instruction
union case instruction.ElseIf: expression -> instruction
union case instruction.Else: instruction
union case instruction.EndIf: instruction
union case instruction.While: expression -> instruction
union case instruction.EndWhile: instruction
union case instruction.Sub: identifier -> instruction
union case instruction.EndSub: instruction
union case instruction.GoSub: identifier -> instruction
union case instruction.Label: label -> instruction
union case instruction.Goto: label -> instruction
namespace FParsec
module CharParsers

from FParsec
module Primitives

from FParsec
namespace System
val ptrue : Parser<bool,unit>

Full name: Index.ptrue
val pstring : string -> Parser<string,'u>

Full name: FParsec.CharParsers.pstring
val pfalse : Parser<bool,unit>

Full name: Index.pfalse
val pbool : Parser<value,unit>

Full name: Index.pbool
val x : bool
val pint : Parser<value,unit>

Full name: Index.pint
val pint32 : Parser<int32,'u>

Full name: FParsec.CharParsers.pint32
val n : int32
val pvalue : Parser<value,unit>

Full name: Index.pvalue
val pliteral : Parser<expression,unit>

Full name: Index.pliteral
val x : value
val result : ParserResult<bool,unit>

Full name: Index.result
val run : Parser<'Result,unit> -> string -> ParserResult<'Result,unit>

Full name: FParsec.CharParsers.run
val eval : expr:expression -> value

Full name: Index.eval
val expr : expression
Multiple items
val value : value

--------------------
type value =
  | Bool of bool
  | Int of int
  | Double of double
  | String of string

Full name: Index.value
val expr1 : expression
Multiple items
val logical : logical

--------------------
type logical =
  | Or
  | And
  | OrElse
  | AndAlso

Full name: Index.logical
val expr2 : expression
val a : bool
val b : bool
val a : int
val b : int
type Convert =
  static val DBNull : obj
  static member ChangeType : value:obj * typeCode:TypeCode -> obj + 3 overloads
  static member FromBase64CharArray : inArray:char[] * offset:int * length:int -> byte[]
  static member FromBase64String : s:string -> byte[]
  static member GetTypeCode : value:obj -> TypeCode
  static member IsDBNull : value:obj -> bool
  static member ToBase64CharArray : inArray:byte[] * offsetIn:int * length:int * outArray:char[] * offsetOut:int -> int + 1 overload
  static member ToBase64String : inArray:byte[] -> string + 3 overloads
  static member ToBoolean : value:obj -> bool + 17 overloads
  static member ToByte : value:obj -> byte + 18 overloads
  ...

Full name: System.Convert
Convert.ToBoolean(value: DateTime) : bool
   (+0 other overloads)
Convert.ToBoolean(value: decimal) : bool
   (+0 other overloads)
Convert.ToBoolean(value: float) : bool
   (+0 other overloads)
Convert.ToBoolean(value: float32) : bool
   (+0 other overloads)
Convert.ToBoolean(value: string) : bool
   (+0 other overloads)
Convert.ToBoolean(value: uint64) : bool
   (+0 other overloads)
Convert.ToBoolean(value: int64) : bool
   (+0 other overloads)
Convert.ToBoolean(value: uint32) : bool
   (+0 other overloads)
Convert.ToBoolean(value: int) : bool
   (+0 other overloads)
Convert.ToBoolean(value: uint16) : bool
   (+0 other overloads)
val failwith : message:string -> 'T

Full name: Microsoft.FSharp.Core.Operators.failwith
val s : string
type Int32 =
  struct
    member CompareTo : value:obj -> int + 1 overload
    member Equals : obj:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member GetTypeCode : unit -> TypeCode
    member ToString : unit -> string + 3 overloads
    static val MaxValue : int
    static val MinValue : int
    static member Parse : s:string -> int + 3 overloads
    static member TryParse : s:string * result:int -> bool + 1 overload
  end

Full name: System.Int32
Int32.TryParse(s: string, result: byref<int>) : bool
Int32.TryParse(s: string, style: Globalization.NumberStyles, provider: IFormatProvider, result: byref<int>) : bool
val n : int
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
type Double =
  struct
    member CompareTo : value:obj -> int + 1 overload
    member Equals : obj:obj -> bool + 1 overload
    member GetHashCode : unit -> int
    member GetTypeCode : unit -> TypeCode
    member ToString : unit -> string + 3 overloads
    static val MinValue : float
    static val MaxValue : float
    static val Epsilon : float
    static val NegativeInfinity : float
    static val PositiveInfinity : float
    ...
  end

Full name: System.Double
Double.TryParse(s: string, result: byref<float>) : bool
Double.TryParse(s: string, style: Globalization.NumberStyles, provider: IFormatProvider, result: byref<float>) : bool
val d : float
val checkInput : s:string -> string

Full name: Index.checkInput
active recognizer Integer: string -> int option

Full name: Index.( |Integer|_| )
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
active recognizer Float: string -> float option

Full name: Index.( |Float|_| )
namespace System.Drawing
val col : Color
type Color =
  struct
    member A : byte
    member B : byte
    member Equals : obj:obj -> bool
    member G : byte
    member GetBrightness : unit -> float32
    member GetHashCode : unit -> int
    member GetHue : unit -> float32
    member GetSaturation : unit -> float32
    member IsEmpty : bool
    member IsKnownColor : bool
    ...
  end

Full name: System.Drawing.Color
property Color.R: byte
property Color.G: byte
property Color.B: byte
Color.GetHue() : float32
Color.GetSaturation() : float32
Color.GetBrightness() : float32
val checkColour : c:Color -> string

Full name: Index.checkColour
val c : Color
active recognizer HSB: Color -> float32 * float32 * float32

Full name: Index.( |HSB| )
val h : float32
val s : float32
val b : float32
active recognizer RGB: Color -> byte * byte * byte

Full name: Index.( |RGB| )
val r : byte
val g : byte
val b : byte
val b : Bacon
val baconresult : string

Full name: Index.baconresult
active recognizer Delicious: Bacon -> Choice<string,int>

Full name: Index.( |Delicious|Eww| )
active recognizer Eww: Bacon -> Choice<string,int>

Full name: Index.( |Delicious|Eww| )
val temp : int
Multiple items
type MeasureAttribute =
  inherit Attribute
  new : unit -> MeasureAttribute

Full name: Microsoft.FSharp.Core.MeasureAttribute

--------------------
new : unit -> MeasureAttribute
[<Measure>]
type m

Full name: Index.m
[<Measure>]
type s

Full name: Index.s
[<Measure>]
type kg

Full name: Index.kg
val distance : float<m>

Full name: Index.distance
val time : float<s>

Full name: Index.time
val velocity : float<m/s>

Full name: Index.velocity
val initialVelocity : float<m/s>

Full name: Index.initialVelocity
val mass : float<kg>

Full name: Index.mass
val acceleration : float<m/s ^ 2>

Full name: Index.acceleration
val force : float<kg m/s ^ 2>

Full name: Index.force
[<Measure>]
type N = kg m/s ^ 2

Full name: Index.N
val forceDifference : float<kg m/s ^ 2>

Full name: Index.forceDifference
val momentum : float<kg m/s>

Full name: Index.momentum
Multiple items
val float : value:'T -> float (requires member op_Explicit)

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

--------------------
type float = Double

Full name: Microsoft.FSharp.Core.float

--------------------
type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>
[<Measure>]
type C

Full name: Index.C
[<Measure>]
type F

Full name: Index.F
val CtoF : c:float<C> -> float<F>

Full name: Index.CtoF
val c : float<C>
val Far : float<F>

Full name: Index.Far
val urls : seq<string>

Full name: Index.urls
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

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

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

Full name: Microsoft.FSharp.Collections.seq<_>
val i : int
Int32.ToString() : string
Int32.ToString(provider: IFormatProvider) : string
Int32.ToString(format: string) : string
Int32.ToString(format: string, provider: IFormatProvider) : string
Multiple items
val list : string list

Full name: Index.list

--------------------
type 'T list = List<'T>

Full name: Microsoft.FSharp.Collections.list<_>
module Seq

from Microsoft.FSharp.Collections
val toList : source:seq<'T> -> 'T list

Full name: Microsoft.FSharp.Collections.Seq.toList
namespace System.Net
namespace System.Net.Http
val longRunning : url:string -> Async<HttpResponseMessage>

Full name: Index.longRunning
val url : string
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
val client : HttpClient
Multiple items
type HttpClient =
  inherit HttpMessageInvoker
  new : unit -> HttpClient + 2 overloads
  member BaseAddress : Uri with get, set
  member CancelPendingRequests : unit -> unit
  member DefaultRequestHeaders : HttpRequestHeaders
  member DeleteAsync : requestUri:string -> Task<HttpResponseMessage> + 3 overloads
  member GetAsync : requestUri:string -> Task<HttpResponseMessage> + 7 overloads
  member GetByteArrayAsync : requestUri:string -> Task<byte[]> + 1 overload
  member GetStreamAsync : requestUri:string -> Task<Stream> + 1 overload
  member GetStringAsync : requestUri:string -> Task<string> + 1 overload
  member MaxResponseContentBufferSize : int64 with get, set
  ...

Full name: System.Net.Http.HttpClient

--------------------
HttpClient() : unit
HttpClient(handler: HttpMessageHandler) : unit
HttpClient(handler: HttpMessageHandler, disposeHandler: bool) : unit
val result : HttpResponseMessage
Multiple items
type Uri =
  new : uriString:string -> Uri + 5 overloads
  member AbsolutePath : string
  member AbsoluteUri : string
  member Authority : string
  member DnsSafeHost : string
  member Equals : comparand:obj -> bool
  member Fragment : string
  member GetComponents : components:UriComponents * format:UriFormat -> string
  member GetHashCode : unit -> int
  member GetLeftPart : part:UriPartial -> string
  ...

Full name: System.Uri

--------------------
Uri(uriString: string) : unit
Uri(uriString: string, uriKind: UriKind) : unit
Uri(baseUri: Uri, relativeUri: string) : unit
Uri(baseUri: Uri, relativeUri: Uri) : unit
HttpClient.GetAsync(requestUri: Uri) : Threading.Tasks.Task<HttpResponseMessage>
HttpClient.GetAsync(requestUri: string) : Threading.Tasks.Task<HttpResponseMessage>
HttpClient.GetAsync(requestUri: Uri, cancellationToken: Threading.CancellationToken) : Threading.Tasks.Task<HttpResponseMessage>
HttpClient.GetAsync(requestUri: string, cancellationToken: Threading.CancellationToken) : Threading.Tasks.Task<HttpResponseMessage>
HttpClient.GetAsync(requestUri: Uri, completionOption: HttpCompletionOption) : Threading.Tasks.Task<HttpResponseMessage>
HttpClient.GetAsync(requestUri: string, completionOption: HttpCompletionOption) : Threading.Tasks.Task<HttpResponseMessage>
HttpClient.GetAsync(requestUri: Uri, completionOption: HttpCompletionOption, cancellationToken: Threading.CancellationToken) : Threading.Tasks.Task<HttpResponseMessage>
HttpClient.GetAsync(requestUri: string, completionOption: HttpCompletionOption, cancellationToken: Threading.CancellationToken) : Threading.Tasks.Task<HttpResponseMessage>
Multiple items
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task -> Async<unit>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken

Full name: Microsoft.FSharp.Control.Async

--------------------
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>
static member Async.AwaitTask : task:Threading.Tasks.Task -> Async<unit>
static member Async.AwaitTask : task:Threading.Tasks.Task<'T> -> Async<'T>
val text : Async<HttpResponseMessage []>

Full name: Index.text
val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U>

Full name: Microsoft.FSharp.Collections.Seq.map
static member Async.Parallel : computations:seq<Async<'T>> -> Async<'T []>
val bind : f:('a -> 'b option) -> xOpt:'a option -> 'b option

Full name: Index.bind
val f : ('a -> 'b option)
val xOpt : 'a option
Multiple items
type MaybeBuilder =
  new : unit -> MaybeBuilder
  member Bind : m:'b option * f:('b -> 'c option) -> 'c option
  member Return : x:'a -> 'a option

Full name: Index.MaybeBuilder

--------------------
new : unit -> MaybeBuilder
val this : MaybeBuilder
member MaybeBuilder.Bind : m:'b option * f:('b -> 'c option) -> 'c option

Full name: Index.MaybeBuilder.Bind
val m : 'b option
val f : ('b -> 'c option)
member MaybeBuilder.Return : x:'a -> 'a option

Full name: Index.MaybeBuilder.Return
val maybe : MaybeBuilder

Full name: Index.maybe
val optR : one:int option -> two:int option -> three:int option -> int option

Full name: Index.optR
val one : int option
val two : int option
val three : int option
val z : int
val optRe : one:int option -> two:int option -> three:int option -> int option

Full name: Index.optRe
val opt : int option

Full name: Index.opt
val opt2 : int option

Full name: Index.opt2
val products : Map<string,int>

Full name: Index.products
Multiple items
module Map

from Microsoft.FSharp.Collections

--------------------
type Map<'Key,'Value (requires comparison)> =
  interface IEnumerable
  interface IComparable
  interface IEnumerable<KeyValuePair<'Key,'Value>>
  interface ICollection<KeyValuePair<'Key,'Value>>
  interface IDictionary<'Key,'Value>
  new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
  member Add : key:'Key * value:'Value -> Map<'Key,'Value>
  member ContainsKey : key:'Key -> bool
  override Equals : obj -> bool
  member Remove : key:'Key -> Map<'Key,'Value>
  ...

Full name: Microsoft.FSharp.Collections.Map<_,_>

--------------------
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
val empty<'Key,'T (requires comparison)> : Map<'Key,'T> (requires comparison)

Full name: Microsoft.FSharp.Collections.Map.empty
Multiple items
val string : value:'T -> string

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

--------------------
type string = String

Full name: Microsoft.FSharp.Core.string
val add : key:'Key -> value:'T -> table:Map<'Key,'T> -> Map<'Key,'T> (requires comparison)

Full name: Microsoft.FSharp.Collections.Map.add
val customers : Map<string,int>

Full name: Index.customers
type Order =
  {Customer: int;
   Product: int;}

Full name: Index.Order
Order.Customer: int
Order.Product: int
val orderProduct : customerKey:string -> productKey:string -> Order option

Full name: Index.orderProduct
val customerKey : string
val productKey : string
val tryFind : key:'Key -> table:Map<'Key,'T> -> 'T option (requires comparison)

Full name: Microsoft.FSharp.Collections.Map.tryFind
val cust : int
val prod : int
val prod : Order
val orderProduct2 : customerKey:string -> productKey:'a -> Order option

Full name: Index.orderProduct2
val productKey : 'a
val result : Order
val a : int

Full name: Index.a
val factorial : x:int -> int

Full name: Index.factorial
val reduce : reduction:('T -> 'T -> 'T) -> list:'T list -> 'T

Full name: Microsoft.FSharp.Collections.List.reduce
val c : int

Full name: Index.c

FSharp Primer

F#

A look at F# from a pragmatic and practical point of view

Language

  • Designed 2005, Released 2010 by Don Syme @ Microsoft Reasearch
  • Open Source, Since 2012
  • Managed by the FSharp Foundation, with engineering support from Microsoft
    • Expand Platforms, Promote, Train
  • Cross Platform - .NET (Soon Linux/Mac), Mono (Linux/Mac), JavaScript

Design

  • A Descendant of OCAML for the .NET Ecosystem
  • Very Succinct
    • Time to market
  • Statically , Strong, Inferred
  • Functional First, Multiparadigm as needed
  • Pragmatic, sane defaults
  • Do the boring work
  • Immutable by default
  • No nulls
  • Explicit
  • REPL

.NET ecosystem

  • Where does it fit in
  • Very active community
  • C#/VB.NET Interop.
    • Most good features of C# came from a badly implemented version of the same F# feature

Open Source Projects/Community

  • Active, small, tight community
  • Upper eschilons community are language junkies
  • Projects - http://fsprojects.github.io/

    • Fable
    • FsReveal
    • FParsec
    • Neat TypeProviders (SQL, Swagger,CSV,HTML,WMI)

      • Data to types
    • Ionide
    • FAKE (F# Make)/Paket (Dependency management)

More Succinct than most

well at least C#

1: 
2: 
3: 
4: 
let square x = x * x
let xs = [1..5] 
            |> List.filter (fun x -> x % 2 = 0) 
            |> List.map square 

val xs : int list

[4; 16]
 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
public class Program {
    public int square(int x)
    {
        return x * x;
    }
    public static List<int> Main()
    {
        List<int> ints = new List<int>();
        for (int i = 1; i <= 5; i++)
        {
            if (i % 2 == 0) 
            {
                ints.Add(square(i));
            }
        }
        return ints;
    }
}
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 

public class Program {
    public static List<int> Main()
    {
        var square = (x) => x * x;
        return xs = Enumerable.Range(1,5).
                    Where((x) => x % 2 == 0).
                    Select(square);
    }
}

Partial application

A function

1: 
let add x y = x + y

A partial application of that function

1: 
let add5 = add 5
<fun:add5@1>

Using that new function

1: 
let newResult = add5 6
11

Pipe operator |> - Connect the output to the input of the next - Brackets means infix operator

1: 
2: 
let (|>) x f = f(x) 
let nine = 4 |> add5 |> printfn "%A"

Pipe <| - Same thing, but to the right side

1: 
2: 
let (<|) g x = g(x)
let b = add5 <| (1 + 1)
1: 
let thedarkside = 1 |>(+)<| 2
1: 
2: 
let λ = 1 + 2
let ``The output of this test shpuld = 💩`` = 2

Type Safety

  • Functions will be as generic as possible, until they use something that binds them to a type
  • Uses lamdba calculus to formulate what types are intended on being used
  • Can't shove Bacon into something that wants Vegitables
  • Re-working domain will lead to compile errors instead of runtime errors

Short Demo?

Algebraic Data Types, Discriminated Unions

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
type Bacon = Uncooked | Chewy | Crispy

type Tree<'Data> =
| Empty 
| Node of Tree<'Data> * 'Data * Tree<'Data> 

let baconTree = 
    Node(
        Node(Empty,Uncooked,Empty),
        Chewy,
        Node(Empty,Chewy,Node(Node(Empty,Chewy,Empty),
                                Crispy,
                                Node(Node(Empty,Chewy,Empty),
                                        Chewy, 
                                        Node(Empty,Uncooked,Empty)))))

Small Basic value

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
type value = // discriminated union
    | Bool of bool
    | Int of int
    | Double of double
    | String of string
type logical = Or | And | OrElse | AndAlso
type comparison = Eq | Neq | Gt | Lt | LtEq | GtEq
type identifier = string
type location = Index of int // Single discriminated union
type invoke = unit -> unit //Function type
type arithmetic = Add | Mul | Div | Sub

Phil Trelford Small Basic Parser

Small Basic expression

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
type expression =
    | Literal of value
    | Var of identifier
    | GetAt of location
    | Func of invoke
    | Neg of expression
    | Arithmetic of expression * arithmetic * expression
    | Comparison of expression * comparison * expression
    | Logical of expression * logical * expression

Small Basic expression

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
type label = string // Alias
type assign = Set of identifier * expression
type instruction =
    | Assign of assign
    | SetAt of location * expression
    | PropertySet of string * string * expression
    | Action of invoke
    | For of assign * expression * expression
    | EndFor
    | If of expression
    | ElseIf of expression
    | Else
    | EndIf
    | While of expression
    | EndWhile
    | Sub of identifier
    | EndSub
    | GoSub of identifier
    | Label of label
    | Goto of label

FParsec

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
#I @"../packages/FParsec/lib/net40-client"
#r "FParsec.dll"
#r "FParsecCS.dll"
open FParsec.CharParsers
open FParsec.Primitives
open System
let ptrue = pstring "true" |>> fun _ -> true
let pfalse = pstring "false" |>> fun _ -> false
let pbool = (ptrue <|> pfalse) |>> fun x -> Bool(x)
let pint = pint32 |>> fun n -> Int(n)
let pvalue = pbool <|> pint
let pliteral = pvalue |>> fun x -> Literal(x)
let result = run ptrue "true is correct"
// ...
//let parse = run pfor "For A=1 To 100"
//Success: For (Set ("A",Literal (Int 1)),Literal (Int 100),Literal (Int 1))
 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
let rec eval expr = 
    match expr with
        | Literal(value) -> value
     // | Var(identifier) -> ...
//             ...
        | Logical(expr1, logical, expr2) -> 
            match (eval expr1),logical,(eval expr2) with 
            | (Bool a), And, (Bool b) -> Bool(a && b) 
            | (Int a), And, (Int b) -> Bool(System.Convert.ToBoolean(a) && 
                                            System.Convert.ToBoolean(b)) 
            | _ -> failwith "Invalid combination"

Active Patterns

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
let (|Integer|_|) s =
  match System.Int32.TryParse(s) with
  | (true, n) -> Some n
  | _ -> None

let (|Float|_|) s =
  match System.Double.TryParse(s) with
  | (true, d) -> Some d
  | _ -> None

let checkInput s =
    match s with
    | Integer n -> sprintf "%d : int" n
    | Float d -> sprintf "%f : float" d
    | _ -> "Garbage"
 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
#r "System.Drawing"
open System.Drawing
let (|RGB|) (col : Color) =
    ( col.R, col.G, col.B )

let (|HSB|) (col : Color) =
    ( col.GetHue(), col.GetSaturation(), col.GetBrightness() )

let checkColour c =
    match c with 
    | HSB (h,s,b) when b > 50.f -> sprintf "over half bright"
    | RGB (r,g,b)  -> sprintf "Some %d, %d, %d" r g b
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
let (|Delicious|Eww|) b = 
    match b with
    | Chewy | Crispy -> Delicious "Yummy"
    | _ -> Eww 165

let baconresult = 
    match Chewy with
    | Delicious s -> sprintf "Yay: %s" s
    | Eww temp -> sprintf "Please cook till: %d" temp

val result :

"Yay: Yummy"

Units of Measure

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
[<Measure>] type m
[<Measure>] type s
[<Measure>] type kg
let distance = 135.0<m>    
let time = 4.0<s>    
let velocity = distance / time    
let initialVelocity = 0.7<m/s>   
let mass = 62.<kg>
let acceleration = 2.*(distance/time-initialVelocity)/time
let force = mass * acceleration
[<Measure>] type N = kg m/s^2
let forceDifference = force - 3.<N>
let momentum : float<kg m/s> = mass * velocity
1021.55
2092.5
1: 
2: 
3: 
4: 
5: 
6: 
[<Measure>] type C
[<Measure>] type F

let CtoF c = 
    c * 1.8<F/C> + 32.0<F>
let Far =  CtoF 21.<C>
69.8

Computation expressions

1: 
2: 
3: 
4: 
5: 
6: 
let urls = seq {
        yield "http://google.com"
        yield "http://yahoo.com"
        yield! [for i in [0..5] -> "http://google.com?q=" + i.ToString()]
    } 
let list = urls |> Seq.toList
["http://google.com"; "http://yahoo.com"; "http://google.com?q=0";
 "http://google.com?q=1"; "http://google.com?q=2"; "http://google.com?q=3";
 "http://google.com?q=4"; "http://google.com?q=5"]
 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
#r "System.Net.Http"
open System
open System.Net.Http
let longRunning url = 
    async {
        use client = new HttpClient()        
        let! result = Uri(url) |> client.GetAsync |> Async.AwaitTask
        return result
    }
let text = urls |> Seq.map longRunning  |> Async.Parallel
1: 
2: 
3: 
4: 
- return : a -> Special<a>
- bind : (a -> Special<b>) -> Special<a> -> Special<b>
- map : (a -> b) -> Special<a> -> Special<b>
- apply : Special(a->b) -> Special<a> -> Special<b>
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
let bind f xOpt = 
        match xOpt with
        | Some x -> f x
        | _ -> None

type MaybeBuilder() =
     member this.Bind(m, f) = bind f m
     member this.Return(x) = Some x
let maybe = MaybeBuilder()

Turn

1: 
2: 
3: 
4: 
let optR one two three = 
    bind (fun x -> 
        bind (fun y -> 
            bind(fun z -> Some (x + y + z)) three) two) one

Into

1: 
2: 
3: 
4: 
5: 
6: 
let optRe one two three =  maybe {
    let! x = one 
    let! y = two
    let! z = three
    return x + y + z  
}
1: 
let opt = optRe (Some 4) (Some 2) (Some 1)
Some 7
1: 
let opt2 = optRe (Some 4) (Some 2) None
1: 
val it : None
1: 
2: 
3: 
let products = Map.empty<string,int> |> Map.add "Veggies" 1  |> Map.add "Bacon" 2
let customers = Map.empty<string,int> |> Map.add "Dan"  1 |> Map.add "Chris" 2
type Order = {Customer:int;Product:int}
 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
let orderProduct customerKey productKey =
    match Map.tryFind customerKey customers with 
    | None -> None
    | Some cust -> match Map.tryFind productKey products with 
                   | None -> None
                   | Some prod -> Some {Customer=cust;Product=prod} 
                
let _ = match orderProduct "Dan" "Bacon" with 
        | Some prod -> printfn "%A" prod
        | None -> ()
1: 
Some 1 
1: 
2: 
3: 
let _ = match orderProduct "Chris" "Not veggies"  with 
        | Some prod -> printfn "%A" prod
        | None -> ()
1: 
None 
1: 
2: 
3: 
4: 
5: 
6: 
7: 
let orderProduct2 customerKey productKey = maybe {
    let! cust = Map.tryFind customerKey customers 
    let! prod = Map.tryFind customerKey customers
    return {Customer=cust;Product=prod} 
}
maybe { let! result = orderProduct2 "Dan" "Bacon"
        return result.Product }
1: 
Some 1 
1: 
2: 
maybe { let! result = orderProduct2 "Chris" "Not veggies"
    return result.Customer }
1: 
None 
 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
let cluster = AzureCluster.Connect(config, 
                                logger = ConsoleLogger(true), 
                                logLevel = LogLevel.Info)
let localResult = cloud { 
        printfn "hello, world" 
        return Environment.MachineName 
    } |> cluster.RunLocally

let remoteResult = cloud { 
        printfn "hello, world" 
        return Environment.MachineName 
    } |> cluster.Run                          

Domains used

Everything

What I use it for

  • Learning Functional Programming
    • Start with what I know, then go closer to pure ' I can start with an imperative or OO, factor out mutable bits, ect
    • Find some balance between FP and algorithms I know

Demo 2

What is FsReveal?

Syntax Highlighting

F# (with tooltips)

1: 
2: 
3: 
let a = 5
let factorial x = [1..x] |> List.reduce (*)
let c = factorial a

FSharp.Formatting

  • F# tools for generating documentation (Markdown processor and F# code formatter).
  • It parses markdown and F# script file and generates HTML or PDF.
  • Code syntax highlighting support.
  • It also evaluates your F# code and produce tooltips.

C#

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
using System;

class Program
{
    static void Main()
    {
        Console.WriteLine("Hello, world!");
    }
}

JavaScript

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
function copyWithEvaluation(iElem, elem) {
    return function (obj) {
        var newObj = {};
        for (var p in obj) {
            var v = obj[p];
            if (typeof v === "function") {
                v = v(iElem, elem);
            }
            newObj[p] = v;
        }
        if (!newObj.exactTiming) {
            newObj.delay += exports._libraryDelay;
        }
        return newObj;
    };
}

Haskell

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
recur_count k = 1 : 1 : 
    zipWith recurAdd (recur_count k) (tail (recur_count k))
        where recurAdd x y = k * x + y

main = do
  argv <- getArgs
  inputFile <- openFile (head argv) ReadMode
  line <- hGetLine inputFile
  let [n,k] = map read (words line)
  printf "%d\n" ((recur_count k) !! (n-1))

code from NashFP/rosalind

Scala

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
object Pi {
    class PiIterator extends Iterable[BigInt]{
        var r:BigInt=0
        var q, t, k:BigInt=1
        var n, l:BigInt=3
        var nr, nn:BigInt=0
        //...
    }
    
    def main(args: Array[String]): Unit = {
        val it=new PiIterator
        println((it head) + "." + (it take 300 mkString))
    }
}

Clojure

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
(defn ints-from [n]
(cons n (lazy-seq (ints-from (inc n)))))

(defn drop-nth [n seq] 
(cond 
    (zero?    n) seq
    (empty? seq) []
    :else (concat (take (dec n) seq) (lazy-seq (drop-nth n (drop n seq))))))

Q

1: 
{$[0=x mod 15;"FizzBuzz";0=x mod 5;"Buzz";0=x mod 3;"Fizz";string x]} each 1+til 15

Bayes' Rule in LaTeX

\(\Pr(A|B)=\frac{\Pr(B|A)\Pr(A)}{\Pr(B|A)\Pr(A)+\Pr(B|\neg A)\Pr(\neg A)}\)

How to get started

Resources

Goodbye

http://github.com/kellerd/Meetup-FSharp-Primer-Slides http://github.com/kellerd/FsLabTutorial