Haskell 高级概念总结
Functor, Applicative, Monad
Functor, Applicative, Monad
Applicative 处于 Functor 和 Monad 之间.其定义如下: 123456class Functor f => Applicative f where pure :: a -> f a liftA2 :: (a -...
Text 与 ByteString 由于 String 仅仅只是 [Char] 的别名,所以速度很慢.以下两种类型可以用于替代 String Data.Text 表示 a sequence of Unicode Chars Data.ByteSt...
The Monad type class is a way to represent different ways of executing recipes
higher order function: transform functions to functions Functors 的作用在于 Preserve structures. 例如 map 可以处理 [a] -> [b] 的问题,而...
do block 的返回值必须是 IO <something>. return :: a -> IO a 是一个函数 value <- something 表明 something :: IO X 且 value :: X,并...
Haskell 运行的底层原理
Type Class Type Class 类似其他语言里的 Interface、Rust 里的 Trait,定义了一组函数,任何属于该 Type Class 的类型都必须实现这些函数。 When to use Type Class? ...
临时变量语法、模式匹配