How to nest a product type Records<F> where F is a higher-kinded type so that using 2 selectors for type A, B on type Records<Records<Reader>> returns Reader<A, B> #1460
-
Hi, I'm have been taking a stab at FP; recently I have used the pattern below, inspired by the Visitor pattern, to constraint generic type parameters to a fixed set by requiring a selector that can pull a property from the given record type:
Usage example:
I have been wondering how to nest |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Nevermind, I solved it. The compiler enforce that all combinations be provided:
|
Beta Was this translation helpful? Give feedback.
-
I see you answered your own question, but I'm not entirely sure what the problem is that you're trying to solve? I see you're using Monad-transformers are covered in my Higher Kinds series. I may be way off, but I thought I'd mention it just in case. |
Beta Was this translation helpful? Give feedback.
Nevermind, I solved it. The compiler enforce that all combinations be provided: