Smart constructors - HaskellWiki - 0 views
-
The most interesting are probably the static checks that can be done with Type arithmetic, that enforce the number of bands at compile time, rather than runtime, by lifting the band count into the type level.
-
typecheck perform the check statically, using phantom types and Peano numbers.
-
So encode a type-level version of the bounds check. Only resistors with bands >= 4 and <= 8 are valid:
- ...1 more annotation...