    -- GENERATED by C->Haskell Compiler, version 0.27.1 Eternal Sunshine, 29 November 2015 (Haskell)
    -- Edit the ORIGNAL .chs file instead!

    {-# LINE 1 "lib/UI/NCurses/Enums.chs" #-}
    -- Copyright (C) 2010 John Millikin <jmillikin@gmail.com>
    --
    -- 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
    -- 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, see <http://www.gnu.org/licenses/>.

    -- | This module is a hack to work around c2hs's lack of #define hooks.
    -- the idea is to create a new class 'Enum' which uses 'Integer' instead
    -- of 'Int', so integral defines of any size can be retrieved.
    module UI.NCurses.Enums where

    import           Prelude (Integer, error, show, (++), compare, Ordering(..))

    class Enum a where
    	toEnum :: Integer -> a
    	fromEnum :: a -> Integer

    	-- c2hs 0.18.1 additionally defines these in its Enum instances,
    	-- but we don't use them.
    	pred, succ :: a -> a
    	pred = error "ncurses Enum: pred"
    	succ = error "ncurses Enum: succ"

    	enumFrom :: a -> [a]
    	enumFrom = error "ncurses Enum: enumFrom"
    	enumFromThen :: a -> a -> [a]
    	enumFromThen = error "ncurses Enum: enumFromThen"
    	enumFromTo :: a -> a -> [a]
    	enumFromTo = error "ncurses Enum: enumFromTo"
    	enumFromThenTo :: a -> a -> a -> [a]
    	enumFromThenTo = error "ncurses Enum: enumFromThenTo"

    -- misc enums
    data EnumWrapper = ERR
                     | ALL_MOUSE_EVENTS
    instance Enum EnumWrapper where
      succ ERR = ALL_MOUSE_EVENTS
      succ ALL_MOUSE_EVENTS = error "EnumWrapper.succ: ALL_MOUSE_EVENTS has no successor"

      pred ALL_MOUSE_EVENTS = ERR
      pred ERR = error "EnumWrapper.pred: ERR 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 ALL_MOUSE_EVENTS

      fromEnum ERR = (-1)
      fromEnum ALL_MOUSE_EVENTS = 134217727

      toEnum (-1) = ERR
      toEnum 134217727 = ALL_MOUSE_EVENTS
      toEnum unmatched = error ("EnumWrapper.toEnum: Cannot match " ++ show unmatched)

    {-# LINE 63 "lib/UI/NCurses/Enums.chs" #-}

    -- attributes
    data Attribute = WA_STANDOUT
                   | WA_UNDERLINE
                   | WA_REVERSE
                   | WA_BLINK
                   | WA_DIM
                   | WA_BOLD
                   | WA_ALTCHARSET
                   | WA_INVIS
                   | WA_PROTECT
    instance Enum Attribute where
      succ WA_STANDOUT = WA_UNDERLINE
      succ WA_UNDERLINE = WA_REVERSE
      succ WA_REVERSE = WA_BLINK
      succ WA_BLINK = WA_DIM
      succ WA_DIM = WA_BOLD
      succ WA_BOLD = WA_ALTCHARSET
      succ WA_ALTCHARSET = WA_INVIS
      succ WA_INVIS = WA_PROTECT
      succ WA_PROTECT = error "Attribute.succ: WA_PROTECT has no successor"

      pred WA_UNDERLINE = WA_STANDOUT
      pred WA_REVERSE = WA_UNDERLINE
      pred WA_BLINK = WA_REVERSE
      pred WA_DIM = WA_BLINK
      pred WA_BOLD = WA_DIM
      pred WA_ALTCHARSET = WA_BOLD
      pred WA_INVIS = WA_ALTCHARSET
      pred WA_PROTECT = WA_INVIS
      pred WA_STANDOUT = error "Attribute.pred: WA_STANDOUT 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 WA_PROTECT

      fromEnum WA_STANDOUT = 65536
      fromEnum WA_UNDERLINE = 131072
      fromEnum WA_REVERSE = 262144
      fromEnum WA_BLINK = 524288
      fromEnum WA_DIM = 1048576
      fromEnum WA_BOLD = 2097152
      fromEnum WA_ALTCHARSET = 4194304
      fromEnum WA_INVIS = 8388608
      fromEnum WA_PROTECT = 16777216

      toEnum 65536 = WA_STANDOUT
      toEnum 131072 = WA_UNDERLINE
      toEnum 262144 = WA_REVERSE
      toEnum 524288 = WA_BLINK
      toEnum 1048576 = WA_DIM
      toEnum 2097152 = WA_BOLD
      toEnum 4194304 = WA_ALTCHARSET
      toEnum 8388608 = WA_INVIS
      toEnum 16777216 = WA_PROTECT
      toEnum unmatched = error ("Attribute.toEnum: Cannot match " ++ show unmatched)

    {-# LINE 79 "lib/UI/NCurses/Enums.chs" #-}

    -- colors
    data Color = COLOR_DEFAULT
               | COLOR_BLACK
               | COLOR_RED
               | COLOR_GREEN
               | COLOR_YELLOW
               | COLOR_BLUE
               | COLOR_MAGENTA
               | COLOR_CYAN
               | COLOR_WHITE
    instance Enum Color where
      succ COLOR_DEFAULT = COLOR_BLACK
      succ COLOR_BLACK = COLOR_RED
      succ COLOR_RED = COLOR_GREEN
      succ COLOR_GREEN = COLOR_YELLOW
      succ COLOR_YELLOW = COLOR_BLUE
      succ COLOR_BLUE = COLOR_MAGENTA
      succ COLOR_MAGENTA = COLOR_CYAN
      succ COLOR_CYAN = COLOR_WHITE
      succ COLOR_WHITE = error "Color.succ: COLOR_WHITE has no successor"

      pred COLOR_BLACK = COLOR_DEFAULT
      pred COLOR_RED = COLOR_BLACK
      pred COLOR_GREEN = COLOR_RED
      pred COLOR_YELLOW = COLOR_GREEN
      pred COLOR_BLUE = COLOR_YELLOW
      pred COLOR_MAGENTA = COLOR_BLUE
      pred COLOR_CYAN = COLOR_MAGENTA
      pred COLOR_WHITE = COLOR_CYAN
      pred COLOR_DEFAULT = error "Color.pred: COLOR_DEFAULT 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 COLOR_WHITE

      fromEnum COLOR_DEFAULT = (-1)
      fromEnum COLOR_BLACK = 0
      fromEnum COLOR_RED = 1
      fromEnum COLOR_GREEN = 2
      fromEnum COLOR_YELLOW = 3
      fromEnum COLOR_BLUE = 4
      fromEnum COLOR_MAGENTA = 5
      fromEnum COLOR_CYAN = 6
      fromEnum COLOR_WHITE = 7

      toEnum (-1) = COLOR_DEFAULT
      toEnum 0 = COLOR_BLACK
      toEnum 1 = COLOR_RED
      toEnum 2 = COLOR_GREEN
      toEnum 3 = COLOR_YELLOW
      toEnum 4 = COLOR_BLUE
      toEnum 5 = COLOR_MAGENTA
      toEnum 6 = COLOR_CYAN
      toEnum 7 = COLOR_WHITE
      toEnum unmatched = error ("Color.toEnum: Cannot match " ++ show unmatched)

    {-# LINE 95 "lib/UI/NCurses/Enums.chs" #-}

    -- keys
    data Key = KEY_CODE_YES
             | KEY_DOWN
             | KEY_UP
             | KEY_LEFT
             | KEY_RIGHT
             | KEY_HOME
             | KEY_BACKSPACE
             | KEY_F0
             | KEY_DL
             | KEY_IL
             | KEY_DC
             | KEY_IC
             | KEY_EIC
             | KEY_CLEAR
             | KEY_EOS
             | KEY_EOL
             | KEY_SF
             | KEY_SR
             | KEY_NPAGE
             | KEY_PPAGE
             | KEY_STAB
             | KEY_CTAB
             | KEY_CATAB
             | KEY_ENTER
             | KEY_PRINT
             | KEY_LL
             | KEY_A1
             | KEY_A3
             | KEY_B2
             | KEY_C1
             | KEY_C3
             | KEY_BTAB
             | KEY_BEG
             | KEY_CANCEL
             | KEY_CLOSE
             | KEY_COMMAND
             | KEY_COPY
             | KEY_CREATE
             | KEY_END
             | KEY_EXIT
             | KEY_FIND
             | KEY_HELP
             | KEY_MARK
             | KEY_MESSAGE
             | KEY_MOVE
             | KEY_NEXT
             | KEY_OPEN
             | KEY_OPTIONS
             | KEY_PREVIOUS
             | KEY_REDO
             | KEY_REFERENCE
             | KEY_REFRESH
             | KEY_REPLACE
             | KEY_RESTART
             | KEY_RESUME
             | KEY_SAVE
             | KEY_SBEG
             | KEY_SCANCEL
             | KEY_SCOMMAND
             | KEY_SCOPY
             | KEY_SCREATE
             | KEY_SDC
             | KEY_SDL
             | KEY_SELECT
             | KEY_SEND
             | KEY_SEOL
             | KEY_SEXIT
             | KEY_SFIND
             | KEY_SHELP
             | KEY_SHOME
             | KEY_SIC
             | KEY_SLEFT
             | KEY_SMESSAGE
             | KEY_SMOVE
             | KEY_SNEXT
             | KEY_SOPTIONS
             | KEY_SPREVIOUS
             | KEY_SPRINT
             | KEY_SREDO
             | KEY_SREPLACE
             | KEY_SRIGHT
             | KEY_SRSUME
             | KEY_SSAVE
             | KEY_SSUSPEND
             | KEY_SUNDO
             | KEY_SUSPEND
             | KEY_UNDO
             | KEY_MOUSE
             | KEY_RESIZE
             | KEY_EVENT
    instance Enum Key where
      succ KEY_CODE_YES = KEY_DOWN
      succ KEY_DOWN = KEY_UP
      succ KEY_UP = KEY_LEFT
      succ KEY_LEFT = KEY_RIGHT
      succ KEY_RIGHT = KEY_HOME
      succ KEY_HOME = KEY_BACKSPACE
      succ KEY_BACKSPACE = KEY_F0
      succ KEY_F0 = KEY_DL
      succ KEY_DL = KEY_IL
      succ KEY_IL = KEY_DC
      succ KEY_DC = KEY_IC
      succ KEY_IC = KEY_EIC
      succ KEY_EIC = KEY_CLEAR
      succ KEY_CLEAR = KEY_EOS
      succ KEY_EOS = KEY_EOL
      succ KEY_EOL = KEY_SF
      succ KEY_SF = KEY_SR
      succ KEY_SR = KEY_NPAGE
      succ KEY_NPAGE = KEY_PPAGE
      succ KEY_PPAGE = KEY_STAB
      succ KEY_STAB = KEY_CTAB
      succ KEY_CTAB = KEY_CATAB
      succ KEY_CATAB = KEY_ENTER
      succ KEY_ENTER = KEY_PRINT
      succ KEY_PRINT = KEY_LL
      succ KEY_LL = KEY_A1
      succ KEY_A1 = KEY_A3
      succ KEY_A3 = KEY_B2
      succ KEY_B2 = KEY_C1
      succ KEY_C1 = KEY_C3
      succ KEY_C3 = KEY_BTAB
      succ KEY_BTAB = KEY_BEG
      succ KEY_BEG = KEY_CANCEL
      succ KEY_CANCEL = KEY_CLOSE
      succ KEY_CLOSE = KEY_COMMAND
      succ KEY_COMMAND = KEY_COPY
      succ KEY_COPY = KEY_CREATE
      succ KEY_CREATE = KEY_END
      succ KEY_END = KEY_EXIT
      succ KEY_EXIT = KEY_FIND
      succ KEY_FIND = KEY_HELP
      succ KEY_HELP = KEY_MARK
      succ KEY_MARK = KEY_MESSAGE
      succ KEY_MESSAGE = KEY_MOVE
      succ KEY_MOVE = KEY_NEXT
      succ KEY_NEXT = KEY_OPEN
      succ KEY_OPEN = KEY_OPTIONS
      succ KEY_OPTIONS = KEY_PREVIOUS
      succ KEY_PREVIOUS = KEY_REDO
      succ KEY_REDO = KEY_REFERENCE
      succ KEY_REFERENCE = KEY_REFRESH
      succ KEY_REFRESH = KEY_REPLACE
      succ KEY_REPLACE = KEY_RESTART
      succ KEY_RESTART = KEY_RESUME
      succ KEY_RESUME = KEY_SAVE
      succ KEY_SAVE = KEY_SBEG
      succ KEY_SBEG = KEY_SCANCEL
      succ KEY_SCANCEL = KEY_SCOMMAND
      succ KEY_SCOMMAND = KEY_SCOPY
      succ KEY_SCOPY = KEY_SCREATE
      succ KEY_SCREATE = KEY_SDC
      succ KEY_SDC = KEY_SDL
      succ KEY_SDL = KEY_SELECT
      succ KEY_SELECT = KEY_SEND
      succ KEY_SEND = KEY_SEOL
      succ KEY_SEOL = KEY_SEXIT
      succ KEY_SEXIT = KEY_SFIND
      succ KEY_SFIND = KEY_SHELP
      succ KEY_SHELP = KEY_SHOME
      succ KEY_SHOME = KEY_SIC
      succ KEY_SIC = KEY_SLEFT
      succ KEY_SLEFT = KEY_SMESSAGE
      succ KEY_SMESSAGE = KEY_SMOVE
      succ KEY_SMOVE = KEY_SNEXT
      succ KEY_SNEXT = KEY_SOPTIONS
      succ KEY_SOPTIONS = KEY_SPREVIOUS
      succ KEY_SPREVIOUS = KEY_SPRINT
      succ KEY_SPRINT = KEY_SREDO
      succ KEY_SREDO = KEY_SREPLACE
      succ KEY_SREPLACE = KEY_SRIGHT
      succ KEY_SRIGHT = KEY_SRSUME
      succ KEY_SRSUME = KEY_SSAVE
      succ KEY_SSAVE = KEY_SSUSPEND
      succ KEY_SSUSPEND = KEY_SUNDO
      succ KEY_SUNDO = KEY_SUSPEND
      succ KEY_SUSPEND = KEY_UNDO
      succ KEY_UNDO = KEY_MOUSE
      succ KEY_MOUSE = KEY_RESIZE
      succ KEY_RESIZE = KEY_EVENT
      succ KEY_EVENT = error "Key.succ: KEY_EVENT has no successor"

      pred KEY_DOWN = KEY_CODE_YES
      pred KEY_UP = KEY_DOWN
      pred KEY_LEFT = KEY_UP
      pred KEY_RIGHT = KEY_LEFT
      pred KEY_HOME = KEY_RIGHT
      pred KEY_BACKSPACE = KEY_HOME
      pred KEY_F0 = KEY_BACKSPACE
      pred KEY_DL = KEY_F0
      pred KEY_IL = KEY_DL
      pred KEY_DC = KEY_IL
      pred KEY_IC = KEY_DC
      pred KEY_EIC = KEY_IC
      pred KEY_CLEAR = KEY_EIC
      pred KEY_EOS = KEY_CLEAR
      pred KEY_EOL = KEY_EOS
      pred KEY_SF = KEY_EOL
      pred KEY_SR = KEY_SF
      pred KEY_NPAGE = KEY_SR
      pred KEY_PPAGE = KEY_NPAGE
      pred KEY_STAB = KEY_PPAGE
      pred KEY_CTAB = KEY_STAB
      pred KEY_CATAB = KEY_CTAB
      pred KEY_ENTER = KEY_CATAB
      pred KEY_PRINT = KEY_ENTER
      pred KEY_LL = KEY_PRINT
      pred KEY_A1 = KEY_LL
      pred KEY_A3 = KEY_A1
      pred KEY_B2 = KEY_A3
      pred KEY_C1 = KEY_B2
      pred KEY_C3 = KEY_C1
      pred KEY_BTAB = KEY_C3
      pred KEY_BEG = KEY_BTAB
      pred KEY_CANCEL = KEY_BEG
      pred KEY_CLOSE = KEY_CANCEL
      pred KEY_COMMAND = KEY_CLOSE
      pred KEY_COPY = KEY_COMMAND
      pred KEY_CREATE = KEY_COPY
      pred KEY_END = KEY_CREATE
      pred KEY_EXIT = KEY_END
      pred KEY_FIND = KEY_EXIT
      pred KEY_HELP = KEY_FIND
      pred KEY_MARK = KEY_HELP
      pred KEY_MESSAGE = KEY_MARK
      pred KEY_MOVE = KEY_MESSAGE
      pred KEY_NEXT = KEY_MOVE
      pred KEY_OPEN = KEY_NEXT
      pred KEY_OPTIONS = KEY_OPEN
      pred KEY_PREVIOUS = KEY_OPTIONS
      pred KEY_REDO = KEY_PREVIOUS
      pred KEY_REFERENCE = KEY_REDO
      pred KEY_REFRESH = KEY_REFERENCE
      pred KEY_REPLACE = KEY_REFRESH
      pred KEY_RESTART = KEY_REPLACE
      pred KEY_RESUME = KEY_RESTART
      pred KEY_SAVE = KEY_RESUME
      pred KEY_SBEG = KEY_SAVE
      pred KEY_SCANCEL = KEY_SBEG
      pred KEY_SCOMMAND = KEY_SCANCEL
      pred KEY_SCOPY = KEY_SCOMMAND
      pred KEY_SCREATE = KEY_SCOPY
      pred KEY_SDC = KEY_SCREATE
      pred KEY_SDL = KEY_SDC
      pred KEY_SELECT = KEY_SDL
      pred KEY_SEND = KEY_SELECT
      pred KEY_SEOL = KEY_SEND
      pred KEY_SEXIT = KEY_SEOL
      pred KEY_SFIND = KEY_SEXIT
      pred KEY_SHELP = KEY_SFIND
      pred KEY_SHOME = KEY_SHELP
      pred KEY_SIC = KEY_SHOME
      pred KEY_SLEFT = KEY_SIC
      pred KEY_SMESSAGE = KEY_SLEFT
      pred KEY_SMOVE = KEY_SMESSAGE
      pred KEY_SNEXT = KEY_SMOVE
      pred KEY_SOPTIONS = KEY_SNEXT
      pred KEY_SPREVIOUS = KEY_SOPTIONS
      pred KEY_SPRINT = KEY_SPREVIOUS
      pred KEY_SREDO = KEY_SPRINT
      pred KEY_SREPLACE = KEY_SREDO
      pred KEY_SRIGHT = KEY_SREPLACE
      pred KEY_SRSUME = KEY_SRIGHT
      pred KEY_SSAVE = KEY_SRSUME
      pred KEY_SSUSPEND = KEY_SSAVE
      pred KEY_SUNDO = KEY_SSUSPEND
      pred KEY_SUSPEND = KEY_SUNDO
      pred KEY_UNDO = KEY_SUSPEND
      pred KEY_MOUSE = KEY_UNDO
      pred KEY_RESIZE = KEY_MOUSE
      pred KEY_EVENT = KEY_RESIZE
      pred KEY_CODE_YES = error "Key.pred: KEY_CODE_YES 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 KEY_EVENT

      fromEnum KEY_CODE_YES = 256
      fromEnum KEY_DOWN = 258
      fromEnum KEY_UP = 259
      fromEnum KEY_LEFT = 260
      fromEnum KEY_RIGHT = 261
      fromEnum KEY_HOME = 262
      fromEnum KEY_BACKSPACE = 263
      fromEnum KEY_F0 = 264
      fromEnum KEY_DL = 328
      fromEnum KEY_IL = 329
      fromEnum KEY_DC = 330
      fromEnum KEY_IC = 331
      fromEnum KEY_EIC = 332
      fromEnum KEY_CLEAR = 333
      fromEnum KEY_EOS = 334
      fromEnum KEY_EOL = 335
      fromEnum KEY_SF = 336
      fromEnum KEY_SR = 337
      fromEnum KEY_NPAGE = 338
      fromEnum KEY_PPAGE = 339
      fromEnum KEY_STAB = 340
      fromEnum KEY_CTAB = 341
      fromEnum KEY_CATAB = 342
      fromEnum KEY_ENTER = 343
      fromEnum KEY_PRINT = 346
      fromEnum KEY_LL = 347
      fromEnum KEY_A1 = 348
      fromEnum KEY_A3 = 349
      fromEnum KEY_B2 = 350
      fromEnum KEY_C1 = 351
      fromEnum KEY_C3 = 352
      fromEnum KEY_BTAB = 353
      fromEnum KEY_BEG = 354
      fromEnum KEY_CANCEL = 355
      fromEnum KEY_CLOSE = 356
      fromEnum KEY_COMMAND = 357
      fromEnum KEY_COPY = 358
      fromEnum KEY_CREATE = 359
      fromEnum KEY_END = 360
      fromEnum KEY_EXIT = 361
      fromEnum KEY_FIND = 362
      fromEnum KEY_HELP = 363
      fromEnum KEY_MARK = 364
      fromEnum KEY_MESSAGE = 365
      fromEnum KEY_MOVE = 366
      fromEnum KEY_NEXT = 367
      fromEnum KEY_OPEN = 368
      fromEnum KEY_OPTIONS = 369
      fromEnum KEY_PREVIOUS = 370
      fromEnum KEY_REDO = 371
      fromEnum KEY_REFERENCE = 372
      fromEnum KEY_REFRESH = 373
      fromEnum KEY_REPLACE = 374
      fromEnum KEY_RESTART = 375
      fromEnum KEY_RESUME = 376
      fromEnum KEY_SAVE = 377
      fromEnum KEY_SBEG = 378
      fromEnum KEY_SCANCEL = 379
      fromEnum KEY_SCOMMAND = 380
      fromEnum KEY_SCOPY = 381
      fromEnum KEY_SCREATE = 382
      fromEnum KEY_SDC = 383
      fromEnum KEY_SDL = 384
      fromEnum KEY_SELECT = 385
      fromEnum KEY_SEND = 386
      fromEnum KEY_SEOL = 387
      fromEnum KEY_SEXIT = 388
      fromEnum KEY_SFIND = 389
      fromEnum KEY_SHELP = 390
      fromEnum KEY_SHOME = 391
      fromEnum KEY_SIC = 392
      fromEnum KEY_SLEFT = 393
      fromEnum KEY_SMESSAGE = 394
      fromEnum KEY_SMOVE = 395
      fromEnum KEY_SNEXT = 396
      fromEnum KEY_SOPTIONS = 397
      fromEnum KEY_SPREVIOUS = 398
      fromEnum KEY_SPRINT = 399
      fromEnum KEY_SREDO = 400
      fromEnum KEY_SREPLACE = 401
      fromEnum KEY_SRIGHT = 402
      fromEnum KEY_SRSUME = 403
      fromEnum KEY_SSAVE = 404
      fromEnum KEY_SSUSPEND = 405
      fromEnum KEY_SUNDO = 406
      fromEnum KEY_SUSPEND = 407
      fromEnum KEY_UNDO = 408
      fromEnum KEY_MOUSE = 409
      fromEnum KEY_RESIZE = 410
      fromEnum KEY_EVENT = 411

      toEnum 256 = KEY_CODE_YES
      toEnum 258 = KEY_DOWN
      toEnum 259 = KEY_UP
      toEnum 260 = KEY_LEFT
      toEnum 261 = KEY_RIGHT
      toEnum 262 = KEY_HOME
      toEnum 263 = KEY_BACKSPACE
      toEnum 264 = KEY_F0
      toEnum 328 = KEY_DL
      toEnum 329 = KEY_IL
      toEnum 330 = KEY_DC
      toEnum 331 = KEY_IC
      toEnum 332 = KEY_EIC
      toEnum 333 = KEY_CLEAR
      toEnum 334 = KEY_EOS
      toEnum 335 = KEY_EOL
      toEnum 336 = KEY_SF
      toEnum 337 = KEY_SR
      toEnum 338 = KEY_NPAGE
      toEnum 339 = KEY_PPAGE
      toEnum 340 = KEY_STAB
      toEnum 341 = KEY_CTAB
      toEnum 342 = KEY_CATAB
      toEnum 343 = KEY_ENTER
      toEnum 346 = KEY_PRINT
      toEnum 347 = KEY_LL
      toEnum 348 = KEY_A1
      toEnum 349 = KEY_A3
      toEnum 350 = KEY_B2
      toEnum 351 = KEY_C1
      toEnum 352 = KEY_C3
      toEnum 353 = KEY_BTAB
      toEnum 354 = KEY_BEG
      toEnum 355 = KEY_CANCEL
      toEnum 356 = KEY_CLOSE
      toEnum 357 = KEY_COMMAND
      toEnum 358 = KEY_COPY
      toEnum 359 = KEY_CREATE
      toEnum 360 = KEY_END
      toEnum 361 = KEY_EXIT
      toEnum 362 = KEY_FIND
      toEnum 363 = KEY_HELP
      toEnum 364 = KEY_MARK
      toEnum 365 = KEY_MESSAGE
      toEnum 366 = KEY_MOVE
      toEnum 367 = KEY_NEXT
      toEnum 368 = KEY_OPEN
      toEnum 369 = KEY_OPTIONS
      toEnum 370 = KEY_PREVIOUS
      toEnum 371 = KEY_REDO
      toEnum 372 = KEY_REFERENCE
      toEnum 373 = KEY_REFRESH
      toEnum 374 = KEY_REPLACE
      toEnum 375 = KEY_RESTART
      toEnum 376 = KEY_RESUME
      toEnum 377 = KEY_SAVE
      toEnum 378 = KEY_SBEG
      toEnum 379 = KEY_SCANCEL
      toEnum 380 = KEY_SCOMMAND
      toEnum 381 = KEY_SCOPY
      toEnum 382 = KEY_SCREATE
      toEnum 383 = KEY_SDC
      toEnum 384 = KEY_SDL
      toEnum 385 = KEY_SELECT
      toEnum 386 = KEY_SEND
      toEnum 387 = KEY_SEOL
      toEnum 388 = KEY_SEXIT
      toEnum 389 = KEY_SFIND
      toEnum 390 = KEY_SHELP
      toEnum 391 = KEY_SHOME
      toEnum 392 = KEY_SIC
      toEnum 393 = KEY_SLEFT
      toEnum 394 = KEY_SMESSAGE
      toEnum 395 = KEY_SMOVE
      toEnum 396 = KEY_SNEXT
      toEnum 397 = KEY_SOPTIONS
      toEnum 398 = KEY_SPREVIOUS
      toEnum 399 = KEY_SPRINT
      toEnum 400 = KEY_SREDO
      toEnum 401 = KEY_SREPLACE
      toEnum 402 = KEY_SRIGHT
      toEnum 403 = KEY_SRSUME
      toEnum 404 = KEY_SSAVE
      toEnum 405 = KEY_SSUSPEND
      toEnum 406 = KEY_SUNDO
      toEnum 407 = KEY_SUSPEND
      toEnum 408 = KEY_UNDO
      toEnum 409 = KEY_MOUSE
      toEnum 410 = KEY_RESIZE
      toEnum 411 = KEY_EVENT
      toEnum unmatched = error ("Key.toEnum: Cannot match " ++ show unmatched)

    {-# LINE 192 "lib/UI/NCurses/Enums.chs" #-}

    -- mouse buttons
    data Button = BUTTON1_RELEASED
                | BUTTON1_PRESSED
                | BUTTON1_CLICKED
                | BUTTON1_DOUBLE_CLICKED
                | BUTTON1_TRIPLE_CLICKED
                | BUTTON2_RELEASED
                | BUTTON2_PRESSED
                | BUTTON2_CLICKED
                | BUTTON2_DOUBLE_CLICKED
                | BUTTON2_TRIPLE_CLICKED
                | BUTTON3_RELEASED
                | BUTTON3_PRESSED
                | BUTTON3_CLICKED
                | BUTTON3_DOUBLE_CLICKED
                | BUTTON3_TRIPLE_CLICKED
                | BUTTON4_RELEASED
                | BUTTON4_PRESSED
                | BUTTON4_CLICKED
                | BUTTON4_DOUBLE_CLICKED
                | BUTTON4_TRIPLE_CLICKED
                | BUTTON_CTRL
                | BUTTON_SHIFT
                | BUTTON_ALT
    instance Enum Button where
      succ BUTTON1_RELEASED = BUTTON1_PRESSED
      succ BUTTON1_PRESSED = BUTTON1_CLICKED
      succ BUTTON1_CLICKED = BUTTON1_DOUBLE_CLICKED
      succ BUTTON1_DOUBLE_CLICKED = BUTTON1_TRIPLE_CLICKED
      succ BUTTON1_TRIPLE_CLICKED = BUTTON2_RELEASED
      succ BUTTON2_RELEASED = BUTTON2_PRESSED
      succ BUTTON2_PRESSED = BUTTON2_CLICKED
      succ BUTTON2_CLICKED = BUTTON2_DOUBLE_CLICKED
      succ BUTTON2_DOUBLE_CLICKED = BUTTON2_TRIPLE_CLICKED
      succ BUTTON2_TRIPLE_CLICKED = BUTTON3_RELEASED
      succ BUTTON3_RELEASED = BUTTON3_PRESSED
      succ BUTTON3_PRESSED = BUTTON3_CLICKED
      succ BUTTON3_CLICKED = BUTTON3_DOUBLE_CLICKED
      succ BUTTON3_DOUBLE_CLICKED = BUTTON3_TRIPLE_CLICKED
      succ BUTTON3_TRIPLE_CLICKED = BUTTON4_RELEASED
      succ BUTTON4_RELEASED = BUTTON4_PRESSED
      succ BUTTON4_PRESSED = BUTTON4_CLICKED
      succ BUTTON4_CLICKED = BUTTON4_DOUBLE_CLICKED
      succ BUTTON4_DOUBLE_CLICKED = BUTTON4_TRIPLE_CLICKED
      succ BUTTON4_TRIPLE_CLICKED = BUTTON_CTRL
      succ BUTTON_CTRL = BUTTON_SHIFT
      succ BUTTON_SHIFT = BUTTON_ALT
      succ BUTTON_ALT = error "Button.succ: BUTTON_ALT has no successor"

      pred BUTTON1_PRESSED = BUTTON1_RELEASED
      pred BUTTON1_CLICKED = BUTTON1_PRESSED
      pred BUTTON1_DOUBLE_CLICKED = BUTTON1_CLICKED
      pred BUTTON1_TRIPLE_CLICKED = BUTTON1_DOUBLE_CLICKED
      pred BUTTON2_RELEASED = BUTTON1_TRIPLE_CLICKED
      pred BUTTON2_PRESSED = BUTTON2_RELEASED
      pred BUTTON2_CLICKED = BUTTON2_PRESSED
      pred BUTTON2_DOUBLE_CLICKED = BUTTON2_CLICKED
      pred BUTTON2_TRIPLE_CLICKED = BUTTON2_DOUBLE_CLICKED
      pred BUTTON3_RELEASED = BUTTON2_TRIPLE_CLICKED
      pred BUTTON3_PRESSED = BUTTON3_RELEASED
      pred BUTTON3_CLICKED = BUTTON3_PRESSED
      pred BUTTON3_DOUBLE_CLICKED = BUTTON3_CLICKED
      pred BUTTON3_TRIPLE_CLICKED = BUTTON3_DOUBLE_CLICKED
      pred BUTTON4_RELEASED = BUTTON3_TRIPLE_CLICKED
      pred BUTTON4_PRESSED = BUTTON4_RELEASED
      pred BUTTON4_CLICKED = BUTTON4_PRESSED
      pred BUTTON4_DOUBLE_CLICKED = BUTTON4_CLICKED
      pred BUTTON4_TRIPLE_CLICKED = BUTTON4_DOUBLE_CLICKED
      pred BUTTON_CTRL = BUTTON4_TRIPLE_CLICKED
      pred BUTTON_SHIFT = BUTTON_CTRL
      pred BUTTON_ALT = BUTTON_SHIFT
      pred BUTTON1_RELEASED = error "Button.pred: BUTTON1_RELEASED 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 BUTTON_ALT

      fromEnum BUTTON1_RELEASED = 1
      fromEnum BUTTON1_PRESSED = 2
      fromEnum BUTTON1_CLICKED = 4
      fromEnum BUTTON1_DOUBLE_CLICKED = 8
      fromEnum BUTTON1_TRIPLE_CLICKED = 16
      fromEnum BUTTON2_RELEASED = 64
      fromEnum BUTTON2_PRESSED = 128
      fromEnum BUTTON2_CLICKED = 256
      fromEnum BUTTON2_DOUBLE_CLICKED = 512
      fromEnum BUTTON2_TRIPLE_CLICKED = 1024
      fromEnum BUTTON3_RELEASED = 4096
      fromEnum BUTTON3_PRESSED = 8192
      fromEnum BUTTON3_CLICKED = 16384
      fromEnum BUTTON3_DOUBLE_CLICKED = 32768
      fromEnum BUTTON3_TRIPLE_CLICKED = 65536
      fromEnum BUTTON4_RELEASED = 262144
      fromEnum BUTTON4_PRESSED = 524288
      fromEnum BUTTON4_CLICKED = 1048576
      fromEnum BUTTON4_DOUBLE_CLICKED = 2097152
      fromEnum BUTTON4_TRIPLE_CLICKED = 4194304
      fromEnum BUTTON_CTRL = 16777216
      fromEnum BUTTON_SHIFT = 33554432
      fromEnum BUTTON_ALT = 67108864

      toEnum 1 = BUTTON1_RELEASED
      toEnum 2 = BUTTON1_PRESSED
      toEnum 4 = BUTTON1_CLICKED
      toEnum 8 = BUTTON1_DOUBLE_CLICKED
      toEnum 16 = BUTTON1_TRIPLE_CLICKED
      toEnum 64 = BUTTON2_RELEASED
      toEnum 128 = BUTTON2_PRESSED
      toEnum 256 = BUTTON2_CLICKED
      toEnum 512 = BUTTON2_DOUBLE_CLICKED
      toEnum 1024 = BUTTON2_TRIPLE_CLICKED
      toEnum 4096 = BUTTON3_RELEASED
      toEnum 8192 = BUTTON3_PRESSED
      toEnum 16384 = BUTTON3_CLICKED
      toEnum 32768 = BUTTON3_DOUBLE_CLICKED
      toEnum 65536 = BUTTON3_TRIPLE_CLICKED
      toEnum 262144 = BUTTON4_RELEASED
      toEnum 524288 = BUTTON4_PRESSED
      toEnum 1048576 = BUTTON4_CLICKED
      toEnum 2097152 = BUTTON4_DOUBLE_CLICKED
      toEnum 4194304 = BUTTON4_TRIPLE_CLICKED
      toEnum 16777216 = BUTTON_CTRL
      toEnum 33554432 = BUTTON_SHIFT
      toEnum 67108864 = BUTTON_ALT
      toEnum unmatched = error ("Button.toEnum: Cannot match " ++ show unmatched)

    {-# LINE 234 "lib/UI/NCurses/Enums.chs" #-}