What to do if you have a Non Exhaustive pattern match

First some code (there are 4 rotations (two double rotations and two single rotations) here a single
rotation (the double rotations have to look one deeper and have one patternmatch more):

single_L : a -> Tree a -> Tree a -> Tree a
single_L el lst rst =
  case rst of
    E -> undefined
    T el2 _ rlst rrst -> t1 el2 (t1 el lst rlst) rrst

some context E and T are constructors for the Tree a datatype. E : Tree a is for leaves and T : a -> Int -> Tree a -> Tree a -> Tree a for nodes. The Int is stores is the sized of the tree (that is used for balancing)

t1 : a -> Tree a -> Tree a is a ‘smart’ constructor computing the right size, so there will be never accedentily the wrong one. The module will only export safe operations that can’t produce trees with wrong size information (so it won’t export T for example (and also not t1 as it can produce non-search trees but this is not the point here)).

single_L already takes the outermost Tree node in a patternmatched form (as the parent has to do this match anyway and we have one less pattern match we need to do then).

Why do I know that the patternmatching can’t fail. I read the size information (of the parent) before and know that the tree must be balanced (to some degree) and this already tells me that there has to be a non-leave there. If there is, this module already contains a bug! It should only give the user functions that produce correct trees!

What I realy dislike about the identity (it would work of course (in theory everything that is of the correct type wouldd work)), is that it can hide bugs. I as a developer want to know when this code branch gets exercised (as something is clearly wrong then). If I put the identity there it would not only return some value that type checks, but also produce a correct search tree. So from the outside and in
functional tests it will look like everything works, even if there is a bug and the tree is not rebalancing correctly, and I want to catch that error and fix it. In other words writing the Identity there makes it harder to catch a potential bug! That sounds not good.