Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Make the Plan a Value

The article discusses how the author implemented idempotency tokens in the Amazonka Haskell AWS SDK. To achieve this, they introduced a "plan" concept, separating the decision-making process from the execution phase. This decoupling simplifies testing and makes the codebase more manageable. The author likens this approach to the "plan-execute" pattern and "routing slip" integration pattern.

They introduce a Config record and a function called instanceD to build Haskell code from this plan type. The generator's logic was refactored incrementally, starting with response parsing. The idea is to keep a "do it the old way" constructor in the plan type until the old method has been refactored. This technique allows for alternate consumers of the plan, such as testability, --dry-run, and simpler executors.

The author also highlights that Haskell's laziness makes this approach particularly convenient, but the benefits apply to other languages as well.

Rewritten by urgent.news; may contain errors — check the original.

Source: jackkelly.name

Read the original at jackkelly.name →

Report a problem with this story

More in Tech

How to Monitor Unlimited Client Websites for $0/Month (GitHub Actions + White-Label Status Pages Without Git Bloat)

Once you manage more than 5–10 client websites, SaaS uptime monitors get expensive fast—especially if you want white-label status pages , SSL expiry alerts , and commercial client usage (which free…

  • Leverages Python's standard library for uptime monitoring
  • Utilizes GitHub Actions and GitHub Pages for white-label status pages
  • Provides free, zero-server monitoring system without Git bloat

More from Thursday 26 November →