I still consider myself a newbie to functional programming, and I still have some trouble wrapping my head around a lot of functional concepts. Anyway, here goes:
import Control.Monad.Writer
import Data.Monoid
bubblesort' :: (Ord a) => [a] -> Writer All [a]
bubblesort' (x:y:xs)
| x > y = tell (All False) >>
(y:) <$> bubblesort' (x:xs)
| otherwise =
(x:) <$> bubblesort' (y:xs)
bubblesort' xs = return xs
bubblesort :: (Ord a) => [a] -> [a]
bubblesort xs
| ok = ys
| otherwise = bubblesort ys
where (ys, All ok) = runWriter (bubblesort' xs)