Wed Nov 17 15:29:55 EST 2010
Just to get an idea of the abstract structure of what I'm trying to do
with Staapl, here is an attempt to express the concatenative macro type
I :: m -> (t -> t)
I' :: [m] -> (t -> t)
in a Haskell coat.
This is the first thing I came up with. Both m and t can be anything.
The only structure that's there is that a concatenation operator, here
expressed by list construction, has a meaning if there is a meaning
for primitive types m.
class Concat m t where
iPrim :: m -> (t -> t) -- interpret primitive
iConcat :: [m] -> (t -> t) -- interpret concatenation
iConcat = compose . (map iPrim) where
compose = foldr (.) (\x -> x)
Generalizing this to any foldable data structure gives: