haskell type and typeclasses
来源:互联网 发布:java常见的gc算法 编辑:程序博客网 时间:2024/05/30 23:52
use :t to show expression's type
common types:
Int, bounded, in 32-bit system, between -2147483648 and 2147483648
Integer, like Int, not bounded
Float
Double
Bool
Char
typeclasses: typeclass is a sort of interface hant defines some behavior, if a type is a part of a typeclass, that means that it support and implements the behavior the typeclass describes. so we can think the typeclass is kind of as java interface
common typeclasses:
Eq, if there's an Eq class constraint for a type variable in a function, it uses == or /= somewhere inside its definition. why said it uses but not have capability? because in haskell, no variable, no object, so 只有这个函数使用了== or /=,才会说这个函数类型有Eq这个class constraint
Ord: ordering, > < >=, <=
Show: presented as string
Read: opposite typeclass of Show
Enum: members are sequentially ordered types
Bounded: members have an upper and lower bound
Num: is a numeric typeclass
Integral: is also a numeric typeclass. Num includes all numbers including real numbers and integral numbers, Integral includes only integral(whole) numbers.
Floating: includes only floating poing number
- haskell type and typeclasses
- haskell学习笔记(3)-Types and Typeclasses
- haskell 趣学指南笔记-1type and typeclass
- Haskell
- Haskell
- haskell list pacakges and install missing packages
- Install Haskell on Ubuntu and CentOS
- [Haskell on HackerEarth] Roy and Profile Picture
- [Haskell on HackerEarth] Monk and Digital World
- [Haskell on HackerEarth] Monk and Welcome Problem
- [英]Haskell and Genetic Algorithm solving Sudoku
- Value Type And Reference Type
- 永不消逝的浪漫:Programming Languages and Haskell
- [Haskell on HackerEarth] Life, the Universe, and Everything
- Parallel and Concurrent Programming in Haskell.pdf 英文原版 免费下载
- 反射:Type and Reflection
- Variable and basic type
- accept and content-type
- DBSet的mock
- physdiskwrite使用教程
- 本人译著《Professional Xcode 3》现已翻译完毕
- 把字符串中所有小写字母转换成大写,其余不变,不能用Stirng.toUpperCase()方法
- Java IO 练习
- haskell type and typeclasses
- 北京和仁中控数字医疗技术有限公司面试笔记
- 本人译著《iPhone Game Development》即将由人民邮电出版社出版
- dedecms xss oday通杀所有版本 可getshell
- Struts2中$, #与%的区别
- 字符串数字转换成整型(不用Integer.valueOf()方法)
- 准备让自己的博客恢复生机
- JS德州扑克01
- 图解Cisco Packet Tracert之利用TFTP来升级路由器的IOS