Creating a Generative Type Provider

Dave Fancher's avatarDidactic Code

In my recently released Pluralsight course, Building F# Type Providers, I show how to build a type provider that uses erased types. To keep things simple I opted to not include any discussion of generative type providers beyond explaining the difference between type erasure and type generation. I thought I might get some negative feedback regarding that decision but I still believe it was the right decision for the course. That said, while the feedback I’ve received has been quite positive, especially for my first course, I have indeed heard from a few people that they would have liked to see generated types included as well.

There are a number of existing type providers that use generated types, most notably in my opinion is the SqlEnumProvider from FSharp.Data.SqlClient. That particular type provider generates CLI-enum or enum-like types which represent key/value pairs stored in the source database.

Although SqlEnumProvider


View original post 898 more words

Articles about using F# to implement Lisp

Jorge Tavares's avatarJorge Tavares Notes

I was looking for examples of Lisp implementations using F# and found these 3 interesting series of blog posts. You can find other posts about implementing Lisp or Scheme using F# but these were the ones I found more comprehensive and different enough to compare different implementations. Although these Lisp implementations are learning experiments and not for production use, it’s fun to see how they are implemented. The series are the following ones:

Tim Robinson’sLisp Compiler in F#:

  1. Introduction
  2. Parsing with fslex and fsyacc
  3. Expression trees and .NET methods
  4. http://www.partario.com/blog/2009/06/lisp-compiler-in-f-il-generation.html
  5. What’s next?

