Functional programming with dependently-typed higher-order data