Safe Haskell | None |
---|---|
Language | Haskell98 |
Functions to allow using the Sound.OpenSoundControl Datum
as
a universal data type. In addition to the functions defined
below it provides instances for:
:set -XOverloadedStrings "string" :: Datum
Int32 5 /=* Int32 6 == Int32 1 Double 5 ==* Double 5 == Double 1
5 :: Datum 5 + 4 :: Datum negate 5 :: Datum
Datum
are Fractional
5.0 :: Datum (5 / 4) :: Datum
pi :: Datum sqrt (Int32 4) == Double 2 (2.0 ** 3.0) :: Datum
toRational (Double 1.5) == (3/2 :: Rational) (realToFrac (1.5 :: Double) :: Datum) == Double 1.5 (realToFrac (Double 1.5) :: Datum) == Double 1.5 (realToFrac (Double 1.5) :: Double) == 1.5
round (Double 1.4) == 1
roundE (Double 1.4) == Double 1 ceilingE (Double 1.4) == Double 2
isNaN (sqrt (negate (Int32 1))) == True
Double 7.5 > Int32 7 string "because" > string "again"
Int32 7 >* Int32 7 == Int32 0 Double 7.5 >* Int32 7 == Double 1
[Int32 0 .. Int32 4] == [Int32 0,Int32 1,Int32 2,Int32 3,Int32 4] [Double 1 .. Double 3] == [Double 1,Double 2,Double 3]
System.Random.randomRIO (Int32 0,Int32 9):: IO Datum System.Random.randomRIO (Float 0,Float 1):: IO Datum
- type UOp n = n -> n
- liftD :: UOp Int32 -> UOp Int64 -> UOp Float -> UOp Double -> UOp Datum
- liftD' :: UOp Double -> UOp Datum
- type BinOp n = n -> n -> n
- liftD2 :: BinOp Int32 -> BinOp Int64 -> BinOp Float -> BinOp Double -> BinOp Datum
- liftD2' :: BinOp Double -> BinOp Datum
- atD :: (Int32 -> a) -> (Int64 -> a) -> (Float -> a) -> (Double -> a) -> Datum -> a
- atD' :: (Double -> a) -> Datum -> a
- type BinAt n a = n -> n -> a
- atD2 :: BinAt Int32 a -> BinAt Int64 a -> BinAt Float a -> BinAt Double a -> BinAt Datum a
- type TriAt n a = n -> n -> n -> a
- atD3 :: TriAt Int32 a -> TriAt Int64 a -> TriAt Float a -> TriAt Double a -> TriAt Datum a
Lifting
liftD' :: UOp Double -> UOp Datum Source
Lift a Double
unary operator to Datum
via datum_promote
.
liftD' negate (Int 5) == Double (-5)
liftD2' :: BinOp Double -> BinOp Datum Source
A datum_promote
variant of liftD2
.
liftD2' (+) (Float 1) (Float 2) == Double 3
At
atD' :: (Double -> a) -> Datum -> a Source
Lift a Double
at operator to Datum
via datum_promote
.
atD' floatRadix (Int 5) == 2