[Haskell-cafe] Channel9 Interview: Software Composabilityandthe Future of Languages

Claus Reinke claus.reinke at talk21.com
Thu Feb 1 18:39:53 EST 2007

>>     while (hGetBuf h buf bufzise .==. (return bufsize)) $ do
>>         crc =: updateCrc crc buf bufsize
>>         breakIf ((val crc) .==. (return 0)) `orElse` do
>>         printM (val crc)
>>         od
> your solution is just to make lifted copy of each and every pure
> operation. so one should define 2^n operations where n is number of
> arguments

ah, I thought the problem at hand was breaking out of a while loop.
but if you look closely, I think you'll find it to be ~2 operations, the
monadic one, and possibly a pure one to be lifted. one can always
lift pure arguments via return, and use the fully lifted monadic 
operation, as I did in the example code (you were talking about 
imperative programming, after all?-). 

if one were to go down that route, one would probably want to 
overload literals, such as (Num a,Monad m) => Num (m a) for 
fromInteger, rather than writing (return 0) everywhere, and as usual,
the obligatory superclasses would get in the way and would have to
be ignored, and Bool isn't overloaded, .. all the usual suspects for 
hampering embedded DSLs in Haskell.


More information about the Haskell-Cafe mailing list