Text this: Sequential decision problems, dependent types and generic solutions