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
(_duration
x) = _duration (rev
x)
rev
stransform
a =rev
(stransform
a)
or equivalently,
transform
.rev
=fmap
rev
.transform
For Span
rev
=over
range
swap
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