[Haskell-cafe] Conditional lens

2013-10-10 Thread Artyom Kazak
Hello! I am working with TypeReps, and while writing some functions I have noticed that I could use lenses to simplify them; however, I have stumbled upon some difficulties. First I’ll try to clarify which functions I want to write: * a function for converting TypeRep of, say, `Maybe x` to

Re: [Haskell-cafe] Conditional lens

2013-10-10 Thread Edward Kmett
`ifL` isn't a legal lens for several reasons. Lens s t a b generally requires that the types a subsumes b and b subsumes a, and that s subsumes t and t subsumes s. Lens s (Maybe t) (Maybe a) b is a huge red flag. There is an 'illegal prism' provided by lens that is a more principled version of