module Sound.SC3.UGen.Dot.Class where

import Sound.SC3 as S
import Sound.SC3.UGen.Dot.Internal
import Sound.SC3.UGen.Dot.Type

-- | Draw the unit generator graph provided using the viewer at the
--   environment variable @DOTVIEWER@, or @dotty@ if that variable is
--   not defined.
class Drawable a where
    dot_with_opt :: Dot_Options -> a -> String

instance Drawable S.Graph where
    dot_with_opt = dotGraph

instance Drawable S.UGen where
    dot_with_opt o = dotGraph o . S.synth

instance Drawable S.Synthdef where
    dot_with_opt o = dotGraph o . S.synthdefGraph