F#

Guest Post: The F#unctional Londoners User Group

functional_londoners_phil_trelford_blog_post

This is a guest post from Phil Trelford, the organiser of the F#unctional Londoners and regular speaker at Skills Matter. Here Phil introduces the group, talking about their most recent meetups, as well as what’s coming up over the next few months!

The F#unctional Londoners meet regularly at Skills Matter HQ in London, so be sure to check out their upcoming meetups, as well as all of the Skillscasts (film, code, slides) from their previous talks.


“Excellent group with lots and lots of passion”

The F#unctional Londoners meetup was started by Carolyn Miller back in early 2010, for people interested in F# and functional programming. Since then the group has grown to nearly 800 members and meets every 2 weeks. There’s usually both a talk night and a hands on session night once a month, and typically a large gathering at a nearby drinking hole.

What we’ve been  up to

We pride ourselves on being a friendly and welcoming group, here’s what other people have said:

  • Great learning opportunity and Great conversations with Great people all round
  • Excellent group with lots and lots of passion
  • My first time here, it was great!

A couple of weeks ago Rob Lyndon attracted a great turn out for his talk on The Flying Fox: Deep Machine Learning with F# which provided an excellent introduction to Deep Belief Networks (the technology behind Bing Translate). Rob’s open source Vulpes project provides a DBN implementation written in F# that runs on the GPU via CUDA. Skills Matter records the majority of talks, and Rob’s is no exception, view the Skillscast here.

Coming up soon

This week sees Michael Newton pop up from Brighton to lead a hands session on Creating Type Providers. Type Providers are a powerful new feature in F# 3 which provides instant typed access to a wide variety of data sources from web services and databases all the way to other languages including R, MATLAB and even Java.

The week after Ben Hall is popping across from Cambridge to talk about his research in systems biology with a talk on Mixing biology and physics to understand stem cells and cancer. Ben’s team have built an F# based web tool, the BioModelAnalyzer, which takes cellular network models and couples them with a 3D model of the biophysical environment.

Later in the month we have Stephen Channel will be talking about Early Warning Indicators in F# used by EWI for triggered real-time notifications from market events to manage Liquidity Risk. Followed a week later by Isaac Abraham on a Type Provider to Azure and how Microsoft Azure and F# fit together as an excellent value proposition for storage, retrieval and analysis of large-quantities of data.

progfsharp-2014-800x300px

November 6th & 7th sees our annual conference, the Progressive F# Tutorials, a two-day to-track conference comprised of half day hands on sessions, for beginners and seasoned developers alike. This year we’ve got a great line-up including Don Syme, Tomas Petricek, Andrea Magnorsky, Mark Seemann, Scott Wlaschin and Rob Pickering. Topics for this year include Machine Learning, Domain Driven Design and Games Development.

Hope to see you some time, and if you’re interested in giving a talk or hands on session sometime just let us know.

Guest Post: “Haskell gets static typing right”, Andres Löh

andres-lohThis is a guest post from Andres Löh, a long-time functional programming enthusiast. He started using Haskell in 1997 while being an undergraduate studying mathematics. He obtained his PhD on datatype-generic programming using Haskell from Utrecht University in 2004. Since then, he has continued to use Haskell in research and practice, including teaching various courses both to students and participants from industry. Since 2010, Andres is an independent Haskell consultant and partner at Well-Typed LLP.

Andres teaches both introductory or advanced Haskell courses at Skills Matter, and will also be running a special course on Haskell’s type system. If you would like more information, or would like to enquire about attending any of our courses, you can email us info@skillsmatter.com or call our team on 0207 183 9040.


Haskell gets static typing right

Statically typed languages are often seen as a relic of the past – old and clunky. Looking at languages such as C and Java, we’re used to writing down a lot of information in a program that just declares certain variables to be of certain types. And what do we get in return? Not all that much. Yes, granted, some errors are caught at compile time. But the price is high: we’ve cluttered up the code with noisy declarations. Often, code has to be duplicated or written in a more complicated way, just to satisfy the type checker. And then, we still have a significant risk of run-time type errors, because type casting is common-place and can fail at unexpected moments.

