csound-expression-dynamic 0.3.3 → 0.3.4
raw patch · 6 files changed
+37/−29 lines, 6 filesdep +deriving-compatdep ~data-fixdep ~data-fix-csePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: deriving-compat
Dependency ranges changed: data-fix, data-fix-cse
API changes (from Hackage documentation)
- Csound.Dynamic.Types.Exp: instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Csound.Dynamic.Types.Exp.Inline a b)
- Csound.Dynamic.Types.Exp: instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Csound.Dynamic.Types.Exp.PreInline a b)
- Csound.Dynamic.Types.Exp: instance (GHC.Classes.Ord b, GHC.Classes.Ord a) => GHC.Classes.Ord (Csound.Dynamic.Types.Exp.Inline a b)
- Csound.Dynamic.Types.Exp: instance (GHC.Classes.Ord b, GHC.Classes.Ord a) => GHC.Classes.Ord (Csound.Dynamic.Types.Exp.PreInline a b)
- Csound.Dynamic.Types.Exp: instance (GHC.Show.Show b, GHC.Show.Show a) => GHC.Show.Show (Csound.Dynamic.Types.Exp.Inline a b)
- Csound.Dynamic.Types.Exp: instance (GHC.Show.Show b, GHC.Show.Show a) => GHC.Show.Show (Csound.Dynamic.Types.Exp.PreInline a b)
- Csound.Dynamic.Types.Exp: instance Data.Hashable.Class.Hashable Csound.Dynamic.Types.Exp.E
+ Csound.Dynamic.Build: gInit :: Monad m => String -> Int -> DepT m ()
+ Csound.Dynamic.Build: gInitDouble :: Monad m => String -> Double -> DepT m ()
+ Csound.Dynamic.Build.Numeric: instance GHC.Base.Semigroup Csound.Dynamic.Types.Exp.E
+ Csound.Dynamic.Types.Exp: instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Csound.Dynamic.Types.Exp.Inline a b)
+ Csound.Dynamic.Types.Exp: instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Csound.Dynamic.Types.Exp.PreInline a b)
+ Csound.Dynamic.Types.Exp: instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Csound.Dynamic.Types.Exp.Inline a b)
+ Csound.Dynamic.Types.Exp: instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Csound.Dynamic.Types.Exp.PreInline a b)
+ Csound.Dynamic.Types.Exp: instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Csound.Dynamic.Types.Exp.Inline a b)
+ Csound.Dynamic.Types.Exp: instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Csound.Dynamic.Types.Exp.PreInline a b)
+ Csound.Dynamic.Types.Exp: instance Data.Functor.Classes.Eq1 Csound.Dynamic.Types.Exp.MainExp
+ Csound.Dynamic.Types.Exp: instance Data.Functor.Classes.Eq1 Csound.Dynamic.Types.Exp.PrimOr
+ Csound.Dynamic.Types.Exp: instance Data.Functor.Classes.Eq1 Csound.Dynamic.Types.Exp.RatedExp
+ Csound.Dynamic.Types.Exp: instance Data.Functor.Classes.Ord1 Csound.Dynamic.Types.Exp.MainExp
+ Csound.Dynamic.Types.Exp: instance Data.Functor.Classes.Ord1 Csound.Dynamic.Types.Exp.PrimOr
+ Csound.Dynamic.Types.Exp: instance Data.Functor.Classes.Ord1 Csound.Dynamic.Types.Exp.RatedExp
+ Csound.Dynamic.Types.Exp: instance GHC.Classes.Eq a => Data.Functor.Classes.Eq1 (Csound.Dynamic.Types.Exp.Inline a)
+ Csound.Dynamic.Types.Exp: instance GHC.Classes.Eq a => Data.Functor.Classes.Eq1 (Csound.Dynamic.Types.Exp.PreInline a)
+ Csound.Dynamic.Types.Exp: instance GHC.Classes.Ord a => Data.Functor.Classes.Ord1 (Csound.Dynamic.Types.Exp.Inline a)
+ Csound.Dynamic.Types.Exp: instance GHC.Classes.Ord a => Data.Functor.Classes.Ord1 (Csound.Dynamic.Types.Exp.PreInline a)
+ Csound.Dynamic.Types.Flags: instance GHC.Base.Semigroup Csound.Dynamic.Types.Flags.AudioFileOutput
+ Csound.Dynamic.Types.Flags: instance GHC.Base.Semigroup Csound.Dynamic.Types.Flags.Config
+ Csound.Dynamic.Types.Flags: instance GHC.Base.Semigroup Csound.Dynamic.Types.Flags.Displays
+ Csound.Dynamic.Types.Flags: instance GHC.Base.Semigroup Csound.Dynamic.Types.Flags.Flags
+ Csound.Dynamic.Types.Flags: instance GHC.Base.Semigroup Csound.Dynamic.Types.Flags.IdTags
+ Csound.Dynamic.Types.Flags: instance GHC.Base.Semigroup Csound.Dynamic.Types.Flags.MidiIO
+ Csound.Dynamic.Types.Flags: instance GHC.Base.Semigroup Csound.Dynamic.Types.Flags.MidiRT
- Csound.Dynamic.Render.Pretty: data Doc :: *
+ Csound.Dynamic.Render.Pretty: data Doc
- Csound.Dynamic.Types.Dep: depT_ :: (Monad m) => E -> DepT m ()
+ Csound.Dynamic.Types.Dep: depT_ :: Monad m => E -> DepT m ()
- Csound.Dynamic.Types.Dep: mdepT :: (Monad m) => MultiOut [E] -> MultiOut (DepT m [E])
+ Csound.Dynamic.Types.Dep: mdepT :: Monad m => MultiOut [E] -> MultiOut (DepT m [E])
- Csound.Dynamic.Types.Exp: ExpBool :: (BoolExp a) -> MainExp a
+ Csound.Dynamic.Types.Exp: ExpBool :: BoolExp a -> MainExp a
- Csound.Dynamic.Types.Exp: ExpNum :: (NumExp a) -> MainExp a
+ Csound.Dynamic.Types.Exp: ExpNum :: NumExp a -> MainExp a
- Csound.Dynamic.Types.Exp: If :: (CondInfo a) -> a -> a -> MainExp a
+ Csound.Dynamic.Types.Exp: If :: CondInfo a -> a -> a -> MainExp a
- Csound.Dynamic.Types.Exp: IfBegin :: Rate -> (CondInfo a) -> MainExp a
+ Csound.Dynamic.Types.Exp: IfBegin :: Rate -> CondInfo a -> MainExp a
- Csound.Dynamic.Types.Exp: InitArr :: Var -> (ArrSize a) -> MainExp a
+ Csound.Dynamic.Types.Exp: InitArr :: Var -> ArrSize a -> MainExp a
- Csound.Dynamic.Types.Exp: ReadArr :: Var -> (ArrIndex a) -> MainExp a
+ Csound.Dynamic.Types.Exp: ReadArr :: Var -> ArrIndex a -> MainExp a
- Csound.Dynamic.Types.Exp: SingleRate :: (Map Rate [Rate]) -> Signature
+ Csound.Dynamic.Types.Exp: SingleRate :: Map Rate [Rate] -> Signature
- Csound.Dynamic.Types.Exp: UntilBegin :: (CondInfo a) -> MainExp a
+ Csound.Dynamic.Types.Exp: UntilBegin :: CondInfo a -> MainExp a
- Csound.Dynamic.Types.Exp: WhileBegin :: (CondInfo a) -> MainExp a
+ Csound.Dynamic.Types.Exp: WhileBegin :: CondInfo a -> MainExp a
- Csound.Dynamic.Types.Exp: WriteArr :: Var -> (ArrIndex a) -> a -> MainExp a
+ Csound.Dynamic.Types.Exp: WriteArr :: Var -> ArrIndex a -> a -> MainExp a
- Csound.Dynamic.Types.Exp: WriteInitArr :: Var -> (ArrIndex a) -> a -> MainExp a
+ Csound.Dynamic.Types.Exp: WriteInitArr :: Var -> ArrIndex a -> a -> MainExp a
Files
- csound-expression-dynamic.cabal +5/−3
- src/Csound/Dynamic/Build.hs +1/−1
- src/Csound/Dynamic/Build/Numeric.hs +1/−0
- src/Csound/Dynamic/Tfm/Liveness.hs +16/−16
- src/Csound/Dynamic/Types/Dep.hs +0/−6
- src/Csound/Dynamic/Types/Exp.hs +14/−3
csound-expression-dynamic.cabal view
@@ -1,6 +1,6 @@ Name: csound-expression-dynamic-Version: 0.3.3-Cabal-Version: >= 1.6+Version: 0.3.4+Cabal-Version: >= 1.10 License: BSD3 License-file: LICENSE Author: Anton Kholomiov@@ -25,8 +25,10 @@ Ghc-Options: -Wall Build-Depends: base >= 4, base < 5, data-default, containers, array, transformers >= 0.3, wl-pprint >= 1.2.1,- Boolean >= 0.1.0, data-fix, data-fix-cse >= 0.0.2, hashable+ Boolean >= 0.1.0, data-fix >= 0.3.0, data-fix-cse >= 0.0.3, hashable,+ deriving-compat Hs-Source-Dirs: src/+ default-language: Haskell2010 Exposed-Modules: Csound.Dynamic
src/Csound/Dynamic/Build.hs view
@@ -14,7 +14,7 @@ numExp1, numExp2, tfm, tfmNoInlineArgs, pn, withInits, double, int, str, verbatim, instrIdE,- inlineVar,+ inlineVar, gInit, gInitDouble, -- ** Opcodes constructors Spec1, spec1, opcs, opcsNoInlineArgs, opr1, opr1k, infOpr, oprBy,
src/Csound/Dynamic/Build/Numeric.hs view
@@ -172,3 +172,4 @@ fracE = unOpt (snd . (properFraction :: (Double -> (Int, Double)))) (opr1 "frac") intE = doubleToInt truncate (opr1 "int") +
src/Csound/Dynamic/Tfm/Liveness.hs view
@@ -22,8 +22,8 @@ liveness :: Traversable f => Int -> Dag f -> Dag f liveness lastFreshId as = runST $ do- st <- initSt lastFreshId $ analyse lastFreshId as- evalStateT (mapM substExp $ countLines $ as) st+ st <- initSt lastFreshId $ analyse lastFreshId as+ evalStateT (mapM substExp $ countLines $ as) st type LineNumber = Int @@ -47,15 +47,15 @@ allocId :: IdList -> (Int, IdList) allocId (IdList is lastId) = (head is, IdList (tail is) (max (head is) lastId)) -freeId :: Int -> IdList -> IdList +freeId :: Int -> IdList -> IdList freeId n (IdList is lastId) = IdList (insertSorted n is) lastId1- where lastId1 = if (n == lastId) then (lastId - 1) else lastId+ where lastId1 = if (n == lastId) then (lastId - 1) else lastId insertSorted :: Int -> [Int] -> [Int]-insertSorted n (a:as) - | n < a = n : a : as- | n == a = a : as- | otherwise = a : insertSorted n as +insertSorted n (a:as)+ | n < a = n : a : as+ | n == a = a : as+ | otherwise = a : insertSorted n as insertSorted n [] = [n] -----------------------------------------------@@ -65,7 +65,7 @@ type LivenessTable = A.UArray Int Int type SubstTable s = StArr s -data Registers s = Registers +data Registers s = Registers { registers :: M.Map Rate IdList , livenessTable :: LivenessTable , substTable :: SubstTable s@@ -92,7 +92,7 @@ saveSubst :: Int -> Int -> Memory s () saveSubst from to = do- tab <- fmap substTable get + tab <- fmap substTable get lift $ A.writeArray tab from to substLhs :: Var -> Memory s Var@@ -110,20 +110,20 @@ return v1 allocAndSkipInits :: Var -> Memory s Var-allocAndSkipInits v +allocAndSkipInits v | isInit r = return v | otherwise = alloc r- where + where r = varType v isInit x = x == Ir || x == Sr alloc :: Rate -> Memory s Var-alloc rate = state $ \mem -> +alloc rate = state $ \mem -> let (i, mem1) = allocRegister rate mem in (D.Var i rate, mem1)- where + where allocRegister :: Rate -> Registers s -> (Int, Registers s)- allocRegister r mem = (i, onRegs (M.update (const $ Just is) r) mem) + allocRegister r mem = (i, onRegs (M.update (const $ Just is) r) mem) where (i, is) = allocId $ registers mem M.! r free :: Var -> Memory s ()@@ -141,7 +141,7 @@ arr <- A.newArray (0, lastFreshId) 0 mapM_ (go arr) $ countLines as return arr- where + where go :: Traversable f => StArr s -> (LineNumber, Exp f) -> ST s () go arr (lineNum, (_, rhs)) = mapM (countVar arr lineNum) rhs >> return ()
src/Csound/Dynamic/Types/Dep.hs view
@@ -77,9 +77,6 @@ depends :: E -> E -> E depends a1 a2 = noRate $ Seq (toPrimOr a1) (toPrimOr a2) -end :: Monad m => E -> DepT m ()-end a = depT_ $ noRate $ Ends (toPrimOr a)- depT :: Monad m => E -> DepT m E depT a = DepT $ do s <- get@@ -100,9 +97,6 @@ stmtOnlyT :: Monad m => Exp E -> DepT m () stmtOnlyT stmt = depT_ $ noRate stmt--emptyE :: E-emptyE = noRate $ EmptyExp -- local variables
src/Csound/Dynamic/Types/Exp.hs view
@@ -34,6 +34,8 @@ import Data.Maybe(isNothing) import qualified Data.IntMap as IM import Data.Fix+import Data.Eq.Deriving+import Data.Ord.Deriving import qualified Csound.Dynamic.Tfm.DeduceTypes as R(Var(..)) @@ -63,9 +65,6 @@ -- | The inner representation of csound expressions. type E = Fix RatedExp -instance Hashable E where- hashWithSalt s x = s `hashWithSalt` cata hash x- data RatedExp a = RatedExp { ratedExpRate :: Maybe Rate -- ^ Rate (can be undefined or Nothing,@@ -387,6 +386,18 @@ instance Hashable a => Hashable (PrimOr a) instance Hashable a => Hashable (RatedExp a) instance Hashable InstrId++$(deriveEq1 ''PrimOr)+$(deriveEq1 ''PreInline)+$(deriveEq1 ''Inline)+$(deriveEq1 ''MainExp)+$(deriveEq1 ''RatedExp)++$(deriveOrd1 ''PrimOr)+$(deriveOrd1 ''PreInline)+$(deriveOrd1 ''Inline)+$(deriveOrd1 ''MainExp)+$(deriveOrd1 ''RatedExp) -------------------------------------------------------------- -- comments