haskell - Convert Markdown To HTML Symbols -
i'm writing program in haskell converts markdown html , right im trying write basic function convert main symbols , seem having issues function , error code vague stating "testing.hs:15:28: parse error on input ‘&’" following have:
symbol x " " = "" symbol x (y:ys) | x == '&' = '&' : (symbol ys) | x == '<' = '<' : (symbol ys) | x == '>' = '&rt;' : (symbol ys) | otherwise = y : (symbol ys)
any in explaining i'm doing wrong appreciated thanx
some things should rectify: use string
instead of char
representing &
. recursive call symbol
not complete. missing arguments.
symbol :: [char] -> [char] -> [char] symbol x " " = "" symbol x (y:ys) | x == "&" = "&" ++ (symbol x ys) | x == "<" = "<" ++ (symbol x ys) | x == ">" = "&rt;" ++ (symbol x ys) | otherwise = y : (symbol x ys)
Comments
Post a Comment