$30 off During Our Annual Pro Sale. View Details »

F# Type Providers

F# Type Providers

lightning talk presented at Milwaukee Functional Programming group in March 2018

Joel Clermont

March 06, 2018
Tweet

More Decks by Joel Clermont

Other Decks in Programming

Transcript

  1. F# Type Providers

    View Slide

  2. What is a type provider?
    "An F# type provider is a component that
    provides types, properties, and methods for
    use in your program. Type providers are a
    significant part of F# 3.0 support for
    information-rich programming.”

    https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tutorials/type-providers/index

    View Slide

  3. So . . . code generation?
    • Real-time

    • Only lives inside compiler (erased types)

    • Leverages power of F# type system

    View Slide

  4. Why use them?
    • Deal with external data in a type-safe way

    • Very low friction for quickly interacting with data

    • Not an SDK that has to be versioned, updated, etc

    View Slide

  5. DEMO

    View Slide

  6. Windows only?
    • Almost ready for primetime with .NET Core 2.1

    • FSharp.Data ported, many others being updated

    View Slide

  7. Next steps
    • Original paper “Types from data: Making structured data
    first-class citizens in F#”

    http://tomasp.net/academic/papers/fsharp-data/fsharp-data.pdf

    • Check out some type providers

    https://github.com/fsprojects/awesome-fsharp#type-providers

    • Build your own type provider

    https://docs.microsoft.com/en-us/dotnet/fsharp/tutorials/type-
    providers/creating-a-type-provider

    • Learn F#

    https://www.manning.com/books/get-programming-with-f-sharp

    View Slide