packages feed

MetaObject 0.0.6 → 0.0.6.20110925

raw patch · 4 files changed

+24/−22 lines, 4 filesdep −haskell98dep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: haskell98

Dependency ranges changed: base

API changes (from Hackage documentation)

- MO.Capture: instance [overlap ok] Monoid [:a:]
- MO.Compile.Role: role_private_methods :: Role m -> Collection (AnyMethod m)
- MO.Compile.Role: role_public_methods :: Role m -> Collection (AnyMethod m)
+ MO.Compile.Role: role_public_methods, role_private_methods :: Role m -> Collection (AnyMethod m)
- MO.Capture: CaptMeth :: a -> [:Feed a:] -> Capt a
+ MO.Capture: CaptMeth :: a -> Seq (Feed a) -> Capt a
- MO.Capture: CaptSub :: [:Feed a:] -> Capt a
+ MO.Capture: CaptSub :: Seq (Feed a) -> Capt a
- MO.Capture: MkFeed :: [:a:] -> AtomMap [:a:] -> Feed a
+ MO.Capture: MkFeed :: Seq a -> AtomMap (Seq a) -> Feed a
- MO.Capture: c_feeds :: Capt a -> [:Feed a:]
+ MO.Capture: c_feeds :: Capt a -> Seq (Feed a)
- MO.Capture: concatFeeds :: [:Feed a:] -> Feed a
+ MO.Capture: concatFeeds :: Seq (Feed a) -> Feed a
- MO.Capture: f_nameds :: Feed a -> AtomMap [:a:]
+ MO.Capture: f_nameds :: Feed a -> AtomMap (Seq a)
- MO.Capture: f_positionals :: Feed a -> [:a:]
+ MO.Capture: f_positionals :: Feed a -> Seq a

Files

MetaObject.cabal view
@@ -1,5 +1,5 @@ name:               MetaObject-version:            0.0.6+version:            0.0.6.20110925 copyright:          2006 Caio Marcelo, 2008 Audrey Tang license:            BSD3 license-file:       LICENSE@@ -12,7 +12,7 @@ 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-build-depends:      base, haskell98, containers,+build-depends:      base > 4 && < 5, containers,                     stringtable-atom >= 0.0.6 extensions:         UndecidableInstances OverlappingInstances extra-source-files: README, examples/si.hs, examples/old/mi.hs examples/old/roles.hs
src/MO/Base.hs view
@@ -1,13 +1,16 @@-{-# OPTIONS_GHC -fglasgow-exts -fparr #-}+{-# OPTIONS_GHC -fglasgow-exts #-}  module MO.Base where import {-# SOURCE #-} MO.Run+import Prelude hiding (foldl) import Data.Maybe import Data.Typeable import StringTable.Atom import MO.Capture-import GHC.PArr import StringTable.AtomMap as AtomMap+import Data.Foldable (foldl)+import Data.Sequence (Seq)+import qualified Data.Sequence as Seq  -- Codeable is an abstraction of possible different pieces of code that -- a method may use as implementation. It's supposed to be used as member@@ -66,13 +69,13 @@ getInvocant _                           = Nothing  namedArg :: (Typeable1 m, Monad m) => Arguments m -> Atom -> Maybe (Invocant m)-namedArg args key = foldlP findArg Nothing (c_feeds args)+namedArg args key = foldl findArg Nothing (c_feeds args)     where     -- Notice that each feed has a Map with the named arguments (given by f_nameds)     -- and the values are of type '[:a:]' and not 'a', because of this we get only     -- the first one. "(!: 0)" means "(!! 0)" in parallel arrays notation.     -- (is getting only the first one right??)-    findArg Nothing MkFeed{ f_nameds = ns } = fmap (!: 0) (AtomMap.lookup key ns)+    findArg Nothing MkFeed{ f_nameds = ns } = fmap (`Seq.index` 0) (AtomMap.lookup key ns)     findArg x       _                       = x  stubInvocant :: (Typeable1 m, Monad m) => Invocant m
src/MO/Capture.hs view
@@ -1,37 +1,35 @@-{-# OPTIONS_GHC -fglasgow-exts -fparr #-}+{-# OPTIONS_GHC -fglasgow-exts #-} module MO.Capture where--import GHC.PArr+import Prelude hiding (foldl, foldr) import Data.Typeable import StringTable.Atom import StringTable.AtomMap as AtomMap hiding (map)+import Data.Sequence (Seq)+import qualified Data.Sequence as Seq import Data.Monoid+import Data.Foldable (foldl, foldr)  -- | a Capture is a frozen version of the arguments to an application. data Capt a     = CaptMeth         { c_invocant :: a-        , c_feeds    :: [:Feed a:]+        , c_feeds    :: Seq (Feed a)         }     | CaptSub-        { c_feeds    :: [:Feed a:]+        { c_feeds    :: Seq (Feed a)         }     deriving (Show, Eq, Ord, Typeable)   -- | non-invocant arguments. data Feed a = MkFeed-    { f_positionals :: [: a :]-    , f_nameds      :: AtomMap [: a :] +    { f_positionals :: Seq a+    , f_nameds      :: AtomMap (Seq a)         -- ^ maps to [:a:] and not a since if the Sig stipulates         --   @x, "x => 1, x => 2" constructs @x = (1, 2).     }     deriving (Show, Eq, Ord, Typeable) -instance Monoid [: a :] where-    mempty = [: :]-    mappend = (+:+)- instance Monoid (Feed a) where     mempty = MkFeed mempty mempty     mappend (MkFeed x1 x2) (MkFeed y1 y2) = MkFeed (mappend x1 y1) (mappend x2 y2)@@ -40,5 +38,5 @@ emptyFeed :: Feed a emptyFeed = mempty -concatFeeds :: [: Feed a :] -> Feed a-concatFeeds xs = MkFeed (concatMapP f_positionals xs) (foldlP AtomMap.union mempty (mapP f_nameds xs))+concatFeeds :: Seq (Feed a) -> Feed a+concatFeeds xs = MkFeed (foldr mappend mempty (fmap f_positionals xs)) (foldl AtomMap.union mempty (fmap f_nameds xs))
src/MO/Run.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -fglasgow-exts -fparr #-}+{-# OPTIONS_GHC -fglasgow-exts #-}  module MO.Run (     module MO.Run,@@ -11,8 +11,9 @@ import MO.Compile as C import StringTable.AtomMap as M import Data.Typeable hiding (cast)-import GHC.PArr import qualified Data.Typeable as Typeable+import Data.Sequence (Seq)+import qualified Data.Sequence as Seq  -- Little overview. --@@ -127,5 +128,5 @@  -- Helper to create a Arguments based on a list of Invocants mkArgs :: (Typeable1 m, Monad m) => [Invocant m] -> Arguments m-mkArgs x = CaptSub{ c_feeds = [: MkFeed { f_positionals = toP x, f_nameds = M.empty } :] }+mkArgs x = CaptSub{ c_feeds = Seq.singleton (MkFeed { f_positionals = Seq.fromList x, f_nameds = M.empty }) }