We need reified lenses because Haskell's type system is predicative. I don't know the technical details of exactly what that means, but it prohibits types like
[Lens s t a b]
For some purposes, it's acceptable to use
Functor f => [(a -> f b) -> s -> f t]
instead, but when you reach into that, you don't get a Lens
; you get a LensLike
specialized to some functor or another. The ReifiedBlah
newtypes let you hang on to the full polymorphism.
Operationally, [ReifiedLens s t a b]
is a list of functions each of which takes a Functor f
dictionary, while forall f . Functor f => [LensLike f s t a b]
is a function that takes a Functor f
dictionary and returns a list.
As for what "reify" means, well, the dictionary will say something, and that seems to translate into a rather stunning variety of specific meanings in Haskell. So no comment on that.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…