Ashley Nathan Feniello’sFScheme series:

  1. Scheme in F#
  2. Just ‘let’ Me Be Already!
  3. Lambda the Ultimate!
  4. Rinse and Recurse
  5. What ‘letrec’ Can’t Do
  6. What’s Lisp Without Lists?!
  7. No Wait, Macro the Ultimate!
  8. Oh, The Humanity!
  9. Language vs. Library
  10. Turning Your Brain Inside Out with Continuations
  11. Playing Dice with the Universe
  12. Functional I/O (or at least


View original post 37 more words

Stormin’ F#

fwaris's avatarFaisal's space

Apache Storm is a scalable ‘stream computing’ platform that is fast gaining popularity. Hadoop and Storm can share the same cluster and the two complement each other well for different computing needs – batch for Hadoop and near-real-time for Storm.

Storm provides a macro architecture for executing ‘big data’ stream processing ‘topologies’. For example, one easily increase the parallelism of any node in the Storm topology to suit the performance requirements.

For streaming analytics, however, Storm does not offer much help out of the box. Often one has to write the needed analytic logic from scratch. Wouldn’t it be nice if one could use something like Reactive Extensions (Rx) within Storm components?

Luckily Nathan Marz – the original author of Storm – chose to enable Storm with multi-language support. While Storm itself is written in Clojure and Java, it implements a (relatively simple?) language-independent protocol that can be used with basically


View original post 292 more words

Deploying .NET code instantly using Vagrant

The absolutely awesome post !!!

Eirik Tsarpalis's avatarEirik Tsarpalis' blog

This is post #30 of the English 2014 F# advent calendar. Thanks to Sergey Tihon for inviting me and suggesting the topic. Be sure to check out all the other awesome posts!

In this post I will be describing Vagrant, a dependency management library of mine. I will try to walk through some of the subtleties in the .NET framework that drove the library implementation, in an attempt to make it more accessible. All code and examples presented can be found in this repository.

Prelude

It is often claimed in functional programming that functions are treated as values. This is a valid assumption in simple applications, permitting powerful patterns when writing code. But is this a general truth, or simply a linguistic abstraction? If functions really are values, one would expect that they exhibit all properties normally expected of values. For instance, it should be possible to serialise functions


View original post 1,027 more words

Review: F# Deep Dives

F# Deep Dive

Discount code: fshserb (39% off the eBook)

Some days ago, Manning published the final version of a new F# book: “F# Deep Dive“.  I have read MEAP version of the book, and even had a chance to review the final one.

Book is written by the team of famous F# experts such as: Chris Ballard, Keith Battocchi, Colin Bull, Chao-Jen Chen, Yan Cui, Johann Deneux, Kit Eason, Evelina Gabasova, Dmitry Morozov, Don Syme and composed by Tomas Petricek and Phillip Trelford.

First of all, I want to mention that it is not a usual book about F# or another programming language. If you are novice to F# and looking for a guide of language constructs – this book is not the best choice for you. BUT,  if you are already familiar with F# basic syntax constructs, can read simple F# code samples and want to see the language in action – this book is for you.

Book is organized as a collection of independent packages written by different authors. Each author tells his own story about F# application to a practical domain, shows how it was used, how it affected an application design and describes why it was done in such a way. Experts show an application of F# to financial and statistical models, internals of Fsharp.Formatting, numerical computing, social networks analysis, real-world usage of type providers, developing MVC application in idiomatic F#, power of F# Async in action, game development, social web apps in F# and many other interesting topics.

One problem with this book, at least for me, that it is difficult to read it cover to cover. Chapters are written by different authors in a different language, sometimes it was hard for me to catch a sense of computation in a completely new domain. So, for all future readers, I recommend to reorganize chapters according to interests and read parts that most valuable for you first.

Finally, I want to say that the book is really good. Everyone will find interesting topics and a new experience. You will get a broader vision of F# application in a real life. You will see how a functional approach can change and simplify the architecture of real life apps. If you are looking for what to read next – take a look at “F# Deep Dives“, this book is really deserves it.

If you want more F# books – visit fsharp.org.

Distributing the F# Mailbox Processor

Everyone should read it

Isaac Abraham's avatarThe Cockney Coder

Note: This blog post is part of the 2014 F# Advent Calendar. Be sure to check out yesterday’s Intro to Data Science post by Jon Wood!

Mailbox Processors 101

If you’ve been using F# for any reasonable length of time, you’ll have come across the MailboxProcessor, AKA the F# Agent (or Actor). Mailbox Processors are cool. They give us the ability to offload load to background processors without worrying about managing the thread that they live on (as agents silently “go to sleep” when they aren’t processing anything), and they take away the pain of locking as they ensure that only one message will be processed at a time whilst automatically queuing up backed up messages. They also allow us to visualise problems differently to how we might do so when just using a raw Task, in terms of message passing. We can partition data based by pushing them


View original post 2,583 more words

F# Advent Calendar in English 2014

Update: Event extended until December 31.

Our friends from Japan have a beautiful event called “F# Advent Calendar“. Every day from December 1 to December 31, one awesome volunteer publish a new post about F#. What an amazing way to celebrate Christmas, isn’t it?

Lets support this initiative and do an English version of the calendar. Two blog posts per day is better than one, isn’t it? We need 31 volunteers, who are ready to prepare a post about F# and publish it on specified date.

Rules

Rules are very simple:

  1. Choose F# related topic for your blog post and send it to me on Twitter or leave a comment to this post.
  2. Prepare a blog post in English (about F# or using F#)
  3. Publish your post on specified date (according to the calendar)
  4. Post link to your post on Twitter with hashtags #fsharp and #FsAdvent.

Calendar

Date (December) Author Post Title
01 (Monday)  Scott Wlaschin  FsCheck and property-based testing
02 (Tuesday)  Philae Trelford  Snowflakes
03 (Wednesday)  Jon Wood  My Introduction to Data Science with F#
04 (Thursday)  Isaac Abraham  Distributing the F# Mailbox Processor
05 (Friday)  Richard Dalton  Decorating Immutable Christmas Trees
06 (Saturday)  Steve Shogren  Christmas F# Polymorphism
07 (Sunday)  Richard Minerich  Developing an Algorithm in F#: Fast Rotational Alignments with Gosper’s Hack
08 (Monday)  Tomas Petricek  Composing Christmas with F#
09 (Tuesday)  Jamie Dixon  Using IBM’s Watson With F#
10 (Wednesday)  Dave Thomas  Terror from the Deep
11 (Thursday)  MĂ„rten RĂ„nge  Becoming an F# contributor
12 (Friday)  Andrea Magnorsky  FSharp and games in celebration times
13 (Saturday)  John Tarbox  F# for social media analytics
14 (Sunday)  Bartosz Sypytkowski  Akka.NETremote deployment with F#
15 (Monday)  Evelina Gabasova  Christmas Carol and other eigenvectors
16 (Tuesday)  Tomas Jansson  Pure functional applications (in F#)
17 (Wednesday)  Mark Seemann  Good times with F#
18 (Thursday)  Michael Newton  Modelling Inheritance With Inheritance
19 (Friday)  Carsten König  Having fun with type-level numbers using a type-provider
20 (Saturday)  Mathias Brandewinder  Textogramme
21 (Sunday)  Anthony Brown  The Internet of Things at Scale with F# and Actors
22 (Monday)  Pete Smith  Functional web synergy with F# and OWIN
23 (Tuesday)  Yan Cui  Seven ineffective coding habits many F# programmers don’t have
24 (Wednesday)  JĂ©rĂ©mie Chassaing  Speaking computers for more fun !
25 (Thursday)  Ross McKinlay  The North Pole Type Provider: Escape from Santa’s Grotto!
26 (Friday)  Lincoln Atkinson  Nested looping to programmatic depth in F#
27 (Saturday)  Stachu Korick  Solving a Rubik’s Cube with F#
28 (Sunday)  Tim Jones  Make Santa Jump – Making an endless runner game in F# using MonoGame
29 (Monday)  Andrew Cherry  Snowflakes — redux
30 (Tuesday)  Eirik Tsarpalis  Deploying .NET code instantly using Vagrant
31 (Wednesday)  Reed Copsey, Jr.  F# 2014 – A Retrospective and Call to Action