说明:purescr ipt-extensible-sytc
。
背景
类型类是为某些类型定义函数行为的方式。 这是一个例子:
class Show a where
show :: a -> String
instance showString :: Show String where
show = identity
instance showInt :: Show Int where
show i
| i == 0 = " 0 "
| i > 0 = " <weixin_42133899> 上传 | 大小:25kb