[Haskell-cafe] Not too extensible records?
Ignat Insarov
kindaro at gmail.com
Sat Feb 27 14:59:15 UTC 2021
Thank you for your kind suggestions, Olaf and Henning.
I am looking into an extensible record based solution for the sake of
extensibility and convenience. I could certainly manage everything
with a bunch of tuples, but that would require writing a huge number
of `HasThis` and `HasThat` instances and even then would not provide
the flexibility I should like.
For example, suppose I have two functions: one is a layout algorithm
that assigns to nodes some spatial positions, and the second is a
topological algorithm that discerns roots and leaves. These two
functions are conceptually independent and may be applied in any
order, but it seems to me that as many as 5 types would be needed to
handle this situation: `label`, `(label, V2 Double)`, `(label,
Topology)`, `((label, V2 Double), Topology)` and `((label, Topology),
V2 Double)`. And what if there is another quality independent of these
two? The number of permutations goes through the roof.
So, it seems to me that some smart technology is needed to make this manageable.
More information about the Haskell-Cafe
mailing list