RSSAmplifier

Blog

Nicolas Hery

Nicolas Hery is a software engineer and engineering manager. He works with a variety of programming languages and platforms to design and implement technical solutions to real business problems.

nicolashery.comRSS feed ↗12 posts

Latest posts

Decoding JSON sum types in Go without panicking

Table of contents Whether we find them useful or not, sum types exist My first nil pointer panic in Go was due to lack of sum types Decoding JSON sum types in Go, take one How do OpenAPI and Protobuf handle this? Decoding JSON sum types in Go, take two Alternative implementations What Go could have been: V lang? Examples in other languages Whether we find them useful or not, sum types exist Sum…

Nesting APIs and ReaderT environments with Servant

Table of contents Introduction Server vs. request environment An example nested API Nested ReaderT environments Implementing the request handlers The Has type class pattern Wrapping up Introduction Many of the HTTP APIs I've worked on tended to have a nested nature. At each level or sub-API, the request handlers often shared some amount of context. And the deeper you went into the API's nested…

Using MonadLogger without LoggingT

This post is likely more useful for people beginning with Haskell than those with more experience. When I was less comfortable with Haskell and its ecosystem, it wasn't obvious to me how to use code with a MonadLogger constraint without using the LoggingT transformer. Now that it makes sense, I thought I'd write up my notes. They might help someone who is asking themselves the same question. Table…

Comparing request handlers in Scotty, Yesod, and Servant

Table of contents Context Non-trivial request handler Custom monad Fake cart purchase for a booking site Key takeaways Further reading Wrapping up Context When someone asks on the internet "which Haskell web framework should I use?", popular answers are Scotty , Yesod , or Servant . Each answer gives different arguments and tradeoffs. On one end of the spectrum, Scotty is easy to start with. It is…

Prototyping and data modeling in the browser using TypeScript

A few months ago, my team was working on a large new feature for our web application. It was tricky to fit into the product, especially without introducing a lot of technical debt. We were having many data modeling conversations on how to best represent the new concepts and functionalities. I noticed we were doing a lot of hand-waving and had trouble understanding what each one of us was picturing…

Moving a blog from Jekyll to Eleventy

Earlier this year I spent some time moving this site from Jekyll over to Eleventy . It was probably a way to procrastinate on writing. If you have also fallen into this classic trap, this post might help you spend less time setting things up and get back to writing. And even if you are starting a blog from scratch and not migrating from Jekyll, there should be some useful things here to help you…

Exploring Isomorphic JavaScript

Isomorphic JavaScript applications (you'll also hear the terms "Server-Side Rendering" or "Progressive JavaScript" ) is something we hear and read quite a bit about lately. Node.js made it possible, Airbnb blogged about it in 2013 , React renders HTML on the server , Ember.js is working on "FastBoot" , Andres Suarez from SoundCloud and Michael Ridgway from Yahoo did talks on the subject, etc. I…

Describing UI state with data

If you think about it, the majority of (if not all) software programs are just transformations of data. Given input A , the program P produces output B . It's easy to see this pattern in small Unix command-line tools, but you could also apply it to larger systems, and why not a user-interface? When looking at a mockup of a UI screen, along with some use-cases (ex: user clicks here, this happens),…

Using environment variables with Webpack and Divshot

If you haven't heard of Webpack , it's a great way to bundle modules of any type (scripts, styles, images, etc.), into static files ready for deployment. It comes with a dev server for local development, with fast incremental rebuilds. Divshot is a great service that lets you easily deploy those files right from the command line. Think Heroku , but for static web apps. Divshot's command-line tool…

Integrating D3.js visualizations in a React app

I've been working with D3.js and React lately, and in this post I wanted to share a few ways I found in building components and the interface between them. I think they help make both libraries work together quite nicely. We'll be building a small example to illustrate this, and you can find the full code on GitHub , as well as a running version of the app. I'll also assume that you have some…

Parse data files using Node.js streams

Streams and pipes are an important part of the Unix philosophy : Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface. -- Doug McIlroy, inventor of Unix pipes and one of the founders of the Unix tradition This means that we can have small, focused programs that are easily assembled together to…

Creating a fast and mobile-friendly website with Jekyll

Jekyll is a static site generator: it transforms plain text files (in Markdown for content, Liquid for templates) into an HTML, CSS, and JavaScript website ready for deployment. There are other options out there to create a website or blog, like the popular Wordpress , or the more recent Squarespace and Ghost . These are dynamic , which means your content is stored in a database and is filled in…