“Pattern matching” of algebraic type data constructors

后端 未结 5 1780
天涯浪人
天涯浪人 2021-02-07 15:07

Let\'s consider a data type with many constructors:

data T = Alpha Int | Beta Int | Gamma Int Int | Delta Int

I want to write a function to che

5条回答
  •  醉酒成梦
    2021-02-07 15:56

    In some cases, "Scrap Your Boilerplate" library will help.

    http://www.haskell.org/haskellwiki/Scrap_your_boilerplate

提交回复
热议问题