If used legally, driving while under the influence of marijuana is:

Even if you are using the substance legally, operating a vehicle while under the influence of marijuana is not legal. Doing so can be dangerous because the substance can distort your perception of space, time, and speed.
DMV Writen Test