packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/GPUShaderModuleDescriptor.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webgpu (webref). Do not edit.
module JSDOM.Generated.GPUShaderModuleDescriptor
       (newGPUShaderModuleDescriptor, setCode, getCode, setCompilationHints, getCompilationHints, getCompilationHintsUnsafe, getCompilationHintsUnchecked, GPUShaderModuleDescriptor(..), gTypeGPUShaderModuleDescriptor)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums

-- | <https://gpuweb.github.io/gpuweb/#dictdef-gpushadermoduledescriptor GPUShaderModuleDescriptor specification>
newGPUShaderModuleDescriptor :: (MonadDOM m, ToJSString code) => code -> m GPUShaderModuleDescriptor
newGPUShaderModuleDescriptor code = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "code" (toJSVal code)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpushadermoduledescriptor-code GPUShaderModuleDescriptor.code specification>
setCode :: (MonadDOM m, ToJSString val) => GPUShaderModuleDescriptor -> val -> m ()
setCode self val = liftDOM (void (self ^. jss "code" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpushadermoduledescriptor-code GPUShaderModuleDescriptor.code specification>
getCode :: (MonadDOM m, FromJSString result) => GPUShaderModuleDescriptor -> m result
getCode self = liftDOM (((self ^. js "code") >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpushadermoduledescriptor-compilationhints GPUShaderModuleDescriptor.compilationHints specification>
setCompilationHints :: (MonadDOM m) => GPUShaderModuleDescriptor -> [GPUShaderModuleCompilationHint] -> m ()
setCompilationHints self val = liftDOM (void (self ^. jss "compilationHints" (toJSVal val)))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpushadermoduledescriptor-compilationhints GPUShaderModuleDescriptor.compilationHints specification>
getCompilationHints :: (MonadDOM m) => GPUShaderModuleDescriptor -> m (Maybe [GPUShaderModuleCompilationHint])
getCompilationHints self = liftDOM (((self ^. js "compilationHints") >>= fromJSValUnchecked))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpushadermoduledescriptor-compilationhints GPUShaderModuleDescriptor.compilationHints specification>
getCompilationHintsUnsafe :: (MonadDOM m, HasCallStack) => GPUShaderModuleDescriptor -> m [GPUShaderModuleCompilationHint]
getCompilationHintsUnsafe self = liftDOM ((((self ^. js "compilationHints") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://gpuweb.github.io/gpuweb/#dom-gpushadermoduledescriptor-compilationhints GPUShaderModuleDescriptor.compilationHints specification>
getCompilationHintsUnchecked :: (MonadDOM m) => GPUShaderModuleDescriptor -> m [GPUShaderModuleCompilationHint]
getCompilationHintsUnchecked self = liftDOM (((self ^. js "compilationHints") >>= fromJSValUnchecked))