Maintainer | Ralf Laemmel, Joost Visser |
---|---|
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
This module is part of StrategyLib
, a library of functional strategy
combinators, including combinators for generic traversal. This module
defines a number combinators for keyhole operations, i.e. for operations
that have ordinary parametric or adhoc polymorhpic types, but employ
strategies inside.
- selectFocus :: (Term f, Term t) => (f -> Maybe f) -> t -> Maybe f
- replaceFocus :: (Term t, Term t') => (t -> Maybe t) -> t' -> Maybe t'
- deleteFocus :: (Term f, Term [f], Term t) => (f -> Maybe f) -> t -> Maybe t
- selectHost :: (Term f, Term h, Term t) => (f -> Maybe f) -> (h -> Maybe h) -> t -> Maybe h
- markHost :: (Term f, Term h, Term t) => (f -> Bool) -> (h -> h) -> t -> Maybe t
- listify :: (Term x, Term y) => x -> [y]
- strings :: Term x => x -> [String]
- inj :: (MonadPlus m, Term x, Term c) => (c -> m c) -> x -> m x
Focus
Select the identified focus. Fails if no subterm can be selected.
replaceFocus :: (Term t, Term t') => (t -> Maybe t) -> t' -> Maybe t' Source #
Replace the identified focus. Fails if no subterm can be replaced.
:: (Term f, Term [f], Term t) | |
=> (f -> Maybe f) | Identify focus |
-> t | Input term |
-> Maybe t | Output term without focused entity |
Delete the focus assuming it is an element in a list. Fails if no deletion can be performed.
:: (Term f, Term h, Term t) | |
=> (f -> Maybe f) | Get focus |
-> (h -> Maybe h) | Get host |
-> t | Input term |
-> Maybe h | Located host |
Find the host of the focused entity, i.e. a superterm of the focussed subterm.