新类型有自己的 data constructor (literals 可以看成特殊的 data constructor),由这一点来区分是否创建了新类型。
data 创建了新类型,可以有多个 data constructor。
newtype 创建了新类型,只能有一个 data constructor,同时新类型的内存布局与原来的类型相同。
type 没有创建新类型,只是建立了 alias,没有新的 data constructor。
type
常用于语义化类型,是业务逻辑层的概念。
```haskell
type ID = Int
a = 1 :: ID
b = a + 2 -- legal
showID :: ID -继续阅读 »
Oftentimes, we obtain a long or a wide table from a certain data source, and it may be the only format we can get. For example, some financial databases provide daily tick data for all stocks in a financial market. The data table may be arranged in a long format like this:继续阅读 »
In both research and application, we need to manipulate data frames by selecting desired columns, filtering records, transforming and aggregating data.继续阅读 »
As we know, a Brownian motion is usually formulated as $$dx_t = \mu\,dt+\sigma\,dW_t$$ which is the continuous case of a random walk. In some cases, it is quite convenient to use this formulation to describe the characteristic of asset prices due to its highly unpredictable behavior.继续阅读 »