On two different definitons of a module I'm reading the book "Symmetry and the Standard Model: Mathematics and Particle Physics" by Matthew Robinson. On page $70$ of the book the author gives the following characterisation of a module of a set $M$.

Previously, we discussed how elements of a group act on each other, and we also talked about how elements of a group act on some other object or set of objects (like three painted eggs). We now generalize this notion to a set of $q$ abstract objects a group can act on, denoted $M=\{m_0,m_1,m_2,\dots,m_{q-1}\}$. Just as before, we build a vector space, similar to the one above used in building an algebra. The orthonormal vectors here will be
\begin{equation}
m_0\mapsto|m_0\rangle,\quad m_1\mapsto|m_1\rangle,\quad\dots\quad m_{q-1}\mapsto|m_{q-1}\rangle\tag{3.48}
\end{equation}
This allows us to understand the following definition. The set
\begin{equation}
\mathbb{R}\mathbf{M}=\left\{\left.\sum_{i=0}^{q-1}a_i|m_i\rangle\,\right|\,a_i\in\mathbb{R}\,\forall i\right\}\tag{3.49}
\end{equation}
is called Module of $M$ (we don't use square brackets here to distinguish modules from algebras).

But then I looked at the definition of a module on Wikipedia and it seems to be something very different.
Can someone explain the difference/similarity between the two definitons?
 A: A more general note first: modules over rings are a natural generalization of vector spaces over fields. In particular, a $R$-module with $R$ a field is nothing else than a $R$-vector space. So one can call vector spaces modules but I think this is more confusing than everything else.
What is constructed here is the so-called free module over $M$. This is the most general module structure one can construct given a set $M$ and some base ring $R$. Formally, this may be introduced by means of universal properties but I do not think this is beneficial right now. Intuitively, the construction is clear: we need to somehow close our set under linear combinations, that is allow addition of its elements and scalar multiplication by elements of our ground ring (an entirely analogous construction exists for vector spaces, given a ground field yielding the free vector space over $M$) as the module axioms dictate us.

To elaborate on this (as I have seen your question in the comments): a module $M$ over a ring $R$ is an abelian group $M$ with an external scalar multiplication $\cdot\colon R\times M\to M$ satisfying some compatibility axiom (i.e. making the whole thing well-behaved). As it turns out it suffices to just expect every (finite) linear combination of elements of $M$ with coefficients in $R$ to be in it.
Indeed, the trivial linear combination is our neutral element in $M$ and we have $(-1)\cdot m=-m$ as additive inverse. So this will gives us an abelian group. The compability axioms are only concerned with the scalar multiplication and its interaction with addition. The situation is much like for vector spaces and the axioms all follow at once if we consider the set of (finite) linear combinations.
In the given case we actually have a basis (something modules do not have in general and why their general definition is different; modules with a basis are called free) given by the $|m_i\rangle$ which simplifies the discussion significantly. In fact, it is only of importance that $M$ is finite in your case which makes everything so easy.

The map $m_i\mapsto|m_i\rangle$ is a "vectorfication" of the elements of $M$ to distinguish between their role as elements of $M$ and as base vectors for $\mathbb R\mathbf M$. The definition of the Module of $M$ then does exactly what I mentioned above: include all linear combinations in the $|m_i\rangle$ manually. You can check that this construction gives in a fact a $\mathbb R$-vector space (i.e. a $\mathbb R$-module but $\mathbb R$ happens to be a field; so here is your connection to the general notion of modules).
