Talk:Type arithmetic

From HaskellWiki
Jump to: navigation, search



This why?






One example

I'm working on code where I need to handle a stack of objects of different types. I like the security of type-safety, so I use HList instead of creating a universal wrapper type, wrapping all the elements, and using a homogenous list. But to index into a heterogenous list, you have to use a type-level index. Then to be able to manipulate the indices, you need to be able to do type-level arithmetic.

Not necessarily something you'd do every day, but when it's needed, it's needed. --Nedervold 04:26, 14 March 2007 (UTC)