diff --git a/haskell-gi.cabal b/haskell-gi.cabal
--- a/haskell-gi.cabal
+++ b/haskell-gi.cabal
@@ -1,5 +1,5 @@
 name:                haskell-gi
-version:             0.17
+version:             0.17.1
 synopsis:            Generate Haskell bindings for GObject Introspection capable libraries
 description:         Generate Haskell bindings for GObject Introspection capable libraries. This includes most notably
                      Gtk+, but many other libraries in the GObject ecosystem provide introspection data too.
@@ -24,7 +24,7 @@
   pkgconfig-depends:   gobject-introspection-1.0 >= 1.42, gobject-2.0 >= 2.36
   build-depends:       base >= 4.7 && < 5,
                        haskell-gi-base == 0.17,
-                       Cabal >= 1.24,
+                       Cabal >= 1.20,
                        containers,
                        directory,
                        filepath,
diff --git a/lib/Data/GI/CodeGen/Code.hs b/lib/Data/GI/CodeGen/Code.hs
--- a/lib/Data/GI/CodeGen/Code.hs
+++ b/lib/Data/GI/CodeGen/Code.hs
@@ -663,6 +663,7 @@
 -- | Standard imports.
 moduleImports :: Text
 moduleImports = T.unlines [ "import Data.GI.Base.ShortPrelude"
+                          , "import qualified Prelude as P"
                           , ""
                           , "import qualified Data.GI.Base.Attributes as GI.Attributes"
                           , "import qualified Data.Text as T"
diff --git a/lib/Data/GI/CodeGen/CodeGen.hs b/lib/Data/GI/CodeGen/CodeGen.hs
--- a/lib/Data/GI/CodeGen/CodeGen.hs
+++ b/lib/Data/GI/CodeGen/CodeGen.hs
@@ -93,8 +93,9 @@
           line $ "| Another" <> name' <> " Int"
           line "deriving (Show, Eq)"
         _ -> return ()
+
   group $ do
-    line $ "instance Enum " <> name' <> " where"
+    line $ "instance P.Enum " <> name' <> " where"
     indent $ do
             forM_ fields' $ \(n, v) ->
                 line $ "fromEnum " <> n <> " = " <> tshow v
@@ -105,6 +106,11 @@
             forM_ valueNames $ \(v, n) ->
                 line $ "toEnum " <> tshow v <> " = " <> n
             line $ "toEnum k = Another" <> name' <> " k"
+
+  group $ do
+    line $ "instance P.Ord " <> name' <> " where"
+    indent $ line "compare a b = P.compare (P.fromEnum a) (P.fromEnum b)"
+
   maybe (return ()) (genErrorDomain name') eDomain
 
 genBoxedEnum :: Name -> Text -> CodeGen ()
