úÎL(H/      !"#$%&'()*+,-.D Encapsulates a data type a at a focus b, supporting various   operations /0123456 /The root of the exception hierarchy for Zipper  operations: 789: a simple type synonym for a  $ where the type at the focus is the L same as the type of the outer (unzippered) type. Cleans up type signatures  for simple recursive types: BMotion types which alter a Zipper by a knowable integer quantity. ' Concretly, the following should hold:  ' level (move m z) == level z + delta m 3For motions upwards this returns a negative value. ;<=>?@AA % type describing an incremental path "down" through a data  structure. Use  & to move to a location specified by a fclabels lens. Use )> to return to a previously-visited location in a zipper, with  previous history intact, so:  7 (\(l,ma)-> move l <$> ma) (closeSaving z) == Just z Use (< to turn this into a standard fclabels lens, flattening the  incremental move steps. Throws errors of type : BC indicates a 7 upwards in the zipper until we arrive at a type which  we can cast to b, otherwise throwing  a  upwards in the data type. e.g.  move (Up 2) would move up to J the grandparent level, as long as the type of the focus after moving is  bE. Inline type signatures are often helpful to avoid ambiguity, e.g.  (Up 2 :: Up Char (Tree Char)) read as "up two levels, from a focus of  type Char to  Tree Char". This  type throws  #Types of the Motion class describe "paths" up or down (so to speak) L through a datatype. The exceptions thrown by each motion are enumerated in  the associated type  ThrownBy mot. The Motion type that will return the * focus to the last location after doing a 'moveSaving is given by  Returning mot. GMove to a new location in the zipper, either returning the new zipper,  or throwing err in some Failure class type (from the failure pkg.) "The return type can be treated as Maybe for simple exception handling $ or one can even use something like control-monad-exception to get % powerful typed, checked exceptions. like  but saves the Motion" that will return us back to the 0 location we started from in the passed zipper. D use a fclabels label to define a Motion "down" into a data type. !IApply the given Motion to a zipper until the Motion fails, returning the % last location visited. For instance moveFloor (to left) z might return  the left-most node of a $ed tree z. 2 moveFloor m z = maybe z (moveFloor m) $ move m z "KApply a motion each time the focus matches the predicate, raising an error  in m otherwise #HApply a motion zero or more times until the focus matches the predicate # moveUntil p = moveWhile (not . p) $1create a zipper with the focus on the top level. E%BClose the zipper, returning the saved path back down to the zipper's  focus. See & &>re-assembles the data structure from the top level, returning Nothing if ' the structure cannot be re-assembled. Note$: For standard lenses produced with  this will never fail. & However setters defined by hand with F" can be used to enforce arbitrary 3 constraints on a data structure, e.g. that a type Odd Int can only hold an % odd integer. This function returns Nothing in such cases, which  corresponds to the LensSetterFailed constructor of  'Return a path  the current location in the  . ; This lets you return to a location in your data type with ).  save = fst . closeSaving (IExtract a composed lens that points to the location we saved. This lets ; us modify, set or get a location that we visited with our   , after  closing the Zipper, using fclabels get and set. )#Enter a zipper using the specified . ISaving and restoring lets us for example: find some location within our  structure using a  , save the location, G over the entire structure, 6 and then return to where we were safely, even if the "shape" of our  structure has changed.  restore s = move s . zipper *returns H if  , is at the top level of the data structure: +%Return our zero-indexed depth in the  .  if * zipper then + zipper == 0 ,a view function for a Zipper's .  viewf = get focus -modify the Zipper's .  modf = modify focus .set the Zipper's .  setf = set focus IJKLMNO/  !"#$%&'()*+,-./ $& "#!,.-*+ '%)( &   !"#$%&'()*+,-.P    !"#$%&'()*+,-./0123456789:;<=>??@ABCDEFGHIJKLMNOPQRSTUVWXYZ pez-0.1.0Data.Label.ZipperbaseData.Typeable.InternalTypeable GHC.Exception fromException toException ExceptiontypeOf failure-0.2.0Control.FailurefailureFailurefclabels-1.1.0.2Data.Label.DerivemkLabelsData.Label.Maybe:~>ZipperZipperExceptionZipper1 LevelDeltadeltaToErrorsLensGetterFailedTo UpCastingUpErrors MovePastTopLensSetterFailed CastFailedUpupLevelMotionThrownBy Returningmove moveSavingfocusto moveFloor moveWhile moveUntilzipper closeSavingclosesaveflattenrestoreatToplevelviewfmodfsetfZstack_focus ZipperStackHistPairHhLenshContIntBgetInt ZipperLensesZLzlStackzLenses TypeableLensTLtLensS savedLenseslStack saveFromAboveData.Label.PurelensGHC.Basefmapghc-prim GHC.TypesTruepivot compStackgetReverseLensStackrevLocalplusB lengthThrist maybeThrow