1.
addOne pid
ghc-pkg 是一个随 GHC 发行的比 cabal-install 底层的包管理工具,用于操作 GHC package database。cabal-install 支持多个 Haskell 编译器,而 ghc-pkg 仅用于 GHC。
2.
3.
编译器注示 pragma
data Point = Point {-# UNPACK #-} !Double {-# UNPACK #-} !Double
-funbox-strict-fields编译器
4.
SPECIALIZE可以与INLINE同时使用,INLIEN 有时可以直接加到SPECIALIZE的后面,
此外SPECIALIZE还可以特化类型类实例
5.
chapter23 arrow简介
Arrow类型类
Category类型类,规定了计算过抽象结构中恒值映射与计算之间的复合操作,在Control.Category模块中的定义
class Category cat where id :: cat a a (.) :: cat b c -> cat a b -> cat a c
6.
ArrowChoice类型类
7.
chapter 24 函数反应式编程简介
Functional Reactive Programming FRP
continuous behavior 连续的行为与离散的事件(discrete event)
24.1 传统的函数反应式编程
连续的行为(continuous behavior)与离散的事件(discrete event)
{-# lANGUGAGE DeriveFunctor #-} import Numeric.Integration.TanhSinh import Control.Applicative type SampleTime = Double type StartTime = Double type Time = Double data Behavior a = Behavior (StartTime -> SampleTime -> a) deriving Functor instance Applicative Behavior where pure a = Behavior (\t0 t1 -> a) (<*>) (Behavior fab) (Behavior fa) = Behavior (\t0 t1 -> fab t0 t1 (fa t0 t1)) constant :: a -> Behavior a constant = pure
integration :: Double -> Double -> (Double -> Double) -> Double integration t0 t1 f = let Result r err eval = absolute (1e-6) (parTrap f t0 t1) integral :: Behavior Double -> Behavior Double integral (Behavior beh) = Behavior $ \t0 t1 -> integration t0 t1 (beh t0) iIntegral :: Double -> Behavior Double -> Behavior Double iIntegral x b@(Behavior beh) = fmap (+x) (integral b)
integral 是对连续的行为再时间上做积分,iIntegral 是把一个常数值加到积分的计算结果上
reactimate
8.
Yampa