zipper 0.4.2 → 0.4.3
raw patch · 2 files changed
+10/−3 lines, 2 files
Files
- src/Generics/MultiRec/Zipper.hs +8/−1
- zipper.cabal +2/−2
src/Generics/MultiRec/Zipper.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE UndecidableInstances #-} ----------------------------------------------------------------------------- -- |@@ -34,7 +35,7 @@ enter, down, down', up, right, left, dfnext, dfprev,- leave, on, update, foldZipper+ leave, on, update, updateF, foldZipper ) where import Prelude hiding (last)@@ -303,6 +304,12 @@ -- | Update the current focus without changing its type. update :: (forall xi. phi xi -> xi -> xi) -> Loc phi I0 ix -> Loc phi I0 ix update f (Loc p (I0 x) s) = Loc p (I0 $ f p x) s++-- | Update the current focus, embedded in a functor.+updateF :: (Functor f)+ => (forall xi. phi xi -> xi -> f xi)+ -> Loc phi I0 ix -> f (Loc phi I0 ix)+updateF f (Loc p (I0 x) s) = (\y -> Loc p (I0 y) s) <$> f p x -- | Most general eliminator. Both 'on' and 'update' can be defined -- in terms of 'foldZipper'.
zipper.cabal view
@@ -1,5 +1,5 @@ name: zipper-version: 0.4.2+version: 0.4.3 license: BSD3 license-file: LICENSE author: Alexey Rodriguez,@@ -26,7 +26,7 @@ stability: experimental build-type: Simple cabal-version: >= 1.6-tested-with: GHC == 7.0.4+tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1 extra-source-files: examples/AST.hs examples/ASTUse.hs examples/ASTZipper.hs