[Haskell-cafe] Managing a sum type with a lot of constructors

Adam Flott adam at adamflott.com
Thu Aug 24 01:29:35 UTC 2017


I have a sum type with a lot of constructors and I'm not sure how to represent
the type with maintainability in mind. For example,

    data A = A1
           | A2 Int
           | A3 Text Int32 Bool
           | ...
           | A100 Bool

Every inner type is concrete. There are 100+ constructors with no sign of ever
getting reduced.

What technique would you recommend to keep the sum type approach but not having
to define them all in one spot? I'm thinking 1 inner type + 1 function to
construct per file (if that's possible).


More information about the Haskell-Cafe mailing list