never executed always true always false
    1 {-# language CPP #-}
    2 {-# language MultiParamTypeClasses #-}
    3 
    4 #ifndef ENABLE_INTERNAL_DOCUMENTATION
    5 {-# OPTIONS_HADDOCK hide #-}
    6 #endif
    7 
    8 module OpenCV.Internal.Core.Types.Matx
    9     ( Matx(..)
   10     , MatxDimR
   11     , MatxDimC
   12     , IsMatx(..)
   13     ) where
   14 
   15 import "base" Foreign.ForeignPtr ( ForeignPtr, withForeignPtr )
   16 import "base" GHC.TypeLits
   17 import "this" OpenCV.Internal.C.Types
   18 
   19 --------------------------------------------------------------------------------
   20 
   21 newtype Matx (dimR :: Nat) (dimC :: Nat) (depth :: *)
   22       = Matx {unMatx :: ForeignPtr (C'Matx dimR dimC depth)}
   23 
   24 type instance C (Matx dimR dimC depth) = C'Matx dimR dimC depth
   25 
   26 instance WithPtr (Matx dimR dimC depth) where
   27     withPtr = withForeignPtr . unMatx
   28 
   29 type family MatxDimR (m :: * -> *) :: Nat
   30 type family MatxDimC (m :: * -> *) :: Nat
   31 
   32 type instance MatxDimR (Matx dimR dimC) = dimR
   33 type instance MatxDimC (Matx dimR dimC) = dimC
   34 
   35 class IsMatx (m :: * -> *) depth where
   36     toMatx   :: m depth -> Matx (MatxDimR m) (MatxDimC m) depth
   37     fromMatx :: Matx (MatxDimR m) (MatxDimC m) depth -> m depth
   38 
   39     toMatxIO :: m depth -> IO (Matx (MatxDimR m) (MatxDimC m) depth)
   40     toMatxIO = pure . toMatx