module Language.XDsp.Semantics.BasicExtensions (
StringVar (..)
,Buffer (..)
,BufferR (..)
,VKtl (..)
,VBuf (..)
,LblBlock (..)
,NumArgs (..)
,TList (..)
,tlist0
,unTList
,unTList'
,unsafeTList
,defaultRunBlock
,Phasor (..)
,Oscil (..)
)
where
import Language.XDsp.Semantics.Core
import Data.TypeLevel.Num
class Dsp repr => StringVar repr where
data VString repr :: *
fromStr :: String -> VString repr
class Dsp repr => Buffer repr where
type Buf repr :: *
emptyBuffer :: Int -> repr (Buf repr)
class Buffer repr => BufferR repr out a where
lookupAt :: Buf repr -> a -> repr out
class Dsp repr => LblBlock repr where
type ArgTag repr :: *
type ArgTyp repr :: *
data Block repr :: *
lblBlock :: Int -> repr a -> repr (Block repr)
runBlock :: Block repr
-> Double
-> Double
-> TList (ArgTag repr) (ArgTyp repr)
-> repr ()
class (Nat n, Nat m, m :>=: n) => NumArgs repr m n where
getArg :: n -> repr m (INum (repr m))
data TList n a = TList [a] deriving (Eq, Show, Functor)
defaultRunBlock ::
(ArgTag repr ~ D3, LblBlock repr) =>
Block repr
-> Double
-> Double
-> repr ()
defaultRunBlock blk st dr = runBlock blk st dr tlist0
tlist0 :: (Nat n, n :>=: D3) => TList n a
tlist0 = TList []
unTList :: TList n a -> [a]
unTList (TList l) = l
unTList' :: n -> TList n a -> [a]
unTList' _ = unTList
unsafeTList :: Nat n => n -> [a] -> TList n a
unsafeTList _ l = TList l
class Dsp repr => VKtl repr where
vktl :: String -> repr (KSig repr)
class Buffer repr => VBuf repr where
vbuf :: String -> Int -> repr (Buf repr)
class Phasor repr out a where
phasor :: a -> repr out
class Buffer repr => Oscil repr out a b where
oscil :: a -> b -> Buf repr -> repr out
oscil' :: a -> b -> Buf repr -> INum repr -> repr out