functor-combo 0.0.5 → 0.0.6
raw patch · 3 files changed
+18/−18 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- FunctorCombo.ZipperFix: type Location f = (Context f, Fix f)
- FunctorCombo.ZipperReg: type Location t = (Context t, t)
+ FunctorCombo.ZipperFix: type Zipper f = (Context f, Fix f)
+ FunctorCombo.ZipperReg: type Zipper t = (Context t, t)
- FunctorCombo.ZipperFix: down :: (Holey f) => Location f -> f (Location f)
+ FunctorCombo.ZipperFix: down :: (Holey f) => Zipper f -> f (Zipper f)
- FunctorCombo.ZipperFix: up :: (Holey f) => Location f -> Location f
+ FunctorCombo.ZipperFix: up :: (Holey f) => Zipper f -> Zipper f
- FunctorCombo.ZipperFix: up' :: (Holey f) => Location f -> Maybe (Location f)
+ FunctorCombo.ZipperFix: up' :: (Holey f) => Zipper f -> Maybe (Zipper f)
- FunctorCombo.ZipperReg: down :: (Regular t, Holey (PF t)) => Location t -> PF t (Location t)
+ FunctorCombo.ZipperReg: down :: (Regular t, Holey (PF t)) => Zipper t -> PF t (Zipper t)
- FunctorCombo.ZipperReg: up :: (Regular t, Holey (PF t)) => Location t -> Location t
+ FunctorCombo.ZipperReg: up :: (Regular t, Holey (PF t)) => Zipper t -> Zipper t
- FunctorCombo.ZipperReg: up' :: (Regular t, Holey (PF t)) => Location t -> Maybe (Location t)
+ FunctorCombo.ZipperReg: up' :: (Regular t, Holey (PF t)) => Zipper t -> Maybe (Zipper t)
Files
- functor-combo.cabal +1/−1
- src/FunctorCombo/ZipperFix.hs +10/−10
- src/FunctorCombo/ZipperReg.hs +7/−7
functor-combo.cabal view
@@ -1,5 +1,5 @@ Name: functor-combo-Version: 0.0.5+Version: 0.0.6 Cabal-Version: >= 1.2 Synopsis: Functor combinators with tries & zippers Category: Data
src/FunctorCombo/ZipperFix.hs view
@@ -12,7 +12,7 @@ -- Zippers for functor fixpoints ---------------------------------------------------------------------- -module FunctorCombo.ZipperFix (Context,Location, up,up',down) where+module FunctorCombo.ZipperFix (Context,Zipper, up,up',down) where import Control.Arrow (first) @@ -51,24 +51,24 @@ -- Instead, --- | Location in a functor tree -- a zipper-type Location f = (Context f, Fix f)+-- | Zipper for a functor tree. Also called \"location\"+type Zipper f = (Context f, Fix f) --- TODO: can I relate Context to Der (Fix f) and use Loc for Location?+-- TODO: can I relate Context to Der (Fix f) and use Loc for Zipper? -- | Move upward. Error if empty context.-up :: Holey f => Location f -> Location f+up :: Holey f => Zipper f -> Zipper f up ([] , _) = error "up: given empty context" up (d:ds', t) = (ds', Fix (fill (d,t))) -- | Variant of 'up'. 'Nothing' if empty context.-up' :: Holey f => Location f -> Maybe (Location f)+up' :: Holey f => Zipper f -> Maybe (Zipper f) up' ([] , _) = Nothing up' l = Just (up l) {- -(d:ds', t) :: Location f+(d:ds', t) :: Zipper f (d:ds', t) :: (Context f, Fix f) d:ds' :: [Der f (Fix f)]@@ -86,7 +86,7 @@ -} -down :: Holey f => Location f -> f (Location f)+down :: Holey f => Zipper f -> f (Zipper f) down (ds', t) = fmap (first (:ds')) (extract (unFix t)) -- down (ds', t) = fmap (\ (d,t') -> (d:ds',t')) (extract (unFix t))@@ -94,7 +94,7 @@ {--(ds',t) :: Location f+(ds',t) :: Zipper f (ds',t) :: (Context f, Fix f) (ds',t) :: ([Der f (Fix f)], Fix f) @@ -107,5 +107,5 @@ fmap (\ (d,t') -> (d:ds',t')) (extract (unFix t)) :: ([Der f (Fix f)], Fix f) :: (Context f, Fix f)- :: Location f+ :: Zipper f -}
src/FunctorCombo/ZipperReg.hs view
@@ -14,7 +14,7 @@ module FunctorCombo.ZipperReg (- Context,Location, up, up', down+ Context,Zipper, up, up', down ) where @@ -31,7 +31,7 @@ -- -- type Context t = [Der (PF t) t] -- --- type Location t = (Context t, t)+-- type Zipper t = (Context t, t) -- -- Then use with some standard recursive data types like lists & trees. @@ -44,20 +44,20 @@ -- | Context for a regular type type Context t = [Der (PF t) t] --- | Location for a regular type -- a zipper-type Location t = (Context t, t)+-- | Zipper for a regular type. Also called \"location\"+type Zipper t = (Context t, t) -- | Move upward. Error if empty context.-up :: (Regular t, Holey (PF t)) => Location t -> Location t+up :: (Regular t, Holey (PF t)) => Zipper t -> Zipper t up ([] , _) = error "up: given empty context" up (d:ds', t) = (ds', wrap (fill (d,t))) -- | Variant of 'up'. 'Nothing' if empty context.-up' :: (Regular t, Holey (PF t)) => Location t -> Maybe (Location t)+up' :: (Regular t, Holey (PF t)) => Zipper t -> Maybe (Zipper t) up' ([] , _) = Nothing up' l = Just (up l) -down :: (Regular t, Holey (PF t)) => Location t -> PF t (Location t)+down :: (Regular t, Holey (PF t)) => Zipper t -> PF t (Zipper t) down (ds', t) = fmap (first (:ds')) (extract (unwrap t)) {-