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 |
- module Music.Time.Types
- class Transformable a where
- transformed :: (Transformable a, Transformable b) => Span -> Iso a b a b
- whilst :: (Transformable a, Transformable b) => (a -> b) -> Span -> a -> b
- whilstL :: (Functor f, Transformable a, Transformable b) => LensLike f s t a b -> LensLike f (Span, s) (Span, t) a b
- whilstLT :: (Functor f, Transformable a, Transformable b) => LensLike f s t a b -> LensLike f (Time, s) (Time, t) a b
- whilstLD :: (Functor f, Transformable a, Transformable b) => LensLike f s t a b -> LensLike f (Duration, s) (Duration, t) a b
- onSpan :: (Transformable s, Transformable t, Functor f) => LensLike f s t a b -> Span -> LensLike f s t a b
- delaying :: Duration -> Span
- undelaying :: Duration -> Span
- stretching :: Duration -> Span
- compressing :: Duration -> Span
- delay :: Transformable a => Duration -> a -> a
- undelay :: Transformable a => Duration -> a -> a
- stretch :: Transformable a => Duration -> a -> a
- compress :: Transformable a => Duration -> a -> a
Documentation
module Music.Time.Types
The Transformable class
class Transformable a where Source
Class of values that can be transformed (i.e. scaled and moved) in time.
transformed :: (Transformable a, Transformable b) => Span -> Iso a b a b Source
View the given value in the context of the given transformation.
Apply under a transformation
whilst :: (Transformable a, Transformable b) => (a -> b) -> Span -> a -> b Source
Apply a function under transformation.
>>>
stretch 2 `whilst` delaying 2 $ (1 <-> 2)
4 <-> 6
whilstL :: (Functor f, Transformable a, Transformable b) => LensLike f s t a b -> LensLike f (Span, s) (Span, t) a b Source
whilstLT :: (Functor f, Transformable a, Transformable b) => LensLike f s t a b -> LensLike f (Time, s) (Time, t) a b Source
whilstLD :: (Functor f, Transformable a, Transformable b) => LensLike f s t a b -> LensLike f (Duration, s) (Duration, t) a b Source
onSpan :: (Transformable s, Transformable t, Functor f) => LensLike f s t a b -> Span -> LensLike f s t a b Source
Transforms a lens of to a Transformable
type to act inside a transformation.
Designed to be used infix, as in
l onSpan
(2 <-> 3)
Specific transformations
Transformations
undelaying :: Duration -> Span Source
A transformation that moves a value backward in time.
stretching :: Duration -> Span Source
A transformation that stretches (augments) a value by the given factor.
compressing :: Duration -> Span Source
A transformation that compresses (diminishes) a value by the given factor.
Transforming values
delay :: Transformable a => Duration -> a -> a Source
Moves a value forward in time.
undelay :: Transformable a => Duration -> a -> a Source
stretch :: Transformable a => Duration -> a -> a Source
Stretches (augments) a value by the given factor.