You have to figure out here how you can use the function which is the argument 
to map.

It seems you want to end up with a function of type a -> Evaluator b, to be 
used as an argument to mapM.

One idea is to add a new constructor Var to represent variables, and something 
like
evalVar :: Obs b -> a -> Evaluator b
which handles Var by "return"ing the second argument, and everything else as in 
evalObs.

Then you can evaluate Map like
evalObs (Map f) as = evalObs as >>= mapM (evalVar (f Var))

Except, this won't quit work because the type for evalVar is wrong.

That can be fixed by adding an extra parameter for the variable type:

data Obs varType a where
   ...
   Var :: Obs v v
   Map :: (Obs a a -> Obs a b) -> Obs v [a] -> Obs v [b]

or something like that.

Brandon


      
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to