I have a bunch of types where their hierarchy stores some useful information. I\'m trying to avoid having to bake in knowledge of the hierarchy of the types into the functio
Use typeclasses.
First define each of the concrete types as a seperate data declaration.
Then for each type with subtypes declare a typeclass with a constraint on its parent. An example of this sort of relationship is Functor => Applicative => Monad structure in prelude.
So to define the example structure:
class Root where
...
class Root => Dep where
...
class Dep => Aux where
...
class Aux => Auxpass where
...
class Aux => Cop where
...
class Dep => Arg where
...
class Arg => Agent where
...