The North Pole Type Provider: Escape from Santa’s Grotto!

:: fsharp, xmas, type providers

This post is part of the F# advent calendar, which is filled with all sorts of other cool blog posts, be sure to check it out. Thanks to Sergey Tihon for organising!

It’s Christmas!

Happy Christmas everyone! I have the honour of the Christmas Day F# advent calendar post

Thanks Tomas, ha!. I had a whole bunch of different ideas, and typically, I decided to choose the largest, most complicated one. Because of this, there is a lotof code written in just a couple of evenings. It is for the most part, badly designed, horribly written, nowhere near finished and should not be used as an example on how to write anything approaching nice F# code! /disclaimer

2048 – Type Provider Edition

:: fsharp, type providers

I’m sure you would have all seen the highly addictive and annoying game 2048 by now (if not, follow the link and have a go now, don’t forget to come back here though! ). Fellow F#er @brandewinder wrote a bot that wins the game for you, subsequently turning it into an cool F# dojo. It is London’s turn for this dojo next Thursday, so I figured before then I would have a go myself and do the obvious thing which is to turn it into a type provider :)

2048 TP Edition is available as part of my type provider abstraction the Interactive Provider. You will want to set your tooltips to a fixed-width font for this to render for you properly. Here is a picture of it in action !


Some of my favourite tech books!

:: books

I thought it would be nice to share some of the technical books that I have learnt most from, and still love to look through or use as reference to this day. These are in no particular order and cover a variety of technical subjects, and some are far from recent. If you are interested in any of these areas and have not read these books, I cannot recommend them highly enough! I have many, many many books and have read countless over the years, many of them are awesome but are not making this list as it would just be too long. I also have lots of books that are simply terrible (and I still have most of those too…!)

CRUD Operations and Experimental ODBC support in the SQLProvider

:: fsharp, sqlprovider, type providers

The SQL provider now supports basic transactional CRUD functionality and an ODBC provider. A new nuget package is up for you to grab here. As always, you can download and build from source here.

The nuget package is still pre-release. You can find it in Visual Studio by toggling the search filter to include pre-release packages. I'm sure Xamarin has a similar feature. Once this work has been tested well enough, I will likely upgrade the SQL Provider to a proper release.

BASIC’s 50th Anniversary … and more crazy F# type providers!

:: fsharp, type providers

Did you know that it is the 50th anniversary of the BASIC programming language today? (1st May) No? Well why not! BASIC is the language that brought computers to the mainstream. Back in the day, if you had a computer, you learnt how to program it in basic. Infact, when you switched it on, that’s what you were presented with. These computers wanted to be programmed. Thousands of people purchased these expensive computers purely to learn how to program them.

I figured I should do something to mark the anniversary. Many of you will already know about my various crazy type providers, including MineSweeper and Choose Your Own Adventrue. So, I thought to myself, wouldn’t it be great if we could write some equivalents of the very early BASIC games via a re-usable and extensible type provider? One which doesn’t require you to write any type-providing code, but is abstracted away from all that …

Solving Puzzle Quest with F# Part 1

:: fsharp

Tomas Petricek posted an article recently about how he used F# to solve a puzzle he had been given for Christmas. This reminded me of several similar mini-projects I have developed in the past, the most recent being a program to help solve a specific sort of puzzle in the game Puzzle Quest, which I shall now describe.

Puzzle Quest is a match-3 game, with various game modes. One game mode in particular, “Capture”, has a specific layout of tiles which can be matched in a certain way to leave no tiles behind at the end. Some of these are really quite tricky, and I thought it would be fun to write a program to solve them. Here is a example of a puzzle:

The Don Syme type provider

:: fsharp, type providers

Someone asked me what the secret type provider I am working on is.  I neglected to tell them, and instead joked that it would be the Don Syme type provider.  Later I reflected that the idea had actually been a stroke of genius, so just knocked this together in 20 of your English minutes – the Don Syme fact provider!  It will produce an endless stream of true facts about the mystery man known as the Father of F#.  Get it from my github here.




The MineSweeper Type Provider

:: fsharp, type providers

Being able to play Mine Sweeper inside your IDE via intellisense, that is what you have always wanted right? Well, I’m always willing to lend a hand! With this fantastic new type provider you can pretend you are working when really you are avoiding mines. To get started simply clone and build the provider from here. Reference your new shiny type provider library from a script file and create a type alias and then an instance of it like so:


The amazing Squirrelify type provider

:: fsharp, squirrels, type providers

Introducing my latest top-o-the-line type provider that everyone wants and needs. The Squirrelify provider! This very useful type provider will create an INFINITE type system and show you random pictures of ASCII art in intellisense.

It turns out that intellisense was not really designed for this and it struggles with various formatting and layout, but the provider tries the best it can. It also doesn't have many images as I couldn't find a webservice for them and had to do it manually.

"Wow Ross!" I hear you cry. "How can we get started with this??"

It's easy! simply go and build the source from here, then reference the library it produces in a script file as shown in the picture below. Once you have done that, you will need to alias a type and call create() on it. The resulting type will have an infinite series of properties named``Squirrelify!``which will display said ASCII art.

Note that this is the LITE version of the type provider. They PRO pay-for version includes a static parameter "keyword" which is used to search google images, convert said images to ASCII and display them.

edit - this is not just squirrels. You can expect other delights such as unicorns, snowmen, and various other things you will not be able to identify