Copyright | (c) Hans Hoglund 2012-2014 |
---|---|
License | BSD-style |
Maintainer | hans@hanshoglund.se |
Stability | experimental |
Portability | non-portable (TF,GNTD) |
Safe Haskell | None |
Language | Haskell2010 |
Provides reversible values.
- module Music.Time.Position
- class Transformable a => Reversible a where
- rev :: a -> a
- reversed :: Reversible a => Iso' a a
- revDefault :: (HasPosition a, Transformable a) => a -> a
- newtype NoReverse a = NoReverse {
- getNoReverse :: a
Documentation
module Music.Time.Position
The Reversible class
class Transformable a => Reversible a where Source
Class of values that can be reversed (retrograded).
For positioned values succh as Note
, the value is reversed relative to its middle point, i.e.
the onset value becomes the offset value and vice versa.
For non-positioned values such as Stretched
, the value is reversed in-place.
FIXME Second law is incompatible with revDefault
(and the Span
definition below)
Law
rev
(rev
a) = a
abs
(x^.duration
) = (rev
x)^.duration
rev
stransform
a =rev
(stransform
a)
or equivalently,
transform
.rev
=fmap
rev
.transform
For Span
rev
=over
onsetAndOffset
swap
Reversible Char | |
Reversible Double | |
Reversible Int | |
Reversible Integer | |
Reversible () | |
Reversible Span | |
Reversible Duration | |
Reversible Meta | |
Reversible Attribute | |
Reversible a => Reversible [a] | |
Reversible a => Reversible (Maybe a) | |
Reversible a => Reversible (Seq a) | |
Reversible (NoReverse a) | |
Reversible a => Reversible (Voice a) | |
Reversible a => Reversible (AddMeta a) | |
Reversible (Behavior a) | |
Reversible (Reactive a) | |
Reversible a => Reversible (TieT a) | |
Reversible a => Reversible (SlideT a) | |
Reversible a => Reversible (TextT a) | |
Reversible a => Reversible (HarmonicT a) | |
Reversible a => Reversible (TremoloT a) | |
Reversible a => Reversible (ColorT a) | |
Reversible a => Reversible (b, a) | |
(Ord k, Reversible a) => Reversible (Map k a) | |
(Monoid b, Reversible a) => Reversible (Couple b a) | |
Reversible a => Reversible (PartT p a) | |
Reversible a => Reversible (DynamicT p a) | |
Reversible a => Reversible (ArticulationT p a) |
Reversing
reversed :: Reversible a => Iso' a a Source
View the reverse of a value.
>>>
[1,2,3] & reversed %~ Data.List.sort
[3,2,1]
revDefault :: (HasPosition a, Transformable a) => a -> a Source
A default implementation of rev