HROOT-math-0.8: src/HROOT/Math/TRandom/Interface.hs
{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses,
FlexibleInstances, TypeSynonymInstances,
EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}
-- module HROOT.Class.Interface where
module HROOT.Math.TRandom.Interface where
import Data.Word
import Foreign.C
import Foreign.Ptr
import Foreign.ForeignPtr
import FFICXX.Runtime.Cast
import HROOT.Math.TRandom.RawType
import HROOT.Core.TNamed.Interface
---- ============ ----
class (ITNamed a) => ITRandom a where
getSeed :: a -> IO CInt
gaus :: a -> CDouble -> CDouble -> IO CDouble
setSeed :: a -> CInt -> IO ()
uniform :: a -> CDouble -> CDouble -> IO CDouble
instance Existable TRandom where
data Exist TRandom = forall a. (FPtr a, ITRandom a) => ETRandom a
upcastTRandom :: (FPtr a, ITRandom a) => a -> TRandom
upcastTRandom h = let fh = get_fptr h
fh2 :: ForeignPtr RawTRandom = castForeignPtr fh
in cast_fptr_to_obj fh2
downcastTRandom :: (FPtr a, ITRandom a) => TRandom -> a
downcastTRandom h = let fh = get_fptr h
fh2 = castForeignPtr fh
in cast_fptr_to_obj fh2