Safe Haskell | None |
---|---|
Language | Haskell98 |
- 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
Z12 are modulo 12 integers.
map signum [-1,0::Z12,1] == [1,0,1] map abs [-1,0::Z12,1] == [11,0,1]
z12_modulo :: Z12 Source
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.
complement :: [Z12] -> [Z12] Source
Z12 not in set.
complement [0,2,4,5,7,9,11] == [1,3,6,8,10]