purescript-deprecated/purescript-generics

"shortcut" for toSpine -> fromSpine roundtrip?

Opened this issue · 1 comments

gbaz commented

If we had something like Typeable and a type-safe cast, we could have branch on a subtree given not by just a function Unit -> GenericSpine but also paired with Unit -> Any where for that a : Any and that g : GenericSpine we would have the property that fromSpine g === cast a.

So this way if you want to descend a bit, then do a special case on the data from which some subtree was generated, we could capture that in a single recursion pattern without the overhead of a full to/from roundtrip.

👍 Sounds good to me, but did you have any examples in mind?