-- | Generic function for applying a transducer
apply :: Eq a => Transducer a -> TransitionFunction a -> [a] -> StateTy ->
                 [Symbol a] -> Maybe [[a]]
apply transducer transFun input s result =
 case (runEpsilon transducer transFun input s result,
       runSymbol  transducer transFun input s result) of
   (Just xs, Just ys) -> Just (xs ++ ys)
   (a,       Nothing) -> a
   (Nothing, b      ) -> b
apply :: Eq a => Transducer a -> TransitionFunction a -> [a] -> StateTy ->
                 [Symbol a] -> Maybe [[a]]
apply transducer transFun input s result =
 case (runEpsilon transducer transFun input s result,
       runSymbol  transducer transFun input s result) of
   (Just xs, Just ys) -> Just (xs ++ ys)
   (a,       Nothing) -> a
   (Nothing, b      ) -> b
apply transducer transFun input s result =
 case (runEpsilon transducer transFun input s result,
       runSymbol  transducer transFun input s result) of
   (Just xs, Just ys) -> Just (xs ++ ys)
   (a,       Nothing) -> a
   (Nothing, b      ) -> b