packages feed

HROOT-io-0.9: src/HROOT/IO/TFile/Cast.hs

{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
  MultiParamTypeClasses, OverlappingInstances, IncoherentInstances
  #-}
module HROOT.IO.TFile.Cast where
import Foreign.Ptr
import FFICXX.Runtime.Cast
import System.IO.Unsafe
import HROOT.IO.TFile.RawType
import HROOT.IO.TFile.Interface

instance (ITFile a, FPtr a) => Castable a (Ptr RawTFile) where
        cast x f = f (castPtr (get_fptr x))
        uncast x f = f (cast_fptr_to_obj (castPtr x))

instance Castable TFile (Ptr RawTFile) where
        cast x f = f (castPtr (get_fptr x))
        uncast x f = f (cast_fptr_to_obj (castPtr x))