-- GENERATED by C->Haskell Compiler, version 0.17.2 Crystal Seed, 24 Jan 2009 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "lib/CPython/Constants.chs" #-}
{-# LANGUAGE ForeignFunctionInterface #-}

-- Copyright (C) 2009 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/>.

module CPython.Constants
	( none
	, true
	, false
	, isNone
	, isTrue
	, isFalse
	) where



import           CPython.Internal

-- | The Python @None@ object, denoting lack of value.
none :: IO ((SomeObject))
none =
  none'_ >>= \res ->
  peekObject res >>= \res' ->
  return (res')

{-# LINE 33 "lib/CPython/Constants.chs" #-}


-- | The Python @True@ object.
true :: IO ((SomeObject))
true =
  true'_ >>= \res ->
  peekObject res >>= \res' ->
  return (res')

{-# LINE 37 "lib/CPython/Constants.chs" #-}


-- | The Python @False@ object.
false :: IO ((SomeObject))
false =
  false'_ >>= \res ->
  peekObject res >>= \res' ->
  return (res')

{-# LINE 41 "lib/CPython/Constants.chs" #-}


rawNone :: (Ptr ())
rawNone =
  let {res = rawNone'_} in
  let {res' = id res} in
  (res')

{-# LINE 44 "lib/CPython/Constants.chs" #-}


rawTrue :: (Ptr ())
rawTrue =
  let {res = rawTrue'_} in
  let {res' = id res} in
  (res')

{-# LINE 47 "lib/CPython/Constants.chs" #-}


rawFalse :: (Ptr ())
rawFalse =
  let {res = rawFalse'_} in
  let {res' = id res} in
  (res')

{-# LINE 50 "lib/CPython/Constants.chs" #-}


isNone :: SomeObject -> IO Bool
isNone obj = withObject obj $ \ptr -> return $ ptr == rawNone

isTrue :: SomeObject -> IO Bool
isTrue obj = withObject obj $ \ptr -> return $ ptr == rawTrue

isFalse :: SomeObject -> IO Bool
isFalse obj = withObject obj $ \ptr -> return $ ptr == rawFalse

foreign import ccall unsafe "CPython/Constants.chs.h hscpython_Py_None"
  none'_ :: (IO (Ptr ()))

foreign import ccall unsafe "CPython/Constants.chs.h hscpython_Py_True"
  true'_ :: (IO (Ptr ()))

foreign import ccall unsafe "CPython/Constants.chs.h hscpython_Py_False"
  false'_ :: (IO (Ptr ()))

foreign import ccall unsafe "CPython/Constants.chs.h hscpython_Py_None"
  rawNone'_ :: (Ptr ())

foreign import ccall unsafe "CPython/Constants.chs.h hscpython_Py_True"
  rawTrue'_ :: (Ptr ())

foreign import ccall unsafe "CPython/Constants.chs.h hscpython_Py_False"
  rawFalse'_ :: (Ptr ())