The problem with sqrtL2
is x
is not in scope outside the list comprehension. You need to do the fromIntegral
inside the list comprehension like this:
sqrtL2 ns = [sqrt (fromIntegral x) | x <- ns]
sqrtL3
is fine except you don't have a fromIntegral
anywhere and sqrt
is Floating a => a -> a
so it doesn't work with Integer. So you need this instead:
map (sqrt . fromIntegral) ns