Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
meta
lets you apply a pattern whose elements are pattern transformations likefast 2
.replace
makes it easier to usemeta
, and probably has other uses; it lets you turn a pattern of easy-to-write symbols (integers are what I usually use) into a pattern of anything else, by providing a lookup table.+meta :: forall a b.
+replace :: forall a b. Ord a =>
Here's a minimal example using both.
This plays the pattern "ho*8"
at normal speed for the first half,
and at double speed for the second half.
let slang = [ (0, id)
, (1, fast 2) ]
in p 1 $ meta (replace slang "0 1") "ho*8"