Skip to content

Instantly share code, notes, and snippets.

@joboet
joboet / 0000-pattern-types.md
Last active June 3, 2024 12:14
Pattern types RFC

Summary

This RFC introduces pattern types, which are subtypes of matchable types that are statically restricted to a subset of the variants of the original type.

@pthariensflame
pthariensflame / IndexedState.md
Last active June 15, 2022 18:42
An introduction to the indexed state monad in Haskell, Scala, and C#.

The Indexed State Monad in Haskell, Scala, and C#

Have you ever had to write code that made a complex series of succesive modifications to a single piece of mutable state? (Almost certainly yes.)

Did you ever wish you could make the compiler tell you if a particular operation on the state was illegal at a given point in the modifications? (If you're a fan of static typing, probably yes.)

If that's the case, the indexed state monad can help!

Motivation