dependent types, with option and runtime checking