A member of the insect order Diptera, even though some groups may be generally refered to as 'midges', 'gnats', etc.. In compound names containing 'fly' for members of this order, the name is written as two words as in 'crane fly'. For insects that are members of other orders the name is written as a single word as in 'butterfly'.
Examples of these are:
mayfly: order Ephemeroptera;
dragonfly and damselfly: order Odonata;
stonefly: order Plecoptera;
whitefly: order Hemiptera;
firefly: order Coleoptera;
alderfly, dobsonfly, and fishfly: order Megaloptera;
snakefly, mantidfly, and owlfly: order Neuroptera;
sawfly: order Hymenoptera;
caddisfly: order Trichoptera;
butterfly: order Lepidoptera;
scorpionfly, earwigfly, and hangingfly: order Mecoptera.