1. 首页
  2. 移动开发
  3. 其他
  4. purescript sytc:PureScript中类似于Scala的特征 源码

purescript sytc:PureScript中类似于Scala的特征 源码

上传者: 2021-04-07 13:03:06上传 ZIP文件 25.13KB 热度 20次
purescript-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 = " 1 + " <> show (i - 1 ) | i < 0> show (i + 1 ) 类型类位于全局范围内。 编译器将所有实例存储为表的“行”。 因此, Show上方将是一个表, showString将是一个列,如将showInt 。 然后,当找到类型x的值时,它将在表中
下载地址
用户评论