(&>) is right associative:
// and-combinator that only retains the right hand side result
(&>)    infixr 6 // :: (Parser s r t) (Parser s r` t) -> Parser s r` t
(&>) p1 p2 :== p1 <&> const p2


So when I read this expression:
p =  twoDigits &> twoDigits &> (<!?> twoDigits undef undef) &> (symbol 'Z')

I should rewrite it to this:
p =  ( twoDigits &> ( twoDigits &> ( (<!?> twoDigits undef undef) &> (symbol
'Z') ) ) )

But then I get confused about order of execution...
won't the innermost parenthetical expression execute first and the parse
will attempt to execute this first:
( (<!?> twoDigits undef undef) &> (symbol 'Z') ) 

Which would not be the desired parsing order.

-- 
View this message in context: 
http://www.nabble.com/understanding-a-right-associative-parser-combinator-tp19165664p19165664.html
Sent from the Clean mailing list archive at Nabble.com.

_______________________________________________
clean-list mailing list
[email protected]
http://mailman.science.ru.nl/mailman/listinfo/clean-list

Reply via email to