module DatabaseDesign.Ampersand.Classes.Object
(Object(..) )
where
import DatabaseDesign.Ampersand.Core.AbstractSyntaxTree
import DatabaseDesign.Ampersand.Basics (fatalMsg)
fatal :: Int -> String -> a
fatal = fatalMsg "Classes.Object"
class Object a where
concept :: a -> A_Concept
attributes :: a -> [ObjectDef]
contextOf :: a -> Expression
foldedattributes :: a -> [Expression]
foldedattributes obj
= contextOf obj:[contextOf obj .:. x |xs<-map foldedattributes (attributes obj),x<-xs]
instance Object A_Context where
concept _ = fatal 29 "this used to be 'Anything' but that has become history in ticket #104."
attributes c = [ifcObj s | s<-ctxifcs c]
contextOf _ = fatal 38 "Cannot evaluate the context expression of the current context (yet)"
instance Object ObjectDef where
concept obj = target (objctx obj)
attributes = objAts
contextOf = objctx