MetaObject 0.0.6.20110925 → 0.0.6.20150815
raw patch · 7 files changed
+13/−18 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- MO.Capture: instance [overlap ok] Typeable1 Capt
- MO.Capture: instance [overlap ok] Typeable1 Feed
- MO.Compile.Class: instance [overlap ok] (Typeable1 m, Monad m) => Typeable (AnyClass m)
- MO.Compile.Class: instance [overlap ok] (Typeable1 m, Monad m) => Typeable (MOClass m)
- MO.Compile.Role: role_public_methods, role_private_methods :: Role m -> Collection (AnyMethod m)
- MO.Run: instance [overlap ok] (Typeable1 m, Monad m) => Typeable (AnyResponder m)
- MO.Run: instance [overlap ok] (Typeable1 m, Monad m) => Typeable (Invocant m)
- MO.Util: instance [overlap ok] Typeable1 Collection
+ MO.Base: instance [overlap ok] Typeable Invocant
+ MO.Capture: instance [overlap ok] Typeable Capt
+ MO.Capture: instance [overlap ok] Typeable Feed
+ MO.Compile.Class: instance [overlap ok] Typeable AnyClass
+ MO.Compile.Class: instance [overlap ok] Typeable MOClass
+ MO.Compile.Role: role_private_methods :: Role m -> Collection (AnyMethod m)
+ MO.Compile.Role: role_public_methods :: Role m -> Collection (AnyMethod m)
+ MO.Run: instance [overlap ok] Typeable AnyResponder
+ MO.Util: instance [overlap ok] Typeable Collection
- MO.Compile.Class: class (Typeable1 m, Monad m, Typeable c, Eq c) => Class m c | c -> m
+ MO.Compile.Class: class (Typeable1 m, Monad m, Typeable c, Eq c) => Class m c | c -> m where class_precedence_list cls = case linearize (Just . superclasses) (MkClass cls) of { Just ok -> ok _ -> error "..." } all_attributes c = concatMap attributes (class_precedence_list c) ++ concatMap allRoleAttributes (roles c) where allRoleAttributes r = role_attributes r ++ concatMap allRoleAttributes (parent_roles r) all_attribute_methods c = shadow (from_c ++ [from_r]) where from_c = map attribute_methods (class_precedence_list c) from_r = all_using_role_shadowing (merged_roles c) role_attribute_methods attribute_methods = cmap makeAccessorMethod . newCollection' a_accessor_name . attributes role_attribute_methods = cmap makeAccessorMethod . newCollection' a_accessor_name . r_attributes makeAccessorMethod attr = MkMethod $ MkSimpleMethod {sm_name = a_accessor_name attr, sm_definition = MkMethodCompiled $ error . show . getInvocant} all_methods cls = all_attribute_methods cls ++ all_regular_methods cls all_regular_methods c = shadow (from_c ++ [from_r]) where from_c = map public_methods (class_precedence_list c) from_r = all_using_role_shadowing (merged_roles c) role_public_methods merged_roles c = emptyRole {r_roles = roles c} class_interface = MkResponder . (fromMethodList :: [(MethodName, MethodCompiled m)] -> m (MethodTable m)) . map (\ m -> (methodName m, methodCompile m)) . all_methods
- MO.Run: MkMethodInvocation :: !MethodName -> !Arguments m -> MethodInvocation m
+ MO.Run: MkMethodInvocation :: !MethodName -> !(Arguments m) -> MethodInvocation m
- MO.Run: MkMethodTable :: !AtomMap (MethodCompiled m) -> MethodTable m
+ MO.Run: MkMethodTable :: !(AtomMap (MethodCompiled m)) -> MethodTable m
- MO.Run: MkResponder :: !m c -> AnyResponder m
+ MO.Run: MkResponder :: !(m c) -> AnyResponder m
- MO.Run: mi_arguments :: MethodInvocation m -> !Arguments m
+ MO.Run: mi_arguments :: MethodInvocation m -> !(Arguments m)
- MO.Run: mt_methods :: MethodTable m -> !AtomMap (MethodCompiled m)
+ MO.Run: mt_methods :: MethodTable m -> !(AtomMap (MethodCompiled m))
Files
- MetaObject.cabal +3/−2
- src/MO/Base.hs +1/−0
- src/MO/Compile/Class.hs +3/−6
- src/MO/Run.hs +1/−7
- src/MO/Run.hs-boot +2/−1
- src/MO/Util.hs +2/−1
- src/MO/Util/C3.hs +1/−1
MetaObject.cabal view
@@ -1,6 +1,6 @@ name: MetaObject-version: 0.0.6.20110925-copyright: 2006 Caio Marcelo, 2008 Audrey Tang+version: 0.0.6.20150815+copyright: 2006 Caio Marcelo, 2008-2015 Audrey Tang license: BSD3 license-file: LICENSE author: Audrey Tang <audreyt@audreyt.org>@@ -9,6 +9,7 @@ description: A meta-object system for Haskell based on Perl 6 stability: experimental build-type: Simple+Tested-With: GHC==7.10.2 category: Development, Pugs exposed-modules: MO.Base MO.Compile.Attribute MO.Compile.Class MO.Compile.Role MO.Compile MO.Run MO.Util MO.Capture MO.Util.C3
src/MO/Base.hs view
@@ -21,6 +21,7 @@ = forall a. (Show a, Eq a, Ord a, Typeable a) => MkInvocant a -- Invocant (AnyResponder m) -- Responder+ deriving Typeable -- | open type to represent Code class Monad m => Codeable m c where
src/MO/Compile/Class.hs view
@@ -8,7 +8,7 @@ import MO.Compile.Role import MO.Run import MO.Util-import Data.Typeable (Typeable1, Typeable(..), typeOf1, mkTyCon, mkTyConApp)+import Data.Typeable (Typeable1, Typeable(..)) import Control.Monad (liftM) import Data.Monoid import qualified Data.Typeable as Typeable@@ -74,9 +74,7 @@ . all_methods data AnyClass m = forall c. Class m c => MkClass !c--instance (Typeable1 m, Monad m) => Typeable (AnyClass m) where- typeOf _ = mkTyConApp (mkTyCon "AnyClass") [typeOf1 (undefined :: m ())]+ deriving Typeable instance (Typeable1 m, Monad m) => Eq (AnyClass m) where MkClass x == MkClass y = case Typeable.cast y of@@ -115,6 +113,7 @@ , moc_private_methods :: Collection (AnyMethod m) , moc_name :: ClassName }+ deriving Typeable -- deriving (Eq) instance (Typeable1 m, Monad m) => Show (MOClass m) where@@ -123,8 +122,6 @@ compare = compare `on` moc_name instance (Typeable1 m, Monad m) => Eq (MOClass m) where (==) = (==) `on` moc_name-instance (Typeable1 m, Monad m) => Typeable (MOClass m) where- typeOf _ = mkTyConApp (mkTyCon "MOClass") [typeOf1 (undefined :: m ())] emptyMOClass :: (Typeable1 m, Monad m) => MOClass m emptyMOClass = MkMOClass
src/MO/Run.hs view
@@ -92,10 +92,7 @@ data AnyResponder m = forall c. ResponderInterface m c => MkResponder !(m c)--instance (Typeable1 m, Monad m) => Typeable (AnyResponder m) where- typeOf _ = mkTyConApp (mkTyCon "AnyResponder") [typeOf1 (undefined :: m ())]-+ deriving Typeable -- Invocant represent an object aggregated with an ResponderInterface@@ -106,9 +103,6 @@ Just y -> return y _ -> fail $ "Could not coerce from " ++ (show $ typeOf x) ++ " to " ++ (show $ typeOf (undefined :: b)) --instance (Typeable1 m, Monad m) => Typeable (Invocant m) where- typeOf _ = mkTyConApp (mkTyCon "Invocant") [typeOf1 (undefined :: m ())] ivDispatch :: (Typeable1 m, Monad m) => Invocant m -> MethodInvocation m -> m (Invocant m) ivDispatch i@(MkInvocant _ (MkResponder ri)) mi = do
src/MO/Run.hs-boot view
@@ -1,7 +1,8 @@ {-# OPTIONS_GHC -fglasgow-exts -fno-warn-orphans #-}-{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE KindSignatures, RoleAnnotations #-} module MO.Run where import Data.Typeable+type role AnyResponder nominal data AnyResponder (m :: * -> *) emptyResponder :: (Typeable1 m, Monad m) => AnyResponder m
src/MO/Util.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE BangPatterns #-} {-# OPTIONS_GHC -fglasgow-exts #-} module MO.Util (@@ -47,7 +48,7 @@ {-# INLINE addressOf #-} addressOf :: a -> Word-addressOf x = W# (unsafeCoerce# x)+addressOf !x = W# (unsafeCoerce# x) data Ord a => Collection a = MkCollection
src/MO/Util/C3.hs view
@@ -114,7 +114,7 @@ -data Object =+data Mu = O | A | B | C | D | E | F | G | H | I | J | K | K1 | K2 | K3 | X | Y | Z deriving (Eq, Show)