added Num a to type signature in order to fix ambiguity error given by compiler