Can I use a list of Traversal? The following code:
f::[Int] -> [[Int]]
f l = [l & i .~ 1 | i<-[ix 0], (l^? i) == Just 0]
produces an error:
• Couldn't match type ‘Const (Data.Monoid.First Int) [Int]’
with ‘Identity [Int]’
Expected type: ASetter [Int] [Int] Int Integer
Actual type: Getting (Data.Monoid.First Int) [Int] Int
• In the first argument of ‘(.~)’, namely ‘i’
In the second argument of ‘(&)’, namely ‘i .~ 1’
In the expression: l & i .~ 1
Looking at this question I think I need somehow to explicitly give a type to i, but every my attempt fails.