
24 Mar
2007
24 Mar
'07
3:57 p.m.
My idea is to have a monad with a concatenating >>, so that I can:
bulidStuff = do func1 func2 func3 func4
Leandro Penz
I actually did this recently for a project I have been working on. First, an example:
output label a@(I.Add a1 a2 a3) = do comment (show a) mov' label eax a1 add eax a2 mov a3 eax
My monad in this example has a Writer or a WriterT in it somewhere. I of course had to include the 'tell' that you mention somewhere, but I hid it in the 'comment', 'mov', and 'add' functions in an attempt to make my own personal assembly DSL. Obviously, you would have to either include 'tell' in your func1, func2, etc., or create wrappers for them that include a 'tell'. Just my two cents. Bryan