简体   繁体   中英

the application precedence for the infix form for multiple expressions

Say I have this expression:

instance FromRow MyData where
  fromRow =  MyData <$> field <*> field <*> field 

I can't undertand the application precedence because everything is written in the infix form. Can you help me? Is this correct?

fromRow =  MyData (1) <$> (2) field  (3) <*>  (4) field  (5) <*>  (6) field 

Both <$> and <*> are left-associative, so your numbering is correct. You could also write it using parentheses like this:

(((MyData <$> field) <*> field) <*> field)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM