module Named where import qualified Data.StorableVector.Lazy as SVL import qualified Data.NonEmpty as NonEmpty import Control.DeepSeq (NFData, rnf, ) data T a = Cons {name :: String, body :: a} type Signal = T (SVL.Vector Float) type NonEmptySignal = T (NonEmpty.T SVL.Vector Float) instance NFData body => NFData (T body) where rnf (Cons rate xs) = rnf (rate, xs) instance Functor T where fmap f (Cons str xs) = Cons str $ f xs apply :: String -> (a -> b) -> T a -> T b apply prefix f (Cons str xs) = Cons (prefix ++ " " ++ str) $ f xs