{-# LANGUAGE ForeignFunctionInterface, MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances, OverlappingInstances #-} -- | This module defines typeclasses to represent the relationships of an object-oriented inheritance hierarchy module LLVM.General.Internal.FFI.PtrHierarchy where 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 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