So it isn’t a big surprise that dynamically typed languages are now very fashionable. They promise to achieve much more in less time, simply by getting rid of static type checking.

However, I want to argue that we shouldn’t be too keen on giving up the advantages of static types, and instead start using programming languages that get static typing right. Many functional languages such as Scala, F#, OCaml and in particular Haskell are examples of programming languages with strong static type systems that try not to get in the way, but instead guide and help the programmer.

In the rest of this post, I want to look at a few of the reasons why Haskell’s type system is so great. Note that some of the features I’m going to discuss are exclusive to Haskell, but most are not. I’m mainly using Haskell as a vehicle to advertise the virtues of good static type systems.

1. Type inference

Type inference makes the compiler apply common sense to your programs. You no longer have to declare the types of your variables, the compiler looks at how you use them and tries to determine what type they have. If any of the uses are inconsistent, then a type error is reported. This removes a lot of noise from your programs, and lets you focus on what’s important.

Of course, you are still allowed to provide explicit type signatures, and encouraged to do so in places where it makes sense, for example, when specifying the interface of your code.

2. Code reuse

Nothing is more annoying than having to duplicate code. In the ancient days of statically typed programming, you had to write the same function several times if you wanted it to work for several types. These days, most languages have “generics” that allow you to abstract over type parameters. In Haskell, you just write a piece of code that works for several types, and type inference will tell you that it does, by inferring a type that is “polymorphic”. For example, write code that reverses all the elements of a data structure, and type inference will tell you that your code is independent of the type of elements of the data structure, so it’ll just work regardless of what element type you use. If you write code that sorts a data structure, type inference will figure out that all you require to know about the elements is that they admit an ordering.

3. No run-time type information by default

Haskell erases all type information after type checking. You may think that this is mainly a performance issue, but it’s much more than that. The absence of run-time type information means that code that’s polymorphic (i.e., type-agnostic, see above) cannot access certain values. This can be a powerful safety net. For example, just the type signature of a function can tell you that the function could reorder, delete or duplicate elements in a data structure, but not otherwise touch them, modify them or operate on them in any other way. Whereas in the beginning of this post I complained that bad static type systems don’t allow you to do what you want because they’re not powerful enough, here we can deliberately introduce restrictions to save us (as well as colleagues) from accidental mistakes. So polymorphism turns out to be much more than just a way to reduce code duplication.

By the way, Haskell gives you various degrees of selective run-time typing. If you really need it in places, you can explicitly attach run-time type information to values and then make type-based decisions. But you say where and when, making a conscious choice that you gain flexibility at the cost of safety.

4. Introducing new datatypes made easy

In Haskell, it’s a one-liner to define a new datatype with a new name that has the same run-time representation as an existing type, yet is treated as distinct by the type system. (This may sound trivial, but surprisingly many statically typed languages get it wrong.) So for example it’s easy to define lots of different types that are all integers internally: counters, years, quantities, … In Haskell, this simple feature is often used to define safe boundaries: a specific type for URLs, a specific type for SQL queries, a specific type for HTML documents, and so on. Each of these types then comes with specific functions to operate on them. All such operations guarantee that whenever you have a value of this type, it’s well-formed, and whenever you render a value of this type, it’s syntactically correct and properly escaped.

5. Explicit effects

In virtually all programming languages, a function that performs some calculations on a few numbers and another function that performs the same calculations, but additionally sends a million spam emails to addresses all over the world, have exactly the same type, and therefore the same interface. Not so in Haskell. If a function writes to the screen, reads from the disk, sends messages over the network, accesses the system time, or makes use of any other so-called side effect, this is visible in its type. This has two advantages: first, it makes it much easier to rely on other people’s code. If you look at the interface and a function is effect-free, then you for example automatically know that it is also thread-safe. Second, the language facilitates a design where side effects are isolated into relatively small parts of the code base. This may seem difficult to achieve for highly stateful systems, but surprisingly, it usually is not: even interactive systems can usually be described as pure functions reacting to a series of requests with appropriate responses, and a separate driver that does the actual communication. Such separation makes it not only easier to test the program, but also facilitates the evolution of the program such, for example, to adapt it to run in a different environment. Haskell’s type system therefore encourages good design.

