"parse" function in Language.Haskell.Exts.Parser? -


there function called parse in title module. has type signature

parse :: string -> parseresult ast 

i have been working @ while , can't figure out how use it. i'm sure obvious not seeing it. in advance!

the language.haskell.exts.parser module handles parsing haskell source code appropriate syntax tree. parse general function handle parsing string of haskell source instance of parseable class. exp (a haskell expression), parse defined as:

instance parseable exp     parse = parseexp 

so, use parse function, provide type declaration if 1 cannot inferred. example, parse expression "5 + 5":

parse "5 + 5" :: parseresult exp 

which equivalent to:

parseexp "5 + 5" 

in ghci, both return:

parseok (infixapp (lit (int 5)) (qvarop (unqual (symbol "+"))) (lit (int 5))) 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -