Tech Nick
About
  • Parallelising Heterogeneous Async Calls

    2025-12-04

    This is a post for the FSharp Advent Calendar 2025. A particular feature of F# 10 got me thinking about approaches to parallelism, past and present. Async.Parallel This system library function is built for orchestrating async calls with homogenous return types. It has an overload that permits controlling the degree of parallelism. static member Parallel: computations: seq<Async<'T>> -> Async<'T array> It’s great for situations where we want to make multiple calls to the same api endpoint with different arguments - because each call expects the same response, we end up with a collection of the response type when all the calls are complete. And given the calls are made in parallel, we might only have to wait as long as the longest call. …

    fsharpparallelismconcurrencyasynctask

  • RightResult Write Up

    2021-04-13

    About the design What problem inspired this work? RightResult is the SAAS incarnation of a game my friend would coordinate via emails and a spreadsheet. Each week, he would email game members requesting predictions for the weekend’s English Premier League fixtures. Predictions and fixture results were entered into a spreadsheet. The scores would be tallied-up and communicated back to members. The winner was who had predicted most accurately. I built a product to ease the coordination burden and improve the experience for members. It also serves as a technical laboratory with real challenges. …

    elmelmishevent-drivenevent storefablefsharpneo4j

  • Integration testing a locally hosted serverless project

    2020-05-10

    Strategy There are many choices for running integration/functional/e2e tests with a serverless project. There are two main modes of operation for integration testing. The first is cloud-hosted infrastructure in which a temporary copy of the stack is deployed and the intregration tests are pointed at the resources. This has the benefit of increasing the scope of the integration tests to include permissions and configuration. The door is also open for security or load testing, as the target environment is almost identical to what production will be. The downside of testing against cloud hosted infrastructure is that you introduce a network dependency into your stack. Your internet connection must be reliable, and your cloud host must be operational for your tests to succeed. Furthermore, the overhead in creating and tearing down stacks can be wearisom in an otherwise fast-paced development feedback loop. …

    awsserverlessnpmnpm-scriptsintegration-testingmocking

  • A functional wrapper around the .net AWS DynamoDB SDK

    2019-11-29

    We’re going to take a tour of some F# capabilities and use them to enforce the constraints of the DynamoDB client. We’ll look at domain modeling with discriminated unions, data access using the reader applicative, and error handling with the result type. DynamoDB and Data Types Before we get started, let’s summarise DynamoDB and its supported types. DynamoDB is a key-value & document database. DynamoDB tables are schemaless so each record can contain a different number of attributes. A record attribute has a string name and a value that is one of three types: Scalar, Set, and Document. A Scalar is a single value of a particular primitive type: string, number, boolean, binary or null. Number and binary values require string conversion before being sent over the network. …

    fsharpfunctionalmonadsawsdynamodb

  • Combining monads

    2019-08-02

    The F# Result<'a,'b> type allows for concise control flow syntax. The async { ... } computation expression similarly minimizes the noise of asynchrony. Throw in the Writer monad for logging minus the intrinsic IO statements. How do you get the benefits of all three together? You need to combine… Source code gist. Writer The Result and Async types are core types in F# but Writer is not so we need a bit of boilerplate to get going. We define a single case union type in which the single case is parameterized with a function. The function expects a unit and returns a tuple. See this post for details. …

    fsharpfunctionalmonads

  • Serverless package done right

    2019-04-01

    Problem The Severless Framework package command claims to be useful in CI/CD workflows. The command results in the production of AWS Cloud Formation stack json files (or alternative cloud provider equivalent) on disk. These files can be bundled and considered the ‘deployment artifact’ at the end of the pipeline. The artifact can be provided to the serverless deploy command that could be run at a later date. This two-step package/deploy process is very familiar, so I was lured into using the serverless package command. However, there is a major flaw in the design! …

    awsparameter-storeserverlessbash

  • Squash Git Commits

    2018-10-16

    Ever made several commits on a feature branch and needed to rebase? Rebasing multiple commits can be tedious if there is a conflict from an early commit, requiring a commit resolution in every commit that follows. It can be practical, therefore, to squash multiple commits into a single commit before rebasing. Ever wanted to clean up your commit history before pushing? I often make quick commits if I’m required to switch branches, or spiking an idea during development that ends up being permanent. I’m left with messy commit messages that rarely follow best practice. Squashing commits to the rescue again! I can then take the time to carefully construct a commit message. …

    gitzsh

  • Scripting with AWS Parameter Store

    2018-10-12

    Ever need to write a short script as part of development to get feedback on a portion of code? Ever need to add private authentication values to that script? Ever wanted to add the script to source control but couldn’t because it contained your private authentication? Enter: AWS Parameter Store This AWS service acts as a key-value store. Add your private settings such as usernames, passwords, connection strings etc and they can be retrieved programatically by their key name. This lets you commit your handy script to source control by keeping it free from private values. …

    awsparameter-storebashfsharpjq

Tech Nick

Powered by Hugo & Notepadium