Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you like this kind of pattern you might want to read up on Haskell’s GADTs. Generalized algebraic data-types.

This is where you can index the different constructors (enum variants) with an additional type variables and even specialize them when needed. A pretty powerful tool to encode at the type level that similar things are slightly different.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: