摘要: type 类型别名 type IntList = [Int] 注意大写 newtype 类似data 但只允许有一个构造函数,构造函数只能有一个参数 newtype Cm = Cm double deriving Eq 优点:快 阅读全文
posted @ 2021-10-23 12:56 liankewei123456 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 数字类 这玩意就不鸡肋了,看起来还挺重要 quot 除法,向 0 取整 div 除法,向下取整 quot/rem 比 div/mod 快 ceiling /floor 向上/向下取整 阅读全文
posted @ 2021-10-23 12:53 liankewei123456 阅读(35) 评论(0) 推荐(0) 编辑
摘要: class 类 顾名思义就是一类玩意,他们有着相似的特点 Eq 等价类 Ord 有序类 Show/Read Num 数字类 + - * abs signum Integral 整数类 div mod Fractional 小数类 typeclass 类型类 这个翻译的...我快看不懂类字了 data 阅读全文
posted @ 2021-10-23 10:55 liankewei123456 阅读(64) 评论(0) 推荐(0) 编辑