So I have the following list of tuples and a string
type M a = [(String, String)]
m = [
("x", "a car"),
("y", "a animal")
]
s = "this is x and y"
I am trying to
strRep m s => "this is a car and a animal"
So this is my attempt so far
import Data.List.Utils
strRep :: (Show a) => M -> String -> String
strRep [] s = s
strRep (m:ms) s = replace (fst m) (snd m) s : strRep ms s
The above code returns a list of string. I cant quite figure out the proper way to do loop here.
replacefrom?