by simplify · 10y ago · 0 comments
For example, if you're reading records from a SQL database, you don't have to bother wrestling with the type system – just tell it what your data looks like! :)
let Pet = Object.of({ name: String, happiness: Number })
$assume `fetchPets : (Number) => Promise( Array(Pet) )`
function fetchPets (minHappiness) {
return db('pets').select('*').where('happiness', '>', minHappiness)
}