packages feed

sdl3-bindgen-sys-0.0.0.1: runtime-cexpr/C/Operators.hs

module C.Operators (
  -- * C operators and their types
  Op (..),
  UnaryOp (..),
  BinaryOp (..),
  pprOp,
  pprOpApp,
  opResType,
) where

import Data.Vec.Lazy

import C.Operator.Internal
import C.Type

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

-- | Compute the result type of a C operator applied to
-- arguments of the given types.
opResType
  :: (Eq a)
  => Platform
  -> Op arity
  -- ^ C operator
  -> Vec arity (Type a)
  -- ^ types of its arguments
  -> Maybe (Type a)
opResType plat op args =
  fst <$> opResTypeAndImpl plat op args