2 hours ago · 10 min read2088 words · Tech · hide · 0 comments

Initial API definition and a simple property. This article is one of a series on finding properties for a budgeting kata. I expect you to have read the previous articles in the series. In this article we get started by adding a first sketch of data structures and an initial, simple property. The code is available on GitHub, in the commit 1f7aceb. Budget type # My intent with the entire exercise is to follow a variation of test-driven development (TDD) that uses QuickCheck properties rather than static examples. Even so, Haskell is such a strongly typed language that I often start with a bit of type-driven development, sketching out how data types and functions may look. I did that here as well, starting with the budget. data Budget a = Budget { totalLimit :: Int , categoryLimits :: Map a Int } deriving (Show, Eq) As I noted in the introduction article, this was my third attempt. Two previous attempts had taught me that it might be useful to be able to define the set of values from…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.