
28 May
2012
28 May
'12
1:18 p.m.
* Yves Parès
observe $ flip runStateT 10 $ (put 0 >> mzero) <|> modify (+3) ((),13)
If the only thing you need is backtracking, using LogicT might be a little overkill, using Maybe in the bottom of you monad stack suits just fine:
case flip runStateT 10 $ (put 0 >> mzero) <|> modify (+3) of Just x -> .... Nothing -> ....
Indeed, I didn't realise that Maybe may be (no pun intended) sufficient here! -- Roman I. Cheplyaka :: http://ro-che.info/