When the user inputs number m = 0, the program will never stop counting. Is there any way how to take care of that? so if the user inputs 0 the program will end.
import Control.Monad (replicateM)
transpose :: [[a]]->[[a]]
transpose ([]:_) = []
transpose x = (map head x) : transpose (map tail x)
.
.
.
You missed a case in transpose that is triggered by entering 0:
And the above is quite dangerous, as ‘head’ and ‘tail’ might fail:
[[0,* Exception: Prelude.head: empty list