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 |
- data Note a
- note :: Iso (Duration, a) (Duration, b) (Note a) (Note b)
- notee :: (Transformable a, Transformable b) => Lens (Note a) (Note b) a b
- durationNote :: Iso' Duration (Note ())
Note type
Construction
note :: Iso (Duration, a) (Duration, b) (Note a) (Note b) Source
View a note value as a pair of the original value and a stretch factor.
notee :: (Transformable a, Transformable b) => Lens (Note a) (Note b) a b Source
Access the note value.
Taking a value out carries out the stretch (using the Transformable
instance),
while putting a value in carries out the reverse transformation.
>>>
view notee $ (2,3::Duration)^.note
6
>>>
set notee 6 $ (2,1::Duration)^.note
(2,3)^.note
durationNote :: Iso' Duration (Note ()) Source
A note value as a duration carrying an associated value. Whitness by picking a trivial value.
>>>
2^.durationNote
(2,())^.note