Dear Scala users,

I'm reading through the Functional Programming in Scala book and in the Monoids chapter, they talk about a Monoid interface that looks like this:

```
trait Monoid[A] {
def op(a1: A, a2: A): A
def zero: A
}
```

Later on, they define specific Monoid instances by extending this interface. For example.,

```
val intMonoid = new Monoid[Int] {
...
}
val listMonoid = new Monoid[List[Int]] {
...
}
```

A couple more pages that I read through this chapter 10, I come across 'higher kinded types (HKT)' which according to the book is any type that it self is a type that can take other types.

```
trait Foldable[F[_]] {
...
...
}
```

So the trait Foldable is according to the book a higher kinded type. My question is, the Monoid[A] to me is also fits the 'higher kinded type' definition as it can take a List[A]

```
def listMonoid[A] = new Monoid[List[A]] {
...
...
}
```

So is my listMonoid function an implementation of the Monoid[A] HKT?

Thanks,

Joe

--

You received this message because you are subscribed to the Google Groups "scala-user" group.

To unsubscribe from this group and stop receiving emails from it, send an email to

[hidden email].

For more options, visit

https://groups.google.com/d/optout.