    -- GENERATED by C->Haskell Compiler, version 0.25.2 Snowboundest, 31 Oct 2014 (Haskell)
    -- Edit the ORIGNAL .chs file instead!

    {-# LINE 1 "./Debian/Dpkg/Enums.chs" #-}
    {-
     Enums.hs: Haskell bindings to libdpkg
       Copyright (C) 2011 Clint Adams

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 3 of the License, or
     (at your option) any later version.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
    -}

    {-# LANGUAGE ForeignFunctionInterface #-}
    {-# LANGUAGE TypeSynonymInstances #-}

    {-# LINE 27 "./Debian/Dpkg/Enums.chs" #-}

    module Debian.Dpkg.Enums (
        PkgWant(..)
      , PkgEflag(..)
      , PkgStatus(..)
      , PkgPriority(..)
    ) where

    import Foreign.C.Types
    import Foreign.C.String
    import Foreign.Ptr
    import Foreign.Storable

    data PkgWant = PKG_WANT_UNKNOWN
                 | PKG_WANT_INSTALL
                 | PKG_WANT_HOLD
                 | PKG_WANT_DEINSTALL
                 | PKG_WANT_PURGE
                 | PKG_WANT_SENTINEL
      deriving (Enum,Eq,Show)

    {-# LINE 41 "./Debian/Dpkg/Enums.chs" #-}

    data PkgEflag = PKG_EFLAG_OK
                  | PKG_EFLAG_REINSTREQ
      deriving (Eq,Show)
    instance Enum PkgEflag where
      succ PKG_EFLAG_OK = PKG_EFLAG_REINSTREQ
      succ PKG_EFLAG_REINSTREQ = error "PkgEflag.succ: PKG_EFLAG_REINSTREQ has no successor"

      pred PKG_EFLAG_REINSTREQ = PKG_EFLAG_OK
      pred PKG_EFLAG_OK = error "PkgEflag.pred: PKG_EFLAG_OK has no predecessor"

      enumFromTo from to = go from
        where
          end = fromEnum to
          go v = case compare (fromEnum v) end of
                     LT -> v : go (succ v)
                     EQ -> [v]
                     GT -> []

      enumFrom from = enumFromTo from PKG_EFLAG_REINSTREQ

      fromEnum PKG_EFLAG_OK = 0
      fromEnum PKG_EFLAG_REINSTREQ = 1

      toEnum 0 = PKG_EFLAG_OK
      toEnum 1 = PKG_EFLAG_REINSTREQ
      toEnum unmatched = error ("PkgEflag.toEnum: Cannot match " ++ show unmatched)

    {-# LINE 42 "./Debian/Dpkg/Enums.chs" #-}

    data PkgStatus = PKG_STAT_NOTINSTALLED
                   | PKG_STAT_CONFIGFILES
                   | PKG_STAT_HALFINSTALLED
                   | PKG_STAT_UNPACKED
                   | PKG_STAT_HALFCONFIGURED
                   | PKG_STAT_TRIGGERSAWAITED
                   | PKG_STAT_TRIGGERSPENDING
                   | PKG_STAT_INSTALLED
      deriving (Enum,Eq,Show)

    {-# LINE 43 "./Debian/Dpkg/Enums.chs" #-}

    data PkgPriority = PKG_PRIO_UNSET
                     | PKG_PRIO_REQUIRED
                     | PKG_PRIO_IMPORTANT
                     | PKG_PRIO_STANDARD
                     | PKG_PRIO_OPTIONAL
                     | PKG_PRIO_EXTRA
                     | PKG_PRIO_OTHER
                     | PKG_PRIO_UNKNOWN
      deriving (Eq,Show)
    instance Enum PkgPriority where
      succ PKG_PRIO_UNSET = PKG_PRIO_REQUIRED
      succ PKG_PRIO_REQUIRED = PKG_PRIO_IMPORTANT
      succ PKG_PRIO_IMPORTANT = PKG_PRIO_STANDARD
      succ PKG_PRIO_STANDARD = PKG_PRIO_OPTIONAL
      succ PKG_PRIO_OPTIONAL = PKG_PRIO_EXTRA
      succ PKG_PRIO_EXTRA = PKG_PRIO_OTHER
      succ PKG_PRIO_OTHER = PKG_PRIO_UNKNOWN
      succ PKG_PRIO_UNKNOWN = error "PkgPriority.succ: PKG_PRIO_UNKNOWN has no successor"

      pred PKG_PRIO_REQUIRED = PKG_PRIO_UNSET
      pred PKG_PRIO_IMPORTANT = PKG_PRIO_REQUIRED
      pred PKG_PRIO_STANDARD = PKG_PRIO_IMPORTANT
      pred PKG_PRIO_OPTIONAL = PKG_PRIO_STANDARD
      pred PKG_PRIO_EXTRA = PKG_PRIO_OPTIONAL
      pred PKG_PRIO_OTHER = PKG_PRIO_EXTRA
      pred PKG_PRIO_UNKNOWN = PKG_PRIO_OTHER
      pred PKG_PRIO_UNSET = error "PkgPriority.pred: PKG_PRIO_UNSET has no predecessor"

      enumFromTo from to = go from
        where
          end = fromEnum to
          go v = case compare (fromEnum v) end of
                     LT -> v : go (succ v)
                     EQ -> [v]
                     GT -> []

      enumFrom from = enumFromTo from PKG_PRIO_UNKNOWN

      fromEnum PKG_PRIO_UNSET = (-1)
      fromEnum PKG_PRIO_REQUIRED = 0
      fromEnum PKG_PRIO_IMPORTANT = 1
      fromEnum PKG_PRIO_STANDARD = 2
      fromEnum PKG_PRIO_OPTIONAL = 3
      fromEnum PKG_PRIO_EXTRA = 4
      fromEnum PKG_PRIO_OTHER = 5
      fromEnum PKG_PRIO_UNKNOWN = 6

      toEnum (-1) = PKG_PRIO_UNSET
      toEnum 0 = PKG_PRIO_REQUIRED
      toEnum 1 = PKG_PRIO_IMPORTANT
      toEnum 2 = PKG_PRIO_STANDARD
      toEnum 3 = PKG_PRIO_OPTIONAL
      toEnum 4 = PKG_PRIO_EXTRA
      toEnum 5 = PKG_PRIO_OTHER
      toEnum 6 = PKG_PRIO_UNKNOWN
      toEnum unmatched = error ("PkgPriority.toEnum: Cannot match " ++ show unmatched)

    {-# LINE 44 "./Debian/Dpkg/Enums.chs" #-}

    data DpkgMsgType = DPKG_MSG_NONE
                     | DPKG_MSG_WARN
                     | DPKG_MSG_ERROR
      deriving (Enum,Eq,Show)

    {-# LINE 46 "./Debian/Dpkg/Enums.chs" #-}