{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeSynonymInstances #-}

module Data.SpirV.Enum.LinkageType where

import Data.Word (Word32)
import Foreign.Storable (Storable)

newtype LinkageType = LinkageType Word32
  deriving newtype (LinkageType -> LinkageType -> Bool
(LinkageType -> LinkageType -> Bool)
-> (LinkageType -> LinkageType -> Bool) -> Eq LinkageType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LinkageType -> LinkageType -> Bool
== :: LinkageType -> LinkageType -> Bool
$c/= :: LinkageType -> LinkageType -> Bool
/= :: LinkageType -> LinkageType -> Bool
Eq, Eq LinkageType
Eq LinkageType =>
(LinkageType -> LinkageType -> Ordering)
-> (LinkageType -> LinkageType -> Bool)
-> (LinkageType -> LinkageType -> Bool)
-> (LinkageType -> LinkageType -> Bool)
-> (LinkageType -> LinkageType -> Bool)
-> (LinkageType -> LinkageType -> LinkageType)
-> (LinkageType -> LinkageType -> LinkageType)
-> Ord LinkageType
LinkageType -> LinkageType -> Bool
LinkageType -> LinkageType -> Ordering
LinkageType -> LinkageType -> LinkageType
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 :: LinkageType -> LinkageType -> Ordering
compare :: LinkageType -> LinkageType -> Ordering
$c< :: LinkageType -> LinkageType -> Bool
< :: LinkageType -> LinkageType -> Bool
$c<= :: LinkageType -> LinkageType -> Bool
<= :: LinkageType -> LinkageType -> Bool
$c> :: LinkageType -> LinkageType -> Bool
> :: LinkageType -> LinkageType -> Bool
$c>= :: LinkageType -> LinkageType -> Bool
>= :: LinkageType -> LinkageType -> Bool
$cmax :: LinkageType -> LinkageType -> LinkageType
max :: LinkageType -> LinkageType -> LinkageType
$cmin :: LinkageType -> LinkageType -> LinkageType
min :: LinkageType -> LinkageType -> LinkageType
Ord, Ptr LinkageType -> IO LinkageType
Ptr LinkageType -> Int -> IO LinkageType
Ptr LinkageType -> Int -> LinkageType -> IO ()
Ptr LinkageType -> LinkageType -> IO ()
LinkageType -> Int
(LinkageType -> Int)
-> (LinkageType -> Int)
-> (Ptr LinkageType -> Int -> IO LinkageType)
-> (Ptr LinkageType -> Int -> LinkageType -> IO ())
-> (forall b. Ptr b -> Int -> IO LinkageType)
-> (forall b. Ptr b -> Int -> LinkageType -> IO ())
-> (Ptr LinkageType -> IO LinkageType)
-> (Ptr LinkageType -> LinkageType -> IO ())
-> Storable LinkageType
forall b. Ptr b -> Int -> IO LinkageType
forall b. Ptr b -> Int -> LinkageType -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
$csizeOf :: LinkageType -> Int
sizeOf :: LinkageType -> Int
$calignment :: LinkageType -> Int
alignment :: LinkageType -> Int
$cpeekElemOff :: Ptr LinkageType -> Int -> IO LinkageType
peekElemOff :: Ptr LinkageType -> Int -> IO LinkageType
$cpokeElemOff :: Ptr LinkageType -> Int -> LinkageType -> IO ()
pokeElemOff :: Ptr LinkageType -> Int -> LinkageType -> IO ()
$cpeekByteOff :: forall b. Ptr b -> Int -> IO LinkageType
peekByteOff :: forall b. Ptr b -> Int -> IO LinkageType
$cpokeByteOff :: forall b. Ptr b -> Int -> LinkageType -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> LinkageType -> IO ()
$cpeek :: Ptr LinkageType -> IO LinkageType
peek :: Ptr LinkageType -> IO LinkageType
$cpoke :: Ptr LinkageType -> LinkageType -> IO ()
poke :: Ptr LinkageType -> LinkageType -> IO ()
Storable)

instance Show LinkageType where
  showsPrec :: Int -> LinkageType -> ShowS
showsPrec Int
p (LinkageType Word32
v) = case Word32
v of
    Word32
0 -> String -> ShowS
showString String
"Export"
    Word32
1 -> String -> ShowS
showString String
"Import"
    Word32
2 -> String -> ShowS
showString String
"LinkOnceODR"
    Word32
x -> Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ String -> ShowS
showString String
"LinkageType " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Word32 -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec (Int
p Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) Word32
x

pattern Export :: LinkageType
pattern $mExport :: forall {r}. LinkageType -> ((# #) -> r) -> ((# #) -> r) -> r
$bExport :: LinkageType
Export = LinkageType 0

pattern Import :: LinkageType
pattern $mImport :: forall {r}. LinkageType -> ((# #) -> r) -> ((# #) -> r) -> r
$bImport :: LinkageType
Import = LinkageType 1

pattern LinkOnceODR :: LinkageType
pattern $mLinkOnceODR :: forall {r}. LinkageType -> ((# #) -> r) -> ((# #) -> r) -> r
$bLinkOnceODR :: LinkageType
LinkOnceODR = LinkageType 2