| 203 | | -- | a Capture is a frozen version of the arguments to an application. |
| 204 | | data Capt a |
| 205 | | = CaptMeth |
| 206 | | { c_invocant :: a |
| 207 | | , c_feeds :: [Feed a] |
| 208 | | } |
| 209 | | | CaptSub |
| 210 | | { c_feeds :: [Feed a] |
| 211 | | } |
| 212 | | deriving (Show, Eq, Ord, Typeable) {-!derive: YAML_Pos, Perl6Class, MooseClass!-} |
| 213 | | |
| 214 | | -- | non-invocant arguments. |
| 215 | | data Feed a = MkFeed |
| 216 | | { f_positionals :: [a] |
| 217 | | , f_nameds :: Map.Map ID [a] -- ^ maps to [a] and not a since if the Sig stipulates |
| 218 | | -- @x, "x => 1, x => 2" constructs @x = (1, 2). |
| 219 | | } |
| 220 | | deriving (Show, Eq, Ord, Typeable) {-!derive: YAML_Pos, Perl6Class, MooseClass!-} |
| 221 | | |
| 222 | | instance Monoid (Feed a) where |
| 223 | | mempty = MkFeed mempty mempty |
| 224 | | mappend (MkFeed x1 x2) (MkFeed y1 y2) = MkFeed (mappend x1 y1) (mappend x2 y2) |
| 225 | | mconcat xs = MkFeed (mconcat (map f_positionals xs)) (mconcat (map f_nameds xs)) |
| 226 | | |
| 227 | | emptyFeed :: Feed a |
| 228 | | emptyFeed = MkFeed [] Map.empty |
| 229 | | |