MetaObject 0.0.4 → 0.0.5
raw patch · 4 files changed
+15/−14 lines, 4 files
Files
- MetaObject.cabal +1/−1
- src/MO/Base.hs +10/−1
- src/MO/Run.hs +0/−9
- src/MO/Run.hs-boot +4/−3
MetaObject.cabal view
@@ -1,5 +1,5 @@ name: MetaObject-version: 0.0.4+version: 0.0.5 copyright: 2006 Caio Marcelo, 2008 Audrey Tang license: BSD3 license-file: LICENSE
src/MO/Base.hs view
@@ -1,6 +1,6 @@ {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances -fparr #-} -module MO.Base (module MO.Base, Invocant, stubInvocant) where+module MO.Base where import {-# SOURCE #-} MO.Run import Data.Maybe import Data.Typeable@@ -14,6 +14,11 @@ -- of the MethodCompiled structure. A Codeable type need to have a function -- "run" that accepts Arguments and returns some Invocant. +data (Typeable1 m, Monad m) => Invocant m+ = forall a. (Show a, Eq a, Ord a, Typeable a) => MkInvocant+ a -- Invocant+ (AnyResponder m) -- Responder+ -- | open type to represent Code class Monad m => Codeable m c where run :: c -> Arguments m -> m (Invocant m)@@ -69,4 +74,8 @@ -- (is getting only the first one right??) findArg Nothing MkFeed{ f_nameds = ns } = fmap (!: 0) (AtomMap.lookup key ns) findArg x _ = x++stubInvocant :: (Typeable1 m, Monad m) => Invocant m+stubInvocant = MkInvocant () emptyResponder+
src/MO/Run.hs view
@@ -99,11 +99,6 @@ -- Invocant represent an object aggregated with an ResponderInterface -data (Typeable1 m, Monad m) => Invocant m- = forall a. (Show a, Eq a, Ord a, Typeable a) => MkInvocant- a -- Invocant- (AnyResponder m) -- Responder- fromInvocant :: forall m b. (Typeable1 m, Monad m, Typeable b) => Arguments m -> m b fromInvocant CaptSub{} = fail "No invocant" fromInvocant CaptMeth{ c_invocant = MkInvocant x _ } = case Typeable.cast x of@@ -129,10 +124,6 @@ -- Helpers to create simple/empty invocants. __ :: (Typeable1 m, Monad m, Ord a, Show a, Typeable a) => a -> Invocant m __ = (`MkInvocant` emptyResponder)--stubInvocant :: (Typeable1 m, Monad m) => Invocant m-stubInvocant = MkInvocant () emptyResponder- -- Helper to create a Arguments based on a list of Invocants mkArgs :: (Typeable1 m, Monad m) => [Invocant m] -> Arguments m
src/MO/Run.hs-boot view
@@ -1,6 +1,7 @@ {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances -fno-warn-orphans #-}+{-# LANGUAGE KindSignatures #-} module MO.Run where import Data.Typeable-data (Typeable1 m, Monad m) => Invocant m-stubInvocant :: (Typeable1 m, Monad m) => Invocant m-instance (Typeable1 m, Monad m) => Show (Invocant m)+data AnyResponder (m :: * -> *)+emptyResponder :: (Typeable1 m, Monad m) => AnyResponder m+