私はマップしたいレコードがあります。記録要素は異種のものですが、より親切な種類のものです data U a = U a
data V a = V a
data R a = R {x :: a Int, y :: a String }
fromU2V (U a) = V a
r1 = R { x: U 1, y: U "yo!" }
map f (R { x: x, y: y })
次の機能をもっとエレガントに書いてもらえますか? 私はいくつかのパターンを見ることができますが、私はそれらのパターンを抽象化する方法や、より簡単な関数の書き方を見つける方法がわかりません。 type HasRemainder = Boolean
tomorrow :: Date -> Date
tomorrow date = unsafePartial $ canonicalDate y (