Showing posts with label types. Show all posts
Showing posts with label types. Show all posts

Saturday, February 24, 2018

OCaml: Algebraic Data Types



In previous post, we showed several simple usages of pattern matching. Pattern matching is actually even more useful with algebraic data types. In functional programming, an algebraic data type is a kind of composite type, i.e. a type formed by combining other types.

User-Defined Types



We've seen OCaml's type syntax because the interpreter uses it to tell you the type of every value, but due to type inference we typically don't have to write a type expression ourselves. But actually there are several reasons to use the type sublanguage (as you'll see when we come to modules).

Wednesday, February 21, 2018

The algebra (and calculus!) of algebraic data types



Note: This article assumes some introductory Haskell knowledge. Just as algebra is fundamental to the whole of mathematics, algebraic data types (ADTs) are fundamental to many common functional programming languages.

Friday, February 16, 2018

Type Driven Design



When writing code in a statically typed language sometimes types are considered as orthogonal to the logic of the code. We write them to appease the compiler, or get performance or intellisense & navigation, but all of these has no relation to the code itself. This is wrong.

Type Driven Development by Mark Seemann



Have you ever worked in a statically typed language (e.g. C# or Java), only to wish that you'd be allowed to focus on what you're doing, instead of having to declare types of arguments and create new classes all the time? Have you, on the other hand, ever worked in a dynamic language (e.g.

Wednesday, January 17, 2018

Tutorial: parsing JSON with OCaml



In this article, I’m going to share a little bit of knowledge introducing a brief example of parsing data in OCaml using ocamllex and menhir in a step-by-step tutorial. For those opting to use the repository, you can get it here.

Sunday, January 14, 2018

Redux & Flow-type — getting the maximum benefit from the fewest key strokes



Being a frequent Typescript user I’m fully onboard with the benefits of Type systems. Especially in the arena of UI development with React & React-Native, I don’t think I could ever imagine going back to a time where your props & state updates are not verified by the compiler as you type…

bundlephobia

JavaScript bloat is a more real problem today than it ever was. Bundlephobia lets you understand the performance cost of adding a npm pack...