music-score-1.7.1: Musical score and part representation.

Portabilitynon-portable (TF,GNTD)
Stabilityexperimental
Maintainerhans@hanshoglund.se
Safe HaskellNone

Music.Time.Reverse

Contents

Description

Provides reversible values.

Synopsis

Documentation

The Reversible class

class Transformable a => Reversible a whereSource

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 s `transform` a = rev (s `transform` a)

or equivalently,

 transform . rev = fmap rev . transform

For Span

 rev = over range swap

Methods

rev :: a -> aSource

Reverse (retrograde) the given value.

Reversed values

reversed :: Reversible a => Iso' a aSource

View the reverse of a value.

>>> [1,2,3] & reversed %~ sort
> [3,2,1]

revDefault :: (HasPosition a, Transformable a) => a -> aSource

A default implementation of rev

Utility

newtype NoReverse a Source

Constructors

NoReverse 

Fields

getNoReverse :: a
 

Instances

Typeable1 NoReverse 
Eq a => Eq (NoReverse a) 
Ord a => Ord (NoReverse a) 
Show a => Show (NoReverse a) 
Transformable (NoReverse a) 
Reversible (NoReverse a)