On Tue, Jan 25, 2011 at 10:20 AM, Ketil Malde <[email protected]> wrote: > Erik Hesselink <[email protected]> writes: > >>>> importing Control.Applicative > >>> main = print =<< liftM2 (+) readLn (return 3) >>> [...] line noise > >> Why not just: >> >> main = print . (+3) =<< readLn > > Or using applicative: > > print =<< (+3) <$> readLn > > ? > > (Which separates the printing from the addition.) > > -k
IMHO, all these proposed solutions just serve to further illustrate the problem. :-) Personally I don't mind having to use explicit combinators to interact with monadic values -- forces me to think things through, and all that -- but it's true that having automatic lifting would be convenient, and look less syntaxy. Alternatively, Disciple has effect typing and strictness-by-default rather than IO/ST monads, meaning you can use the same combinators to control functions with effects as you would for non-effectful functions, which is sort of like having automatic lifting for the IO and ST monads but not anything else (besides being a lot finer-grained). > -- > If I haven't seen further, it is by standing in the footprints of giants > > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Work is punishment for failing to procrastinate effectively. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
