You can fix it with:
expt x = [(x ** e) / (product [1..n]) | e <- [0..], n <- [1..e]]
The type of your function is (Fractional t, Integral t) => t -> [t]
The error indicates that it is ambiguous which type you want to use for t
. There doesn't seem to actually be such a type. The reason for the Integral
constraint is your use of ^
. If you replace it with (**)
then the type of expt
changes to
(Enum t, Floating t) => t -> [t]
and you can then use Double
or Float
.