Get the latest tech news

Silly job interview questions in Haskell


The Personal blog and musings of Chris Penner, a designer, developer and future opsimath.

I write a helper function "fizzle" here which converts a number into its appropriate string so I can keep the "printing" logic separate, which is good programming style in Haskell as it makes things easier to both test and reason about. The nice thing about that is that functions are composable and have very clean boundaries, which means we don't need to intermingle the syntax of a for-loop with our logic. Lastly we add one more pattern match which handles all invalid inputs (either negative numbers or empty lists) and simply assert that they have no valid combinations.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Haskell

Haskell

Related news:

News photo

Packed Data Support in Haskell

News photo

Test Spies in Haskell

News photo

Falsify: Hypothesis-Inspired Shrinking for Haskell (2023)