On Tuesday, October 11, 2016 at 9:53:25 PM UTC+5:30, Anuradha Laxminarayan wrote: > On Sunday, 9 October 2016 13:18:32 UTC+5:30, Gregory Ewing wrote: > > Here's the first part of the essay I said I'd write about > > monads: > > > > http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/DemystifyingMonads.html > > > > Hope it's useful, > > Greg > > Thanks, that made a very interesting read.
Yeah agreed! Just got it running in ghc. Some small modifications needed: import Data.Set add x f s = f (insert x s) listify f s = f (toList s) s seqq f g x = f (\s1 -> g x s1) dedup (x:t) = seqq (add x) (dedup t) dedup [] = listify run_smf f a = f a (\r s -> r) empty > seq f g h = f (\s1 -> g h s1) > better be written as > seq f g x = f (\s1 -> g x s1) > because naming conventions imply that h is function. I think it would be good to make state and adhere to a name-convention eg c for continuation f,g for general function s for state etc Otherwise excellent work! V useful -- https://mail.python.org/mailman/listinfo/python-list