This article modifies a standard model of law enforcement to allow for learning by doing. We incorporate the process of enforcement learning by assuming that the agency's current marginal cost is a decreasing function of its past experience of detecting and convicting. The agency accumulates data and information (on criminals, on opportunities of crime), enhancing the ability of future apprehension at a lower marginal cost. We focus on the impact of enforcement learning on optimal compliance rules. In particular, we show that the optimal fine could be less than maximal and the optimal probability of detection could be higher than otherwise. It is also suggested that the optimal imprisonment sentence could be higher than otherwise.