type providers(from the very beginning to the implementation)

26
Type Providers: from the very beginning to the implementation @ sergey_tih on 2014

Upload: sergey-tihon

Post on 02-Jul-2015

596 views

Category:

Software


1 download

DESCRIPTION

http://www.meetup.com/fsharpminsk/events/214812192/

TRANSCRIPT

Page 1: Type providers(from the very beginning to the implementation)

Type Providers: from the very

beginning to the implementation

@sergey_tih

on

2014

Page 2: Type providers(from the very beginning to the implementation)

An F# type provider is a component that provides types, properties, and methods for use

in your program.

Page 3: Type providers(from the very beginning to the implementation)

An F# type provider is a component that provides types, properties, and methods for use

in your program.

As well as a compiler/IDE extension…

Page 4: Type providers(from the very beginning to the implementation)

How it works in C# world:Codegen, codegen, codegen!

Source

• WCF

Services

• Database

• OData

• UI/XAML

Codegen

Tool

• svcutil.exe

• edmgen.ex

e

• datrasvcuti

l.exe

Types

+codeProgram

Page 5: Type providers(from the very beginning to the implementation)

F# 3.0 Built-in Type Provides

• WsdlService• EdmxFile• ODataService

• DbmlFile (DBML file based)• SqlDataConnection (LINQ to SQL)• SqlEntityConnection (LINQ to Entities)

Page 6: Type providers(from the very beginning to the implementation)

FSharp.Data

http://fsharp.github.io/FSharp.Data/

• CSV Type Provider• HTML Type Provider• JSON Type Provider• XML Type Provider• WorldBank Provider• Freebase Provider

Page 7: Type providers(from the very beginning to the implementation)

DEM

O

JSON

WorldBan

k

HTML/WSD

L

Games

COM

R

Page 8: Type providers(from the very beginning to the implementation)

R Type Provider: Neural Networks

Page 9: Type providers(from the very beginning to the implementation)

DEMO: Apache Hive Type Provider

Roman Bugaev (@rbugaev)

Distinguished Technical Architect for

projects in cloud computing. Excellent

public-speaker and acknowledged

member of IT/Startup community.

Page 10: Type providers(from the very beginning to the implementation)

Type Provides

• DBMLFILE

• EDMXFILE

• ODATASERVICE

• SQLDATACONNECTION

• SQLENTITYCONNECTION

• WSDLSERVICE

• APIARY

• CSV

• FREEBASE

• JSON

• WORLDBANK

• XML

• HTML

• DBPEDIA

• APPSETTINGS

• EXCEL

• GRAPH

• MACHINE

• MANAGEMENT

• MATH

• REGEX

• XAML

• XRM

• CRM

• TWITTER

• RSS

• NUGET

• MAT

• DGML

• WORD

• DATASTORE

• HADOOP/HIVE/HDFS

• COM

• FUNSCRIPT

• R

• MATLAB

• IKVM

• PYTHON

• POWERSHELL

• AZURE

• S3

• GAMES

Page 11: Type providers(from the very beginning to the implementation)

CODE QUOTATIONS

Page 12: Type providers(from the very beginning to the implementation)

CODE QUOTATIONS: BASICS

Page 13: Type providers(from the very beginning to the implementation)

CODE QUOTATIONS: BASICS

Page 14: Type providers(from the very beginning to the implementation)

CODE QUOTATIONS: SPLICING

Page 15: Type providers(from the very beginning to the implementation)

How to create New Type Provider

Page 16: Type providers(from the very beginning to the implementation)

Before You Start

The type provider mechanism is

primarily designed for injecting

stable data and service

information spaces into the F#

programming experience.

materials are from MSDN

Page 17: Type providers(from the very beginning to the implementation)

Before You Start

This mechanism isn’t designed

for injecting information spaces

whose schema changes during

program execution in ways that

are relevant to program logic.

materials are from MSDN

Page 18: Type providers(from the very beginning to the implementation)

Before You Start: Ask yourself questions

• Do you have a schema for your information source? If so, what’s

the mapping into the F# and .NET type system?

• Can you use an existing (dynamically typed) API as a starting

point for your implementation?

• Will you and your organization have enough uses of the type

provider to make writing it worthwhile? Would a normal .NET

library meet your needs?

• How much will your schema change?

• Will it change during coding?

• Will it change between coding sessions?

• Will it change during program execution?

materials are from MSDN

Page 19: Type providers(from the very beginning to the implementation)

F# Type Provider Starter Packhttps://github.com/fsprojects/FSharp.TypeProviders.StarterP

ack

@mavnn

Reference from NuGet:FSharp.TypeProviders.StarterPack

Page 20: Type providers(from the very beginning to the implementation)

ZIP Provider

Page 21: Type providers(from the very beginning to the implementation)

ZIP Provider

Page 22: Type providers(from the very beginning to the implementation)

SAMPLE OF USAGE

Page 23: Type providers(from the very beginning to the implementation)

DEMO

Page 24: Type providers(from the very beginning to the implementation)

HOW DO I CREATE AN F# TYPE PROVIDER THAT CAN BE USED FROM

C#?

Page 25: Type providers(from the very beginning to the implementation)

QUESTIONS?

THANK YOU!

Ask me @sergey_tihon

Ask about #FSharp

Page 26: Type providers(from the very beginning to the implementation)

My turn to ask questions!

What Type Provider

would you like to

have?