Sequential decision problems, dependent types and generic solutions (Logical Methods in Computer Science, 2017)