andyarvanitis / IdrisObjCExperiment

18 stars 1 forks source link

Implicit lifting to IO #1

Open jonsterling opened 10 years ago

jonsterling commented 10 years ago

Is there any reason to do this other than to get to use the >>= operator? I wonder if it makes things a little bit confusing...

Perhaps defining an operator like to do reversed function application would suffice.

andyarvanitis commented 10 years ago

Yeah, I wondered about that. I initially played around with a couple of custom operators before switching to the implicit lifting. I really don't know if there is any precedent for doing that or if it's a bad idea (thus my comment in the code).

jonsterling commented 10 years ago

Yeah... Just as a matter of general practice, I think that implicits should be used to make the syntax smaller rather than larger. But it's not a huge deal...

andyarvanitis commented 10 years ago

Do you mean you would pick a smaller operator, or just pass the object as the last argument (so no operator needed)? I see what you mean in general, though, and agree.

jonsterling commented 10 years ago

What I mean, is either I'd make an operator a -> (a -> b) -> b to maintain the Objective-C-style postfix application, or I'd pass the object as the argument in a normal function application. But an implicit conversion in order to use an existing operator seems like double the trouble, and it also contributes to misunderstanding of when it's necessary.

Many people like the |> operator in F#, if that's of any interest...

andyarvanitis commented 10 years ago

Ok, cool. That's actually consistent with what I started with, but then thought it might be frowned upon (the introduction of a new operator). I haven't really looked at F# and so didn't know about its |>, so that's good to know.