<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">On 10 juli 2016 at 20:03:57, martin (<a href="mailto:martin.drautzburg@web.de">martin.drautzburg@web.de</a>) wrote:</div> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>Am 07/10/2016 um 03:17 PM schrieb Martijn Schrage:
<br>> Hi Martin,
<br>>  
<br>> Ghci defaults the type of 'getHole t1' to 'Maybe ()'. You can see this happening if you enable warnings in ghci with
<br>> ':set -Wall'. Providing the correct type signature gives you the answer you're expecting:
<br>>  
<br>> *Main> getHole t1 :: Maybe [Int]
<br>> Just [1,2,3]
<br>
<br>I understand, thanks.
<br>
<br>I tried a generic Zipper with a pair and noticed that going down gives me the second component. This does make some
<br>sense, but I am still having trouble to anticipate what up, down, left and right do when the the datatype is more
<br>complicated and not a tree. E.g. this one gives me trouble:
<br>
<br>import qualified Data.Sequence as S
<br>
<br></div></div></span></blockquote><div><br></div><div><div>To understand the navigation, just draw your values as trees, with the constructor on one level and the children below. For example, a list [1,2] becomes:</div><div><br></div><div><font face="Courier New">  (:)</font></div><div><font face="Courier New"> /   \</font></div><div><font face="Courier New">1    (:)</font></div><div><font face="Courier New">    /   \</font></div><div><font face="Courier New">   2     []</font></div><div>    </div><div>And a tuple (1,2) becomes:</div><div>    </div><div><font face="Courier New">    (,)</font></div><div><font face="Courier New">   /   \</font></div><div><font face="Courier New">  1     2 </font></div><div>  </div><div>Also note that down not only moves a level downward, but also to the rightmost child (down' moves to the leftmost child instead).</div><div><br></div><div>I'm not sure how useful it is to use a zipper on a Seq (which, as you can see in the source, is still just a tree, like all data types,) as the implementation uses a balanced FingerTree which is kept abstract. But as it turns out, the Seq Data instance follows the right-associative view pattern, so if you wish you could navigate similar to lists (down for the tail, and down' or down followed by left for the head).</div><div><br></div><div>Cheers,</div><div>Martijn</div></div><div><br></div><br><blockquote type="cite" class="clean_bq"><span><div><div>data Items lbl = Items (S.Seq (lbl, Items lbl))
<br>                 deriving (Eq, Show, Typeable, Data)
<br>
<br>
<br>Is there an easy way to understinfing those moves?
<br>
<br>
<br>
<br></div></div></span></blockquote></body></html>