6. Types as a guide in program development

If you only ever see types as a source of errors, and therefore as enemies on your path of getting your program accepted, you’re doing them injustice. Types as provided by Haskell are an element of program design. If you give your program precise types and follow systematic design principles, your program almost writes itself. Programming with a strong type system is comparable to playing a puzzle game, where the type system removes many of the wrong choices and helpfully guides you to take the right path. This style of programming is supported by a new language extension called “Typed Holes” where you leave parts of your program unspecified during development, and obtain feedback from the development environment about what type has to go into the hole, and what program fragments you have available locally to construct a value of the desired type. Playing this kind of puzzle game is actually quite fun!

7. Programming on the type level

Haskell’s type system provides many advanced features that you don’t usually have to know about, but that can help you if you want to ensure that some complicated invariants hold in your program. Scarily named concepts such as “higher-ranked polymorphism”, “generalized algebraic datatypes” and “type families” essentially provide you with a way to write programs that compute with types. The possibilities are nearly endless. From playful things such as writing a C-printf-style function where the first argument determines the number of arguments that are expected afterwards as well as their types, you can go on to code that provides useful guarantees such as that mutable references that are available within one thread of control are guaranteed not to be accessed in a completely different context, arrays that can adapt to different internal representations depending on what type of values they contain, working with lists that are guaranteed to be of a specific length, or with trees that are guaranteed to be balanced, or with heterogeneous lists (where each element can be of a different type) in a type-safe way. The goal is always to make illegal inputs impossible to construct. If they’re impossible to construct by the type system, you can isolate sanity tests at the boundary of your code, rather than having to do them over and over again. The good thing is that these features are mostly optional, and often hardly affect the interface of libraries. So as a user, you can benefit from libraries employing such features and having extra safety guarantees internally. As a library writer, you can choose whether you’re happy with the normal level of Haskell type safety (which is already rather a lot), or if you want to spend some extra effort and get even more.


If my overview has tempted you and you now want to learn more about Haskell, you’re welcome follow one of my introductory or advanced Haskell courses that I (together with my colleagues at Well-Typed) regularly teach at Skills Matter. These courses do not just focus on the type system of Haskell (although that’s a significant part). They introduce the entire language in a hands-on way with lots of examples and exercises, as well as providing guidelines on how to write idiomatic Haskell and how to follow good development practices.

If you already know some Haskell and are particularly interested in the advanced type system features mentioned in point 7, we also offer a new one-day course on Haskell’s type system that specifically focuses on how far you can push it.

While It’s Compiling: Skills Matter Interviews Scott Wlaschin

While It’s Compiling is a series of interviews with experts across a range of bleeding-edge technologies and practices, exclusive to Skills Matter. Be sure to subscribe to this blog for future interviews, or follow us on Twitter.

Find out who we’ll be interviewing next and get a chance to put your questions forward with our hashtag #whileitscompiling.


scott_square_300This week on While It’s Compiling, we talked to Scott Wlaschin. He is a consultant at FPbridge.co.uk, creator of and blogger on F# for Fun and Profit, and the author of Understanding Functional Programming. Scott will be giving a talk on Railway Oriented Programming at the Functional Programming eXchange 2014.

1. What attracted you to Functional Languages in the first place?

I like languages that have simplicity, elegance and power, and are fun to program in. Many years ago, I spent a lot of time using Smalltalk, which is one of my all time favourite languages, and until recently languages like C# and Python were my main focus. I am also a fan of static typing, so when I discovered that I could get the power of static typing in a low ceremony functional language like F# (thanks to type inference), I was thrilled.  Also, like many people, I was frustrated with the bloat of modern OO programming and all the buzzwords that you had to learn. I was working towards breaking my code into much smaller, immutable pieces anyway, but the standard OO languages did not make this easy – whereas this approach was naturally suited for FP.

