Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Some comments on your problem:</p> <p><strong>Answer the Question</strong>: There may be a way to do what you want to do. The Lens library is amazingly generic. What there is not is a simple or obvious way to make it happen. I think the it will involve the <a href="http://hackage.haskell.org/packages/archive/lens/3.9.0.2/doc/html/Control-Lens-Traversal.html#v:partsOf" rel="nofollow noreferrer"><code>partsOf</code> combinator</a> but I'm not sure.</p> <p><strong>Comments on Lenses</strong>: The lens library is really cool and can apply to an amazing number of problems. My initial temptation as I am learning the library was to try to fit everything into a Lens access or mutation. What I discovered was that it was better to use the lens library to dig into my complex data structures, but once I had a simple element it was better to use the more traditional functional techniques I already knew rather then stretching the Lens library past it's useful limit.</p> <p><strong>Advice you didn't ask for</strong>: Inserting an element into the middle of a list is a bad idea. Not that it cannot be done but it can end up being an O(n^2) operation. (<a href="https://stackoverflow.com/questions/9611904/haskell-lists-arrays-vectors-sequences/9613203#9613203">See also this StackOverflow answer.</a>)Zip lists or some other <a href="http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf" rel="nofollow noreferrer">functional data structure</a> may be a better idea. As a side benefit, some of these structures could be made instance of the <code>At</code> class allowing for insertion and deletion using the partial lens combinators.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload