{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, 
             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}

-- module HROOT.Class.Interface where

module HROOT.Class.TRandom.Interface where


import Data.Word
import Foreign.ForeignPtr
import HROOT.TypeCast

import HROOT.Class.TRandom.RawType

import HROOT.Class.TNamed.Interface


class (ITNamed a) => ITRandom a where

    gaus :: a -> Double -> Double -> IO Double 

    uniform :: a -> Double -> Double -> IO Double 

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