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

Copyright(c) Hans Hoglund 2012-2014
LicenseBSD-style
Maintainerhans@hanshoglund.se
Stabilityexperimental
Portabilitynon-portable (TF,GNTD)
Safe HaskellNone
LanguageHaskell2010

Music.Time.Reverse

Contents

Description

Provides reversible values.

Synopsis

Documentation

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

or equivalently,

transform . rev = fmap rev . transform

For Span

rev = over onsetAndOffset swap

Methods

rev :: a -> a Source

Reverse (retrograde) the given value.

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

Utility

newtype NoReverse a Source

Constructors

NoReverse 

Fields

getNoReverse :: a
 

Instances