hmt-0.15: Haskell Music Theory

Safe Haskell | None
Language | Haskell98

Music.Theory.Z12

Synopsis

- newtype Z12 = Z12 Int
- z12_modulo :: Z12
- z12_showsPrec :: Int -> Z12 -> ShowS
- lift_unary_Z12 :: (Int -> Int) -> Z12 -> Z12
- lift_binary_Z12 :: (Int -> Int -> Int) -> Z12 -> Z12 -> Z12
- check_negative :: (Int -> Int) -> Z12 -> Z12
- to_Z12 :: Integral i => i -> Z12
- from_Z12 :: Integral i => Z12 -> i
- complement :: [Z12] -> [Z12]

# 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 Source #

`Bounded` instance for Z12.

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

Methods minBound :: Z12 # maxBound :: Z12 #

Enum Z12 Source #

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 Source # |
Methods (==) :: Z12 -> Z12 -> Bool # (/=) :: Z12 -> Z12 -> Bool #
Integral Z12 Source # |
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 Source # |
Methods (+) :: Z12 -> Z12 -> Z12 # (-) :: Z12 -> Z12 -> Z12 # (*) :: Z12 -> Z12 -> Z12 # negate :: Z12 -> Z12 # abs :: Z12 -> Z12 # signum :: Z12 -> Z12 # fromInteger :: Integer -> Z12 #
Ord Z12 Source # |
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 Source # |
Methods toRational :: Z12 -> Rational #
Show Z12 Source # |
Methods showsPrec :: Int -> Z12 -> ShowS # show :: Z12 -> String # showList :: [Z12] -> ShowS #

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]