csound-expression-dynamic 0.1.5 → 0.1.6
raw patch · 3 files changed
+21/−28 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Csound.Dynamic.Types.Exp: IntGenId :: Int -> GenId
+ Csound.Dynamic.Types.Exp: StringGenId :: String -> GenId
+ Csound.Dynamic.Types.Exp: data GenId
+ Csound.Dynamic.Types.Exp: instance Data.Hashable.Class.Hashable Csound.Dynamic.Types.Exp.GenId
+ Csound.Dynamic.Types.Exp: instance GHC.Classes.Eq Csound.Dynamic.Types.Exp.GenId
+ Csound.Dynamic.Types.Exp: instance GHC.Classes.Ord Csound.Dynamic.Types.Exp.GenId
+ Csound.Dynamic.Types.Exp: instance GHC.Generics.Constructor Csound.Dynamic.Types.Exp.C1_0GenId
+ Csound.Dynamic.Types.Exp: instance GHC.Generics.Constructor Csound.Dynamic.Types.Exp.C1_1GenId
+ Csound.Dynamic.Types.Exp: instance GHC.Generics.Datatype Csound.Dynamic.Types.Exp.D1GenId
+ Csound.Dynamic.Types.Exp: instance GHC.Generics.Generic Csound.Dynamic.Types.Exp.GenId
+ Csound.Dynamic.Types.Exp: instance GHC.Show.Show Csound.Dynamic.Types.Exp.GenId
- Csound.Dynamic.Types.Exp: Gen :: Int -> Int -> [Double] -> Maybe String -> Gen
+ Csound.Dynamic.Types.Exp: Gen :: Int -> GenId -> [Double] -> Maybe String -> Gen
- Csound.Dynamic.Types.Exp: [genId] :: Gen -> Int
+ Csound.Dynamic.Types.Exp: [genId] :: Gen -> GenId
Files
- csound-expression-dynamic.cabal +1/−1
- src/Csound/Dynamic/Render/Pretty.hs +13/−2
- src/Csound/Dynamic/Types/Exp.hs +7/−25
csound-expression-dynamic.cabal view
@@ -1,5 +1,5 @@ Name: csound-expression-dynamic-Version: 0.1.5+Version: 0.1.6 Cabal-Version: >= 1.6 License: BSD3 License-file: LICENSE
src/Csound/Dynamic/Render/Pretty.hs view
@@ -79,15 +79,26 @@ <> int tabId <+> int 0 <+> (int $ genSize ft)- <+> (int $ genId ft) + <+> (ppGenId $ genId ft) <+> (maybe empty (text . show) $ genFile ft) <+> (hsep $ map double $ genArgs ft) +ppGenId :: GenId -> Doc+ppGenId genId = case genId of+ IntGenId a -> int a+ StringGenId a -> dquotes $ text a+ ppInstr :: InstrId -> Doc -> Doc ppInstr instrId body = vcat [- text "instr" <+> ppInstrId instrId,+ text "instr" <+> ppInstrHeadId instrId, body, text "endin"]++ppInstrHeadId :: InstrId -> Doc+ppInstrHeadId x = case x of+ InstrId den nom -> int nom <> maybe empty ppAfterDot den + InstrLabel name -> text name+ where ppAfterDot a = text $ ('.': ) $ reverse $ show a ppInstrId :: InstrId -> Doc ppInstrId x = case x of
src/Csound/Dynamic/Types/Exp.hs view
@@ -10,7 +10,7 @@ InstrId(..), intInstrId, ratioInstrId, stringInstrId, VarType(..), Var(..), Info(..), OpcFixity(..), Rate(..), Signature(..), isInfix, isPrefix, - Prim(..), Gen(..), + Prim(..), Gen(..), GenId(..), Inline(..), InlineExp(..), PreInline(..), BoolExp, CondInfo, CondOp(..), isTrue, isFalse, NumExp, NumOp(..), Note, @@ -248,7 +248,7 @@ data Prim -- instrument p-arguments = P Int - | PString Int -- >> p-string: + | PString Int -- >> p-string (read p-string notes at the bottom of the file): | PrimInt Int | PrimDouble Double | PrimString String @@ -261,11 +261,14 @@ -- Gen routine. data Gen = Gen { genSize :: Int- , genId :: Int+ , genId :: GenId , genArgs :: [Double] , genFile :: Maybe String } deriving (Show, Eq, Ord, Generic) +data GenId = IntGenId Int | StringGenId String+ deriving (Show, Eq, Ord, Generic)+ -- Csound note type Note = [Prim] @@ -346,6 +349,7 @@ instance Hashable NumOp instance Hashable Gen+instance Hashable GenId instance Hashable Prim instance Hashable Rate @@ -358,28 +362,6 @@ instance Hashable a => Hashable (PrimOr a) instance Hashable a => Hashable (RatedExp a) instance Hashable InstrId--{--instance Hashable-instance Hashable-instance Hashable-instance Hashable--instance Hashable-instance Hashable-instance Hashable-instance Hashable--instance Hashable-instance Hashable-instance Hashable-instance Hashable--instance Hashable-instance Hashable-instance Hashable-instance Hashable--} -------------------------------------------------------------- -- comments