[Haskell-cafe] Re: monad subexpressions
claus.reinke at talk21.com
Sat Aug 4 10:57:13 EDT 2007
> i know that it may be trsanslated to everything including pure
> assembler. what i'm missing in current Haskell is USEFUL SYNTAX for
> these expressions. adding tons of liftM and ap can't make me happy
but the point is that you have a standard set of operations
when working at that level, including conditionals, assignments,
pointer increments, read/write, etc. you only need to define
lifted variants of each of those operations *once*, in a library.
when you use those lifted variants, you can (actually: you have to)
use them with monadic parameters, and no need for liftM/ap.
liftM/ap are useful, but need to appear in application code only
when you do not know in advance what set of operations you'll
need, as you can then lift any operation on the fly.
so, there could be a library defining
lhs ==: rhs = putMVar <$> lhs <*> rhs
and in your application code, you could write
newEmptyMVar ==: putStrLn "hi there"
(not that this would be useful;-)
More information about the Haskell-Cafe