substitute ::
     (Applicable a, Exponentiative a, Field a, Eq a, Show a) => String -> Expression a -> Expression a -> Expression a
substitute name val exp0 =
  map0
    (\nm ->
       if nm == name
         then val
         else Var nm)
    Const
    Fun
    (\f -> apply (substitute name val f))
    exp0
substitute ::
     (Applicable a, Exponentiative a, Field a, Eq a, Show a) => String -> Expression a -> Expression a -> Expression a
substitute name val exp0 =
  map0
    (\nm ->
       if nm == name
         then val
         else Var nm)
    Const
    Fun
    (\f -> apply (substitute name val f))
    exp0
substitute name val exp0 =
  map0
    (\nm ->
       if nm == name
         then val
         else Var nm)
    Const
    Fun
    (\f -> apply (substitute name val f))
    exp0