2. What are you working on?

Most of my recent work has been on standard enterprise software: services, e-commerce, supply chain, etc. I am convinced that FP is not just for academics or scientists, but has a vital role to play in what I call “Boring Line Of Business Applications”. Recently I have set up a FP consulting company (fpbridge.co.uk) to focus on training in this area. I am also working on a book, “Understanding Functional Programming”, which approaches FP from a non-academic point of view.

3. Do you work in only FP languages, or does the project you are working on have some FP code and some OO/Procedure code? If so, how do they fit together?

I work in a mixture of C# and F#. They work extremely well together. Don Syme and the F# team have done a fantastic job integrating F# into the .NET and Visual Studio environment. Most businesses are reluctant to fully commit to a functional language, so the functional stuff does tend to be around the edges; testing, utilities, analytics, and so on.  However, some projects have been purely in F#, and these are attracting attention for being faster to deliver, higher quality, and lower maintenance than the equivalent C# projects.

4. What is one piece of advice you can give to new programmers?

To paraphrase Doug Englebart, programming languages are tools to augment your intellect and help you solve problems. So, you should add as many tools to your tool chest as possible! Learn a variety of different programming paradigms using the “purest” language possible; e.g. learn OO using Smalltalk, FP using Haskell, logic using Prolog, stack-based using Forth/Factor, etc. This will expand your horizons and help you appreciate the bigger picture. If you stick with only mainstream languages (C# or Java, say) you will end up with a narrow (and boring) vision of how programming languages can help you think. Also, as part of this journey, you will discover that people from 30 or 40 years ago had a lot of insight and wisdom. Don’t overlook their ideas just because they are old!

5. What would you like to ask the community?

I think the FP community is doing well right now — there is a lot of interest from newcomers and in general the community is very welcoming. However, I would ask the community to appreciate that as FP becomes more mainstream, it will also have to become less pure and academic.  We shouldn’t scare newbies off by insisting that they have to understand monads and all the other scary terminology before they can be productive. What other things could we do to lower the barriers to entry?


What can we do to make Functional Programming more accessible? Tweet us at #whileitscompiling or @skillsmatter 

Scott will be giving a talk on Railway Oriented Programming at the Functional Programming eXchange 2014.

fpx-2014-1000x300px

2013 is behind us, but 2014 is just beginning! Check out these conferences from Skills Matter!

Droidcon 2013, London

Last year we ran 29 conferences, attracting people from all over the world to our events in London and New York, and we had a blast! Not ones to rest on our laurels, we’re very pleased to announce the following conferences for 2014. There will be more to follow, with an exciting opportunity for iOS developers in the works, so be sure to keep an eye on our website for more info, or follow us on Twitter for updates!


The Functional Programming eXchange 2014

Functional Programming eXchange 14 Mar 2014

The Functional Programming eXchange returns to Skills Matter for it’s sixth year with the theme Data Science with Functional Programming. This is the ultimate chance to meet and learn from the leading experts in the Functional world. Meet other like minded developers, not necessarily just from your specific discipline, to share common challenges and discuss practical solutions.

Rather than focusing on the merits of one language above another, the eXchange gives a platform for cross functional solutions to software problems. There will be ample opportunity to brainstorm, code, and interact with 100+ functional developers on the day.

CukeUp! 2014

Cukeup! 10 Apr 2014

CukeUp! 2014 is a fast-paced conference inspired by and organised with Aslak Hellesøy, the creator of Cucumber BDD – who will also be this years’ keynote speaker. Together, we’ve been assembling the community since 2011 for this intense conference – 2014 will see it stretch to two days for the first time, which just proves its popularity!

This exciting event is based around tutorials on the first day, and 30 minute talks on the second day – you can look forward to hearing about all the latest developments and best practices in Cucumber, presented by leading experts.

Progressive .NET Tutorials 2014

Progressive .NET Tutorials 28 May 2014

Don’t miss this three-day conference, where you’ll be taking a real deep-dive into .NET in four-hour sessions! These three days are a highly practical, deep-dive insight into complicated ideas and topics on everything to do with .NET in an intensive learning atmosphere – you’ll need your laptop!

With the help of Ian Cooper, the London .Net user group lead and renowned .Net expert, we will get you the best brains available!

ddx-14-800-px-x-300-px

DDD eXchange 20 June 2014

At the DDD eXchange 2014 you’ll discover all the newest innovations in Domain-Driven Design and get the chance to learn and share solutions and new ideas! This eXchange brings together the Domain Driven Design community with the experts who lead it for a day of networking, sharing new ideas, creating partnerships, and learning from the best and brightest in the field.

Each year, with the blessing of Eric Evans (the father of Domain-Driven Design) we welcome an array of high-profile speakers to explore and share new thoughts about DDD with grass-roots designers, programmers, and architects.


Did you attend one of our conferences in 2013? What did you think? What else would you like to see Skills Matter cover in 2014? Let us know in the comments section below!

This Week at Skills Matter: 13th-17th January 2014

Last week we welcomed the London Java Community for our first two events of 2014! On Wednesday, Madhusudhan Konda explored what’s new in Java8 and Joshua Wöhle provided insight in how (quickly) a tech stack evolves in a start-up.

Gleb Smirnov talks at the London Java Community meetup, London

On Thursday the LJC returned with a talk from Gleb Smirnov on Mutation Analysis, in which he covered the available Java tools to do it, and shared a number of success stories.

This week we have five events, including a brand new user group! Don’t forget, these events are free but we do ask that you register before attending to avoid disappointment as spaces are limited. You can also check out our website for more upcoming meetups and user groups, or follow us on Twitter for updates. We look forward to seeing you all again in 2014!

Monday:

The week begins with the London Ruby Users Group who come to Skills Matter for their first meet-up of 2014. At this months meetup Javier Ramirez talks about dealing with big data in PI Analytics with Redis and Bigquery. Javier will be followed by Julien Letessier, wo will be speaking about using data tiering to squeeze scale out of SQL.

Register for your place now!

Tuesday:

The London Java Community will be discussing Android and The Web of Things on Tuesday. Asking questions like ‘what if every day objects could all become part of a gigantic network also known as the Internet of Things?’ And ‘what if your watch, guitar, bike or bottle of organic iced-tea could all have an active digital identity on the Web? By combining technologies such as NFC, QR-codes, Bluetooth low energy and Android smart phones, this becomes an ideal framework to implement the Web of Things…

For more information and to register your place, click here.

Also on Tuesday, the London Ajax Meetup will be joined by Jamie McCrindle & Santi Albowe for a walkthrough of how they’re putting thei AngularJS apps together using TypeScript, Yeoman, Restangular, a RESTful API, S3 and a CDN.

Register your place now!

Wednesday:

Julia programming language logoOn Wednesday we’re very excited to welcome the first meeting of the London Julia Users Group. As a relatively new programming language of interest in the emerging field of Data Science, Julia has many features to commend it over existing approaches, not the its speed of execution.

The discussion will look at using Julia on all platforms: Linux, OSX and Windows; getting up and running, the Julia package system and JuliaStudio IDE, plus any teething problems, trials and tribulations.

Register you place for this meetup now!

Thursday:

Finally, on Thursday, we welcome the F#unctional Londoners for their first meet-up of 2014. At this months session Ross McKinlay will present ‘SQL Type Provider Deep Dive’. Ross has over 20 years programming experience in a wide variety of different languages and technologies, ranging from games and financial markets to fraud prevention and investigation. He has more recently been working on F# type providers. He loves squirrels, physics, electronics, robotics, functional programming, programming languages in general and squirrels.

Book your place for the F#unctional Londonders meetup now!


What did you get up to in 2013? And what are you looking forward to in the world of Open Source in 2014? Let us know in the comments below!