<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Generics.Uniplate.Zipper</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Data-Generics-Uniplate-Zipper.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Generics-Uniplate-Zipper.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">uniplate-1.6: Help writing simple, concise and fast generic operations.</p></div><div id="content"><div id="module-header"><p class="caption">Data.Generics.Uniplate.Zipper</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Create a zipper and get back the value </a></li><li><a href="#g:2">Navigate within a zipper </a></li><li><a href="#g:3">Manipulate the zipper hole </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A zipper is a structure for walking a value and manipulating it in constant time. </p><p>This module was inspired by the paper: <em>Michael D. Adams. Scrap Your Zippers: A Generic Zipper for Heterogeneous Types, Workshop on Generic Programming 2010</em>. </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Zipper">Zipper</a> from to</li><li class="src short"><a href="#v:zipper">zipper</a> :: <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to => to -> <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> to to</li><li class="src short"><a href="#v:zipperBi">zipperBi</a> :: <a href="Data-Generics-Uniplate-Operations.html#t:Biplate">Biplate</a> from to => from -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)</li><li class="src short"><a href="#v:fromZipper">fromZipper</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> from</li><li class="src short"><a href="#v:left">left</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)</li><li class="src short"><a href="#v:right">right</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)</li><li class="src short"><a href="#v:up">up</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)</li><li class="src short"><a href="#v:down">down</a> :: <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to => <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)</li><li class="src short"><a href="#v:hole">hole</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> to</li><li class="src short"><a href="#v:replaceHole">replaceHole</a> :: to -> <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to</li></ul></div><div id="interface"><h1 id="g:1">Create a zipper and get back the value </h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Zipper" class="def">Zipper</a> from to <a href="src/Data-Generics-Uniplate-Zipper.html#Zipper" class="link">Source</a></p><div class="doc"><p>Zipper structure, whose root type is the first type argument, and whose focus type is the second type argument. </p></div><div class="subs instances"><p id="control.i:Zipper" class="caption collapser" onclick="toggleSection('i:Zipper')">Instances</p><div id="section.i:Zipper" class="show"><table><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Eq.html#t:Eq">Eq</a> from, <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Eq.html#t:Eq">Eq</a> to) => <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Eq.html#t:Eq">Eq</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:zipper" class="def">zipper</a> :: <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to => to -> <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> to to<a href="src/Data-Generics-Uniplate-Zipper.html#zipper" class="link">Source</a></p><div class="doc"><p>Create a zipper, focused on the top-left value. </p></div></div><div class="top"><p class="src"><a name="v:zipperBi" class="def">zipperBi</a> :: <a href="Data-Generics-Uniplate-Operations.html#t:Biplate">Biplate</a> from to => from -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)<a href="src/Data-Generics-Uniplate-Zipper.html#zipperBi" class="link">Source</a></p><div class="doc"><p>Create a zipper with a different focus type from the outer type. Will return <code>Nothing</code> if there are no instances of the focus type within the original value. </p></div></div><div class="top"><p class="src"><a name="v:fromZipper" class="def">fromZipper</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> from<a href="src/Data-Generics-Uniplate-Zipper.html#fromZipper" class="link">Source</a></p><div class="doc"><p>From a zipper take the whole structure, including any modifications. </p></div></div><h1 id="g:2">Navigate within a zipper </h1><div class="top"><p class="src"><a name="v:left" class="def">left</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)<a href="src/Data-Generics-Uniplate-Zipper.html#left" class="link">Source</a></p><div class="doc"><p>Move one step left from the current position. </p></div></div><div class="top"><p class="src"><a name="v:right" class="def">right</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)<a href="src/Data-Generics-Uniplate-Zipper.html#right" class="link">Source</a></p><div class="doc"><p>Move one step right from the current position. </p></div></div><div class="top"><p class="src"><a name="v:up" class="def">up</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)<a href="src/Data-Generics-Uniplate-Zipper.html#up" class="link">Source</a></p><div class="doc"><p>Move one step up from the current position. </p></div></div><div class="top"><p class="src"><a name="v:down" class="def">down</a> :: <a href="Data-Generics-Uniplate-Operations.html#t:Uniplate">Uniplate</a> to => <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (<a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to)<a href="src/Data-Generics-Uniplate-Zipper.html#down" class="link">Source</a></p><div class="doc"><p>Move one step down from the current position. </p></div></div><h1 id="g:3">Manipulate the zipper hole </h1><div class="top"><p class="src"><a name="v:hole" class="def">hole</a> :: <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> to<a href="src/Data-Generics-Uniplate-Zipper.html#hole" class="link">Source</a></p><div class="doc"><p>Retrieve the current focus of the zipper.. </p></div></div><div class="top"><p class="src"><a name="v:replaceHole" class="def">replaceHole</a> :: to -> <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to -> <a href="Data-Generics-Uniplate-Zipper.html#t:Zipper">Zipper</a> from to<a href="src/Data-Generics-Uniplate-Zipper.html#replaceHole" class="link">Source</a></p><div class="doc"><p>Replace the value currently at the focus of the zipper. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>