hmt-0.15: Haskell Music Theory

Safe HaskellNone
LanguageHaskell98

Music.Theory.Z12

Synopsis

Documentation

newtype Z12 Source

Z12 are modulo 12 integers.

map signum [-1,0::Z12,1] == [1,0,1]
map abs [-1,0::Z12,1] == [11,0,1]

Constructors

Z12 Int 

Instances

Bounded Z12

Bounded instance for Z12.

[minBound::Z12 .. maxBound] == [0::Z12 .. 11]
Enum Z12

Cyclic Enum instance for Z12.

pred (0::Z12) == 11
succ (11::Z12) == 0
[9::Z12 .. 3] == [9,10,11,0,1,2,3]
[9::Z12,11 .. 3] == [9,11,1,3]
Eq Z12 
Integral Z12 
Num Z12 
Ord Z12 
Real Z12 
Show Z12 

z12_modulo :: Z12 Source

The Z12 modulo (ie. 12) as a Z12 value. This is required when lifting generalised Z functions to Z12. It is not the same as writing 12::Z12.

z12_modulo == Z12 12
z12_modulo /= 12
(12::Z12) == 0
show z12_modulo == "(Z12 12)"

z12_showsPrec :: Int -> Z12 -> ShowS Source

Basis for Z12 show instance.

map show [-1,0::Z12,1,z12_modulo] == ["11","0","1","(Z12 12)"]

lift_unary_Z12 :: (Int -> Int) -> Z12 -> Z12 Source

Lift unary function over integers to Z12.

lift_unary_Z12 (negate) 7 == 5

lift_binary_Z12 :: (Int -> Int -> Int) -> Z12 -> Z12 -> Z12 Source

Lift unary function over integers to Z12.

map (lift_binary_Z12 (+) 4) [1,5,6] == [5,9,10]

check_negative :: (Int -> Int) -> Z12 -> Z12 Source

Raise an error if the internal Z12 value is negative.

to_Z12 :: Integral i => i -> Z12 Source

Convert integral to Z12.

map to_Z12 [-9,-3,0,13] == [3,9,0,1]

from_Z12 :: Integral i => Z12 -> i Source

Convert Z12 to integral.

complement :: [Z12] -> [Z12] Source

Z12 not in set.

complement [0,2,4,5,7,9,11] == [1,3,6,8,10]