How to translate logical notation to Haskell syntax

后端 未结 4 1011
天命终不由人
天命终不由人 2021-01-25 13:22

I\'ve recently picked up Haskell at uni and I\'m working my way through a set of exercises, here\'s a snippet of one that I can\'t make sense of:

\"Consider the followin

4条回答
  •  自闭症患者
    2021-01-25 14:09

    Don't confuse a string in the grammar for the AST that represents it. Compare the string

    "+ + 3 4 5"
    

    which is a string in the grammar you've been given with

    Plus (Plus (Literal 3) (Literal 4)) (Literal 5)
    

    which would be a sensible Haskell value for the AST that String could get parsed to.

提交回复
热议问题