type Aggregation =
  | CountAll
  | Sum of string
  | Mean of string
  | CountDistinct of string

Full name: index.Aggregation
union case Aggregation.CountAll: Aggregation
union case Aggregation.Sum: string -> Aggregation
Multiple items
val string : value:'T -> string

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

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

Full name: Microsoft.FSharp.Core.string
union case Aggregation.Mean: string -> Aggregation
union case Aggregation.CountDistinct: string -> Aggregation
type Transformation =
  | DropColumns of string list
  | SortBy of (string * SortDirection) list
  | GroupBy of string list * Aggregation list
  | Paging of Paging list

Full name: index.Transformation
union case Transformation.DropColumns: string list -> Transformation
type 'T list = List<'T>

Full name: Microsoft.FSharp.Collections.list<_>
union case Transformation.SortBy: (string * SortDirection) list -> Transformation
Multiple items
union case SortDirection.SortDirection: SortDirection

--------------------
type SortDirection = | SortDirection

Full name: index.SortDirection
union case Transformation.GroupBy: string list * Aggregation list -> Transformation
Multiple items
union case Transformation.Paging: Paging list -> Transformation

--------------------
type Paging = | Paging

Full name: index.Paging
Multiple items
union case State.State: State

--------------------
type State = | State

Full name: index.State
Multiple items
union case Event.Event: Event

--------------------
module Event

from Microsoft.FSharp.Control

--------------------
type Event = | Event

Full name: index.Event

--------------------
type Event<'T> =
  new : unit -> Event<'T>
  member Trigger : arg:'T -> unit
  member Publish : IEvent<'T>

Full name: Microsoft.FSharp.Control.Event<_>

--------------------
type Event<'Delegate,'Args (requires delegate and 'Delegate :> Delegate)> =
  new : unit -> Event<'Delegate,'Args>
  member Trigger : sender:obj * args:'Args -> unit
  member Publish : IEvent<'Delegate,'Args>

Full name: Microsoft.FSharp.Control.Event<_,_>

--------------------
new : unit -> Event<'T>

--------------------
new : unit -> Event<'Delegate,'Args>
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
Multiple items
union case Html.Html: Html

--------------------
type Html = | Html

Full name: index.Html
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<_>



Visualizing Olympic Medals
with F# and Fable




Tomas Petricek, Alan Turing Institute & fsharpWorks
@tomaspetricek | tomasp.net | fsharpworks.com

Living in a post-fact society

Technology democratized opinions,
but can it also democratize facts?

DEMO

Visualizing Olympic Medalists

What if we could view source?

  • Verify facts with original source
  • Let users find related facts
  • Invalidate when data change

Accessing data
with type providers

DEMO

World Bank type provider

DEMO

Pivot type provider in F#

DEMO

Pivot type provider in The Gamma

Using F# for domain modelling

  • Tools for thinking about problem
  • Describe domain with functional types

Modelling data transformations

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
type Aggregation = 
  | CountAll
  | Sum of string
  | Mean of string
  | CountDistinct of string

type Transformation = 
  | DropColumns of string list
  | SortBy of (string * SortDirection) list
  | GroupBy of string list * Aggregation list
  | Paging of Paging list

Fable

The F# to JavaScript
compiler for the 21st century

Why Fable is amazing

  • Reasonably nice modern JavaScript
  • Active and welcoming community
  • Pragmatic functional-first style


See fable.io for demos and docs!

Elm-style architecture

Functional reactive programming


Update state when event happens

1: 
val update : State -> Event -> State

Render HTML given current state

1: 
val render : (unit -> Event) -> State -> Html


Implementing Elmish TODO list

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
type Update = 
  | Input of string
  | Remove of int
  | Create 

type Model = 
  { Input : string
    Items : (int * string) list
    NextId : int }

DEMO

Elm-style TODO list

Summary

software stacks trainings

mac and linux cross platform tutorials

F# Software Foundation

user groups open source Xamarin

community www.fsharp.org research

support contributions diversity

Thank you!


  • Technology can democratize facts!
  • The Gamma is open source & you can help
  • Pivot table package coming soon!



Tomas Petricek

tomasp.net | fsharpworks.com
@tomaspetricek | tomas@tomasp.net