val co2 : obj

Full name: index.co2
val topCountries : obj list

Full name: index.topCountries
val app : obj

Full name: index.app
val fsi : Compiler.Interactive.InteractiveSession

Full name: Microsoft.FSharp.Compiler.Interactive.Settings.fsi

Understanding the World
with Type Providers

www.thegamma.net





Tomas Petricek
@tomaspetricek | tomas@tomasp.net

Data journalism

Illustration from: Data journalism handbook

Data driven articles

Not just text with visualizations, but...

  • Can it be modified and reproduced?
  • Is the source code available?
  • Are the data sources referenced?

Data driven article is really a program!



The Gamma

Data driven article in The Gamma

Article is a program view

There is no magic. It is just code and text!

  • We see the journalist's story first
  • Readers can modify the parameters
  • Power users can see and modify the code


Programming language problem

Typed functional language with type providers

  • Simple code with functional programming
  • Editor support via static types
  • Data access with F# type providers


Theory of type providers

The Gamma technology

World bank data source

World bank data source

World bank data source

World bank data source

World bank type provider

Auto-generated options

One of members of the same type

1: 
2: 
3: 
let co2 =
  world.byYear.``2010``.``Climate Change``
    .``CO2 emissions (kt)``

List with sub-set of properties

1: 
2: 
3: 
4: 
let topCountries =
  [ world.byCountry.China
    world.byCountry.India
    world.byCountry.Japan ]    

Suave.io web server

Request -> Response

Suave.io web server

Light-weight, composable, cross-platform


1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
let app =
  choose
    [ Editor.webPart checker
      Document.webPart fsi
      Evaluator.webPart fsi
      Visualizers.webPart checker
      staticWebFile
      RequestErrors.NOT_FOUND("Not found") ]

Why F# matters

For innovative technologies

Powerful language

  • Supports quick prototyping
  • Correctness via static types

Awesome community

  • Fantastic open-source infrastructure
  • Source of interesting ideas

Summary

Is programming the new literacy?

  • Understanding information is
  • Programming needs to evolve
  • Check out the prototype!

Do not forget to vote!