With 0.4 and current HEAD:
ghci> :t castOptic @A_Setter @A_Setter (traversed % _1)
<interactive>:1:42: error:
• A_Traversal cannot be composed with A_Lens
• In the third argument of ‘castOptic’, namely ‘(traversed % _1)’
In the expression: castOptic @A_Setter @A_Setter (traversed % _1)
Oops! I think what is going on here is that we get a constraint JoinKinds A_Traversal A_Lens A_Setter which of course does not match the instance JoinKinds A_Traversal A_Lens A_Traversal, so the catch-all error instance fires. Ideally we would have two different errors, one for "this composition doesn't make sense" and another for "this composition makes sense, but produces an optic of a different kind to that expected by the context".
With 0.4 and current HEAD:
Oops! I think what is going on here is that we get a constraint
JoinKinds A_Traversal A_Lens A_Setterwhich of course does not match the instanceJoinKinds A_Traversal A_Lens A_Traversal, so the catch-all error instance fires. Ideally we would have two different errors, one for "this composition doesn't make sense" and another for "this composition makes sense, but produces an optic of a different kind to that expected by the context".