I played with upgrading Reflex to DMap 0.2 and ran into the problem of translating one of the built-in functors.
In particular, he previously used GADT to encode relationships a -> [WeakSubscriber a], for example:
data FanSubscriberKey k a where
FanSubscriberKey :: k a -> FanSubscriberKey k [WeakSubscriber a]
However, in the latest version of DMap, you can simply insert the functor directly. I originally raised []from the above, but realized that since I had a functor functor, I had a functor and I wanted to delete all the data together. Unfortunately, I cannot find a way to describe the above mapping without using newtype. newtype WeakSubscriberList a = WeakSubscriberList [WeakSubscriber a]solves the problem, but requires a new type of wrapping and deployment.
Previous studies indicate that this is considered a lambda at the type level, which is usually forbidden, but the conversion here seemed simple enough that it was possible, especially since I do not want to define an instance or something like that.
Using DMap 0.1, we can save FanSubscriberKey kand have its value [WeakSubscriber a]in DMap (FanSubscriberKey k), and its key is wrapped in a constructor FanSubscriberKey. In DMap 0.2, if I defined above newtype, I could say in the same way DMap k WeakSubscriberListand get a similar result, having an expanded key, but a value wrapped in WeakSubscriberList. However, what I would like to say is that DMap k [WeakSubscriber], but it obviously will not work, as it []is kind * -> *and WeakSubscriberkind * -> *. If there was a level type .such that it was [] '. WeakSubscribercompiled to do the trick, but it does not exist in the same way. I also tried a type alias, but type WeakSubscriberList a = [WeakSubscriber a]requires that it be aspecified wherever used WeakSubscriberList.