    {-# OPTIONS_HADDOCK hide #-}
    --------------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.OpenGL.GL.ComparisonFunction
    -- Copyright   :  (c) Sven Panne 2002-2019
    -- License     :  BSD3
    --
    -- Maintainer  :  Sven Panne <svenpanne@gmail.com>
    -- Stability   :  stable
    -- Portability :  portable
    --
    -- This is a purely internal module for (un-)marshaling ComparisonFunction.
    --
    --------------------------------------------------------------------------------

    module Graphics.Rendering.OpenGL.GL.ComparisonFunction (
       ComparisonFunction(..), marshalComparisonFunction,
       unmarshalComparisonFunction
    ) where

    import Graphics.GL

    --------------------------------------------------------------------------------

    data ComparisonFunction =
         Never
       | Less
       | Equal
       | Lequal
       | Greater
       | Notequal
       | Gequal
       | Always
       deriving ( ComparisonFunction -> ComparisonFunction -> Bool
    (ComparisonFunction -> ComparisonFunction -> Bool)
    -> (ComparisonFunction -> ComparisonFunction -> Bool)
    -> Eq ComparisonFunction
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ComparisonFunction -> ComparisonFunction -> Bool
    == :: ComparisonFunction -> ComparisonFunction -> Bool
    $c/= :: ComparisonFunction -> ComparisonFunction -> Bool
    /= :: ComparisonFunction -> ComparisonFunction -> Bool
    Eq, Eq ComparisonFunction
    Eq ComparisonFunction =>
    (ComparisonFunction -> ComparisonFunction -> Ordering)
    -> (ComparisonFunction -> ComparisonFunction -> Bool)
    -> (ComparisonFunction -> ComparisonFunction -> Bool)
    -> (ComparisonFunction -> ComparisonFunction -> Bool)
    -> (ComparisonFunction -> ComparisonFunction -> Bool)
    -> (ComparisonFunction -> ComparisonFunction -> ComparisonFunction)
    -> (ComparisonFunction -> ComparisonFunction -> ComparisonFunction)
    -> Ord ComparisonFunction
    ComparisonFunction -> ComparisonFunction -> Bool
    ComparisonFunction -> ComparisonFunction -> Ordering
    ComparisonFunction -> ComparisonFunction -> ComparisonFunction
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: ComparisonFunction -> ComparisonFunction -> Ordering
    compare :: ComparisonFunction -> ComparisonFunction -> Ordering
    $c< :: ComparisonFunction -> ComparisonFunction -> Bool
    < :: ComparisonFunction -> ComparisonFunction -> Bool
    $c<= :: ComparisonFunction -> ComparisonFunction -> Bool
    <= :: ComparisonFunction -> ComparisonFunction -> Bool
    $c> :: ComparisonFunction -> ComparisonFunction -> Bool
    > :: ComparisonFunction -> ComparisonFunction -> Bool
    $c>= :: ComparisonFunction -> ComparisonFunction -> Bool
    >= :: ComparisonFunction -> ComparisonFunction -> Bool
    $cmax :: ComparisonFunction -> ComparisonFunction -> ComparisonFunction
    max :: ComparisonFunction -> ComparisonFunction -> ComparisonFunction
    $cmin :: ComparisonFunction -> ComparisonFunction -> ComparisonFunction
    min :: ComparisonFunction -> ComparisonFunction -> ComparisonFunction
    Ord, Int -> ComparisonFunction -> ShowS
    [ComparisonFunction] -> ShowS
    ComparisonFunction -> String
    (Int -> ComparisonFunction -> ShowS)
    -> (ComparisonFunction -> String)
    -> ([ComparisonFunction] -> ShowS)
    -> Show ComparisonFunction
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ComparisonFunction -> ShowS
    showsPrec :: Int -> ComparisonFunction -> ShowS
    $cshow :: ComparisonFunction -> String
    show :: ComparisonFunction -> String
    $cshowList :: [ComparisonFunction] -> ShowS
    showList :: [ComparisonFunction] -> ShowS
    Show )

    marshalComparisonFunction :: ComparisonFunction -> GLenum
    marshalComparisonFunction :: ComparisonFunction -> GLenum
    marshalComparisonFunction ComparisonFunction
    x = case ComparisonFunction
    x of
       ComparisonFunction
    Never -> GLenum
    GL_NEVER
       ComparisonFunction
    Less -> GLenum
    GL_LESS
       ComparisonFunction
    Equal -> GLenum
    GL_EQUAL
       ComparisonFunction
    Lequal -> GLenum
    GL_LEQUAL
       ComparisonFunction
    Greater -> GLenum
    GL_GREATER
       ComparisonFunction
    Notequal -> GLenum
    GL_NOTEQUAL
       ComparisonFunction
    Gequal -> GLenum
    GL_GEQUAL
       ComparisonFunction
    Always -> GLenum
    GL_ALWAYS

    unmarshalComparisonFunction :: GLenum -> ComparisonFunction
    unmarshalComparisonFunction :: GLenum -> ComparisonFunction
    unmarshalComparisonFunction GLenum
    x
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_NEVER = ComparisonFunction
    Never
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_LESS = ComparisonFunction
    Less
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_EQUAL = ComparisonFunction
    Equal
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_LEQUAL = ComparisonFunction
    Lequal
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_GREATER = ComparisonFunction
    Greater
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_NOTEQUAL = ComparisonFunction
    Notequal
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_GEQUAL = ComparisonFunction
    Gequal
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_ALWAYS = ComparisonFunction
    Always
       | Bool
    otherwise = String -> ComparisonFunction
    forall a. HasCallStack => String -> a
    error (String
    "unmarshalComparisonFunction: illegal value " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ GLenum -> String
    forall a. Show a => a -> String
    show GLenum
    x)