Parsing and the use of GADTs

后端 未结 2 1279
心在旅途
心在旅途 2021-01-06 11:03

I\'ve ran into a problem while writing a parser. Specifically, I want to be return values of different types. For example, I have two different data types FA an

2条回答
  •  时光说笑
    2021-01-06 11:55

    What exactly do you want?

    If you know at compile time whether you want an FA or a PA, then GADTs are a good way to do that.

    If you want to decide at run-time to parse either an FA or a PA, you could use... Either FA PA.

提交回复
热议问题