First of all I'm very new to haskell and functional programming in general, so there might (will) be some very dumb mistakes in my code.
I'm trying to replace a few characters in a string with one or more different characters without using any libraries. The string could look like this "w1w1w8/w7w1w1//w". I want to replace every number greater than 1 with the corresponding amount of ones and the '/' with ten ones.
After reading a few similar posts, I came up with this:
replace x =
let
repl '/' = "1111111111"
repl '9' = "111111111"
repl '8' = "11111111"
repl '7' = "1111111"
repl '6' = "111111"
repl '5' = "11111"
repl '4' = "1111"
repl '3' = "111"
repl '2' = "11"
in map repl x
Well, it doesn't work and I would appreciate some input on this or even a way to achieve my goal. Thanks in advance.