
5 Sep
2023
5 Sep
'23
11:09 a.m.
On Tue, 5 Sep 2023, Zoran BoĆĄnjak wrote:
Dear haskellers, I am trying to add some type safety to the program in the following situation:
There are some distinct 'Item t' types which come in groups. That is: 'EList' container can contain either:
- items 0,1 - items 0,1,2,3 - items 0,1,2,3,4,5,6
What about a solution in Haskell 98: (T0, T1, Maybe (T2, T3, Maybe (T4, T5, T6))) or with custom data types: data ItemsA = ItemsA T0 T1 (Maybe ItemsB) data ItemsB = ItemsB T2 T3 (Maybe ItemsC) data ItemsC = ItemsC T4 T5 T6 ?