hmt-0.15: Haskell Music Theory

Safe HaskellNone
LanguageHaskell98

Music.Theory.Z12

Synopsis

Documentation

newtype Z12 #

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]

Methods

minBound :: Z12 #

maxBound :: Z12 #

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]

Methods

succ :: Z12 -> Z12 #

pred :: Z12 -> Z12 #

toEnum :: Int -> Z12 #

fromEnum :: Z12 -> Int #

enumFrom :: Z12 -> [Z12] #

enumFromThen :: Z12 -> Z12 -> [Z12] #

enumFromTo :: Z12 -> Z12 -> [Z12] #

enumFromThenTo :: Z12 -> Z12 -> Z12 -> [Z12] #

Eq Z12 # 

Methods

(==) :: Z12 -> Z12 -> Bool #

(/=) :: Z12 -> Z12 -> Bool #

Integral Z12 # 

Methods

quot :: Z12 -> Z12 -> Z12 #

rem :: Z12 -> Z12 -> Z12 #

div :: Z12 -> Z12 -> Z12 #

mod :: Z12 -> Z12 -> Z12 #

quotRem :: Z12 -> Z12 -> (Z12, Z12) #

divMod :: Z12 -> Z12 -> (Z12, Z12) #

toInteger :: Z12 -> Integer #

Num Z12 # 

Methods

(+) :: Z12 -> Z12 -> Z12 #

(-) :: Z12 -> Z12 -> Z12 #

(*) :: Z12 -> Z12 -> Z12 #

negate :: Z12 -> Z12 #

abs :: Z12 -> Z12 #

signum :: Z12 -> Z12 #

fromInteger :: Integer -> Z12 #

Ord Z12 # 

Methods

compare :: Z12 -> Z12 -> Ordering #

(<) :: Z12 -> Z12 -> Bool #

(<=) :: Z12 -> Z12 -> Bool #

(>) :: Z12 -> Z12 -> Bool #

(>=) :: Z12 -> Z12 -> Bool #

max :: Z12 -> Z12 -> Z12 #

min :: Z12 -> Z12 -> Z12 #

Real Z12 # 

Methods

toRational :: Z12 -> Rational #

Show Z12 # 

Methods

showsPrec :: Int -> Z12 -> ShowS #

show :: Z12 -> String #

showList :: [Z12] -> ShowS #

z12_modulo :: Z12 #

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 #

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 #

Lift unary function over integers to Z12.

lift_unary_Z12 (negate) 7 == 5

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

Lift unary function over integers to Z12.

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

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

Raise an error if the internal Z12 value is negative.

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

Convert integral to Z12.

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

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

Convert Z12 to integral.

complement :: [Z12] -> [Z12] #

Z12 not in set.

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