jwiegley / hierarchy

BSD 3-Clause "New" or "Revised" License
8 stars 2 forks source link

prune (not) equivalent to ignore >> norecurse? #3

Open twhitehead opened 8 years ago

twhitehead commented 8 years ago

The document says that prune is equivalent to ignore >> norecurse, but I don't see how this can be.

In more detail: the (expanded) definitions of ignore, norecurse, and prune are

ignore = mzero
ignore = CondT $ return recurse'
ignore = CondT $ return (Nothing, Continue)

norecurse = CondT $ return (Just (), Stop)

prune = CondT $ return (Nothing, Stop)

which, from the relevant branch in the definition of >>=,

CondT m >>= k = CondT $ m >>= \case
  -- ...
  (Nothing, Continue)  -> return (Nothing, Continue)
  -- ...

would seem to me to imply ignore >> norecurse is equivalent to ignore.

jwiegley commented 8 years ago

Quite right! That comment must have been from an older iteration. I'll delete that note.