Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

F# is based on OCaml, so it has modules similar to Haskell modules independent of Type Providers.

F# Type Providers work in the background _while developing_ to provide types to your solution. In one sense they're just a lifecycle hook to generate code: they create .Net Types and then expose those types to your development environment (ie provide/export).

In practice this means you can give some JSON to a Type Provider, it will create types that match that JSON, and then those types are made available while developing so you get live intellisense and code completion based on the content and its structure through strongly typed .Net objects.

Alternatively, if you're creating some kind of DSL: a custom type provider will allow you to translate your data files into code objects that can then be used for strongly typed interactive scripting. Say, opening CAD files and publishing them to different repos depending on number of objects, auther, etc.

The readme for the project linked in this thread shows them in action :)

Type Providers give huge comfort to working with strange data by seeing all the fields immediately and interactively exploring the data schema. It's also veerrrryyyy cool to write scripts and apps that will simply refuse to compile if their assumptions about their data sources aren't met if you're dealing with third party data, or chaotic production environments, or sloppy cowboy co-workers like myself ;)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: