DDC compiler and effects; better than Haskell? (was Re: [Haskell-cafe] unsafeDestructiveAssign?)

Pavel Perikov perikov at gmail.com
Wed Aug 12 05:30:46 EDT 2009

On 12.08.2009, at 13:27, Peter Verswyvelen wrote:

> Well, the point is that you still have monadic and pure programming
> styles. It's true that applicative style programming can help here,
> but then you have these <$> and <*> operators everywhere, which also
> feels like boilerplate code (as you mention, some extensions could
> help here)

And you have higher-order functions, you're right. My reply was a bit  
rushed ;)


> Monadic style even has the do syntax, which really looks imperative,
> while of course, it isn't.
> I know that for e.g. doing a DFS I can use the ST monad and still be
> pure, however, my code *looks* imperative when I use the do syntax,
> which mentally feels weird (maybe it's just me being mentally ill ;-)
> It's even worse with the arrows syntax: without it I wouldn't be able
> to write complex Yampa stuff, but the syntax makes me feels that I'm
> drawing boxes and links using ASCII, and suddenly it *feels* different
> than when doing "nice" pure / applicative style programming. Again,
> maybe it's just my brain that is fucked up by 25 years of imperative
> programming :)
> So to me, keeping the syntax in a pure style (a bit like ML and F#)
> plays nicer with my brain.
> On Wed, Aug 12, 2009 at 11:13 AM, Pavel Perikov<perikov at gmail.com>  
> wrote:
>>> unless you have some insanely
>>> clever refactoring tool ready that can convert pure into monadic
>>> functions and vice versa.
>> Not trying to attack the idea, just some thoughts:
>> I don't see much problem converting pure function into an  
>> "effectfull" form
>> :) Having pure function
>> myPureFunction::a1->a2->a3->res
>> ....
>> myPureFunction a1 a2 a3 -- pure call
>> myPureFunction <$> a1 <*> a2 <*> a3 -- call using Applicative
>> Probably, introducing some conventions and using some language  
>> extensions
>> you can write a function taking pure function and converting it  
>> into monadic
>> version (a-la SPJ' work on polyvariadic composition etc [1])
>> Have monadic function but needs to call it from pure code? use
>> Control.Monad.Identity.
>> Not a big deal to me but maybe I'm missing the point
>> -----
>> [1] http://okmij.org/ftp/Haskell/types.html#polyvar-comp
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list