Introducing checked-literals: compile-time bounds checking for numeric literals

GHC’s builtin overflow warnings are easy to bypass and don’t work for custom numeric types. We wrote a GHC source plugin, checked-literals, that rewrites numeric literals so that out-of-range values are rejected at compile time. It works in monomorphic and polymorphic contexts, supports integer and rational literals, and produces actionable error messages – including suggested type-level constraints.

Tricking Haskell into state: how Clash's Signal type works

I recently came across a question on /r/haskell, where /u/netj_nsh asked whether Clash supports asynchronous circuit designs. They went on to ask whether designing with multiple, synchronous clock domains is possible. While the (very) short answers are no and yes, respectively, I figured I’d write a blog post clarifying these concepts and how they relate to Clash. Mostly though, I just wanted an excuse to write about Clash’s simple yet clever trick that makes it tick: Signal.