Drasil
Drasil copied to clipboard
Investigation of Lists containing Empty Lists in areas where they should not be present
While solving #3429 and creating the empty sections, I noticed that we have many areas where there is a list containing empty lists, which does cause issues when compiling because the code comprehends a list containing empty lists differently than an empty list.
This may potentially cause further issues in other aspects as well and I believe that it should be inspected to prevent any breakages and issues that may be caused due to this. I noticed this issue mainly in the FunctionalRequirements
and the Assumptions
sections first.
An empty list is different than a list containing the empty list, so they should be processed differently.
The real problem is the abuse of lists as good-for-all data-structures. Part of the solution involves creating newtype
s that wrap lists. That way one can't just blithely use map
(or other similar functions) but have to be forced to think about what the right way to process the object actually being represented instead of its current encoding.
I agree. We need to most definitely look at where the abuse of lists takes place within the code so that it can be fixed to prevent further issues. Could you however please elaborate on the following line because I am not sure if I fully understand what you mean by it?
Part of the solution involves creating
newtype
s that wrap lists.
In Haskell,
newtype Foo a = Foo [a]
creates a type Foo
that is essentially a list (it will be stored exactly as a list) but is also treated as a "new" type (hence the name).