{-# LANGUAGE ForeignFunctionInterface, MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances, CPP #-} #if __GLASGOW_HASKELL__ < 710 {-# LANGUAGE OverlappingInstances #-} #define CPP_OVERLAPPING #else #define CPP_OVERLAPPING {-# OVERLAPPING #-} #endif -- | This module defines typeclasses to represent the relationships of an object-oriented inheritance hierarchy module LLVM.General.Internal.FFI.PtrHierarchy where import LLVM.General.Prelude import Foreign.Ptr -- | a class to represent safe casting of pointers to objects of descendant-classes to ancestor-classes. class DescendentOf a b where upCast :: Ptr b -> Ptr a upCast = castPtr -- | trivial casts instance CPP_OVERLAPPING DescendentOf a a where upCast = id -- | a class to represent direct parent-child relationships class ChildOf b c | c -> b -- | ancestor-descentant relationships are build out of parent-child relationships instance (DescendentOf a b, ChildOf b c) => DescendentOf a c -- | data Value -- | data Constant instance ChildOf User Constant -- | data GlobalValue instance ChildOf Constant GlobalValue -- | data GlobalVariable instance ChildOf GlobalValue GlobalVariable -- | data GlobalAlias instance ChildOf GlobalValue GlobalAlias -- | data Function instance ChildOf GlobalValue Function -- | data BasicBlock instance ChildOf Value BasicBlock -- | data Parameter instance ChildOf Value Parameter -- | data Instruction instance ChildOf User Instruction -- | data BinaryOperator instance ChildOf Instruction BinaryOperator -- | data User instance ChildOf Value User -- | data MDNode instance ChildOf Value MDNode -- | data MDString instance ChildOf Value MDString -- | data NamedMetadata -- | data InlineAsm instance ChildOf Value InlineAsm -- | data Type