We use custom types for that usually, optionally with parametric polymorphism.
But as others said already, Nimony (codename for the next Nim iteration) introduces revamped concepts which should be even more convenient.