Tomas Petricek's blog

Writing about practical F# coding and programming language research

Library patterns: Multiple levels of abstraction

Over the last few years, I created or contributed to a number of libraries including F# Data for data access, Deedle for exploratory data science with C# and F#, Markdown parser and code-formatter F# Formatting and other fun libraries such as one for composing 3D objects used in my Christmas blog post.

Building libraries is a fun and challenging task - even if we ignore all the additional things that you need to get right such as testing, documentation and building (see my earlier blog post) and focus just on the API design. In this blog post (or perhaps a series), I'll share some of the things I learned when trying to answer the question: What should a good library look like?

I was recently watching Mark Seemann's course A Functional architecture with F#, which is a great material on designing functional applications. But I also realised that not much has been written on designing functional libraries. For some aspect, you can use functional patterns like monads (see Scott Wlaschin's presentation), but this only answers a part of the question - it tells you how to design individual types, but not an entire library...

Published: Tuesday, 3 February 2015, 3:54 PM
Tags: f#, open source, functional programming
Read the complete article

Recent articles from my blog

FnuPlot: Cross-platform charting with gnuplot

Thursday, 15 January 2015, 4:58 PM

There is a bunch of visualization and charting libraries for F#. Sadly, perhaps the most advanced ones do not work particularly well outside of Windows. This blog post introduces a new work-in-progress library called FnuPlot which is a lightweight and cross-platform wrapper for gnuplot.

Why you should learn F# in 2015 (and how)?

Wednesday, 7 January 2015, 1:36 PM

I guess that it might be a bit too late for adding to your list of new year's resulution now.But just if you still have an empty slot (or in case an originally taken slot has become available), your new year's resolution should be to get involved with F#!

Composing Christmas with F#

Monday, 8 December 2014, 5:22 PM

This blog post is a part of the F# Advent Calendar 2014, so it inevitably needs a Chrismassy theme. However, there is also going to be a serious theme for the blog post, which is domain-specific languages. I'm going to cover two key ideas of DSLs in F# - composability and multiple layers of abstraction.

New features and improvements in Deedle v1.0

Tuesday, 27 May 2014, 3:41 PM

As Howard Mansell already announced we have officially released the '1.0' version of Deedle. In this blog post, I'll have a quick look at a couple of new features in Deedle. Howard's announcement has a more detailed list, but I just want to give a couple of examples and briefly comment on performance improvemens we did.

Find older blog articles here


I'm an open-source developer and computer scientist who enjoys combining theory and practice. On the practical side, I write about F#, run trainings and provide consulting via F# Works. On the theory side, I work on various programming language topics.

Trainings and consulting

I'm a frequent speaker at F# and .NET events, founding member of the F# Foundation author of C# and F# book and a StackOverflow fanatic. I have been Microsoft C# MVP since 2004 and used F# since early Microsoft Research versions.

Have you seen the F# testimonials and are you thinking how your company can also benefit from the safety, correctness, efficiency and faster time-to-market provided by F#?

Research & teaching

I'm interested in a wide range of topics in programming languages, ranging from category theory, comonads, reactive and distributed programming to scientific computing and working with data.

I like working on topics inspired by practical problems. I created a web framework for F# that inspired commercial projects like WebSharper and my experimental F# extensions can be tested live on

When the time permits, I enjoy traveling. The calendar shows a new picture each month. See 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 and the first photos of 2015.