PureScript实例教程5.9练习1和2
我的解决方案:
type HasCity r s = { address :: { city :: String | r } | s }
livesInLA :: forall r s. HasCity r s -> Boolean
livesInLA { address: { city: "Los Angeles" } } = true
livesInLA _ = false
sameCity :: forall r s t u. HasCity r s -> HasCity t u -> Boolean
sameCity a b = a.address.city == b.address.city
问题:
forall r s t u. HasCity r s -> HasCity t u
这种写法太糟糕了,能简化一下吗?