### Kinds and some type-foo

Types可以看做values上带着的小标签，我们通过这个标签来获取一些诸如判断如何操作使用的信息。而Types本身也有这样的标签叫做Kinds

ghci里面使用:k命令可以可以查看typekind。在scala console里，也可以同样查看类型。

higher-order value(f: Int => Int, list: List[Int]) => list map {f}这种高阶函数，是一种接受其他type constructortype constructor。类型如(* -> *) -> *，或者可以写成X[F[A]]

scalaz 7.1中，Equal以及其他一些的类型的kindF[A]，而Functor以及其他从它派生而来的类型的kindX[F[A]]。Scala倾向于交叉着使用type classtype constructor，一些术语显得有些混乱。比如，List本身符合Functor的性质，而事实上Functor[List]可以从List派生出来，所以我们说List is a functor

In FP, “is a” means “a instance can be derived from.” @jimduey #CPL14 It’s a provable relationship, not reliant on LSP.

### Tagged type

The newtype keyword in Haskell is made exactly for these case when we want to just take one type and wrap it in something to present it as another type

@@的实现大致如

#### monoid

A monoid is when you have an associative binary function and a value which acts as an identity with respect to that function.

##### Semigroup

monoid继承自semigroup

We have mappend, which, as you’ve probably guessed, is the binary function. It takes two values of the same type and return a value of that type as well.

#### Back to Monoid

mempty represents the identity value for a particular monoid.

#### Tags.Multiplication

So now that there are two equally valid ways for numbers (addition and multiplication) to be monoids, which way do choose? Well, we don’t have to.

#### Tags.Disjunction and Tags.Conjunction

scalaz 7里面，使用DisjunctionConjunction两种方式来区别。

#### Ordering as Monoid

Ordering同样也是Monoid

Monoid到底有什么用呢？比如我们想要比较两个字符串的长度，但是当他们长度相等的时候，就比较字母顺序。就可以这么实现。