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 == '&'  = '&amp;' : (symbol ys)     | x == '<'  = '&lt;'  : (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 &amp;. recursive call symbol not complete. missing arguments.

symbol :: [char] -> [char] -> [char] symbol x " "        = "" symbol x (y:ys)     | x == "&"  = "&amp;" ++  (symbol x ys)     | x == "<"  = "&lt;" ++ (symbol x ys)     | x == ">"  = "&rt;"  ++ (symbol x ys)     | otherwise = y : (symbol x ys) 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -