Advanced Types in Elm - Opaque Types
Charlie Koster
1K3

Opaque types are great in all sorts of ways. Immutability isn’t a protection when it comes to invariants. Encapsulation — i.e., opaque types — is. Given the frequency with which records are used in Elm code, it’s too bad one has to wrap them to make them opaque. (Or if willing to put up with the extra source code, it’s too bad the compiler doesn’t optimize for the case of types with a single constructor.)

Like what you read? Give Mark Hamburg a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.