Skip to content

Instantly share code, notes, and snippets.

@swlaschin
swlaschin / ndcoslo17_fp_track.md
Created July 5, 2017 19:38
Functional Track talks from NDC Oslo 2017

Functional Track talks from NDC Oslo 2017

Also, here is the list of all videos from NDC Oslo 2017:

Wednesday 2017-06-14

Assert On Steroids

I find it useful to have assert statements in my code. It has several benefits:

  • Self documents code expectations
  • Establishes boundary checks between component
  • Helps to pinpoint problems by failing fast, especially when you just started dealing with a new library
  • Here is a good summary on using assertions.

In a dream world all this can be addressed by sophisticated type system but we all know it’s not going to happen any time soon.

@mrange
mrange / fsharp_advent_2016_12_10.md
Last active December 14, 2019 21:44
F# Advent 2016 (English) - December 10 - Implementing a persistent hash map.
@TeaDrivenDev
TeaDrivenDev / FsAdvent2019.md
Last active December 29, 2019 19:52
FsAdvent post for 2019

Paying It F#rward

This article is an entry in the 2019 F# Advent Calendar in English. Thanks to Sergey Tihon for organizing it, as always!

Note: This belongs on my blog, but some things are broken there right now, probably due to changes to GitHub Pages in recent years, so I'm publishing this here for now to at least get a reliable output.

The F# community, while small compared to those of many other languages, is known to be exceedingly open and helpful to beginners. I experienced this myself when I started learning the language nearly six years ago, and people (especially the F# MVPs) were always quick and eager to answer my newbie questions on Twitter, or wrote extensive answers on Stack Overflow or Code Review. Havi

@udalov
udalov / getKType.kt
Last active March 16, 2021 21:54
DEPRECATED example how to obtain KType instance from reified T. Please use "typeOf" since 1.3.40!
import java.lang.reflect.*
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.KTypeProjection
import kotlin.reflect.KVariance
import kotlin.reflect.full.createType
// --- Interface ---
inline fun <reified T : Any> getKType(): KType =
@mrange
mrange / why_fsharp.md
Last active May 7, 2021 13:51
Why F#?

Why F#?

I got inspired to answer the questions posed to F# experts on "Why F#?". I have no claims to be an F# expert but I thought the questions were interesting.

How and when did you get started programming in F#?

I believe I started to look at F# around 2008. I am a language-curious person and was at the time working as a .NET developer so I naturally was excited when discovering F#.

How long did it take before you could code real world apps as much or more productively as in C#?

@isaksky
isaksky / Working-with-SQL-syntax-trees-in-F.md
Last active June 25, 2021 19:21
Working with SQL syntax trees in F#

Working with SQL syntax trees in F#

Update 12/15/2016 - Added Sql generation

Welcome to my blog post for #FsAdvent 2016.

If you're using a relational database, as your application grows in size, at some point you may find yourself looking for an SQL parser. This can give you lots of leverage, for example allowing you to:

  • Do permission checks on queries before executing them
  • Rewrite incorrect or inefficient queries
@mrange
mrange / README.md
Last active March 11, 2022 10:02
[F#/OCaml] Implementing a data streams library using a bunch of one-liners

[F#/OCaml] Implementing a data streams library using a bunch of one-liners

A few years ago when I read the presentation motivating the design behind Nessos Streams I was struck by the beauty of simplistic push streams.

type PushStream<'T> = ('T -> bool) -> bool

LINQ (in .NET) is a pull stream, ie we pull values out of the stream by calling MoveNext + Current. One of the problems with pull streams is the constant checking "Are we done?" at each level in the stream.

@mrange
mrange / on-tail-recursion.md
Last active March 15, 2022 04:57
On the topic of tail calls in .NET

On the topic of tail calls in .NET

Let's say you have implemented a small data pipeline library to replace LINQ.

module TrivialStream =
  type Receiver<'T> = 'T            -> unit
  type Stream<'T>   = Receiver<'T>  -> unit

  module Details =
@mrange
mrange / README.md
Last active May 26, 2022 02:46
# F# Advent 2021 Dec 08 - Fast data pipelines with F#6

F# Advent 2021 Dec 08 - Fast data pipelines with F#6

Thanks to Sergey Tihon for running F# Weekly and F# Advent.

Thanks to manofstick for trying out the code and coming with invaluable feedback. Cistern.ValueLinq is very impressive.

TLDR; F#6 enables data pipelines with up to 15x less overhead than LINQ

There were many interesting improvements in F#6 but one in particular caught my eye, the attribute InlineIfLambda.