作者:紫百合1990_950 | 来源:互联网 | 2023-02-12 13:19
1> Daniel Wagne..:
是的,当然:
foo :: d ~ Data a b c => d -> d
2> Thomas M. Du..:
data Data a b c = Build (a,b,c) deriving Show
type D a t a' = Data a t a'
foo :: D a t a' -> D a t a'
foo d = d
别名很有趣,但这不是一个严肃的答案.
编辑:一个严肃的版本,如果你知道一个常见的单态类型,那么别名就会变得有用:
type AppData = Data AppState AppValue AppResult
foo :: AppData -> AppData
...