3 ms·
Here's my obligatory dumb question of the day. What is the problem he is trying to solve with the macros? It seems super straightforward, so I suspect I'm mis
by kenjackson 16y ago
Here's my obligatory dumb question of the day. What is the problem he is trying to solve with the macros? It seems super straightforward, so I suspect I'm missing something (being only conversational in Lisp and Haskell, although don't know macros even decently):
Here's the snippet of code that describes the problem (which I don't get):
do exists <- doesFileExist "lalala"
if exists
then ...
else ...
- rchowe 16y agoI don't know, what he seems to want to do can be expressed in haskell as doesFileExist "file" >>= \exists -> if exists then ... else ... When he writes (do (>>= ... in his lisp example I don't think that he understands that do is just syntactic sugar for >>=s and >>s, and that what's actually happening is the data is being "taken out" (for lack of a better term) of a monad. His problem seems to be that you do have to bother with monadic IO when with a macro he can just write (mif cond ...) and be done with it.