xebia-functional / macroid-starter

A sample project to start playing with Macroid
http://macroid.github.io/
34 stars 18 forks source link

Unconfuse IntelliJ #2

Closed i-am-the-slime closed 10 years ago

i-am-the-slime commented 10 years ago

bildschirmfoto 2014-06-01 um 23 50 53

I guess this is either not possible, not documented or I didn't find it in the documentation. Would love to hear some input on this. Is there a trick at least to suppress this? Compiling works fine.

stanch commented 10 years ago

Yeah, sometimes IDEA is not clever enough. You can suppress this by disabling “type-aware highlighting” — it’s a little [T] sign in the bottom right corner. I actually keep this switched off at all times, as most people dealing with Spray, Shapeless, Scalaz, etc, do. The reason lies in that IDEA uses its own custom presentation compiler (unlike Scala IDE, which just calls scalac) and they are still behind the spec.

Also I have to acknowledge that the for syntax is ugly. For now you can use

Ui.sequence(
  toast(...) <~ ... <~ fry,
  Ui(true)
)

But I’m working on reducing this further: https://github.com/macroid/macroid/issues/23.

stanch commented 10 years ago

Oops, Ui.sequence wouldn’t work here, I guess I meant

(toast(...) <~ ... <~ fry).map(_ ⇒ true)
i-am-the-slime commented 10 years ago

Great, thanks for the quick answer. One other question I have is how do you write the unicode signs like ⇒ without copy and paste?

stanch commented 10 years ago

I have put them on my keyboard :) If you are on Windows like me, you can use this tool from Microsoft. Scalariform, which is available as an sbt plugin, can be set up to replace => with and <- with (but not -> with ) on each compilation. Finally, IDEA has something called “live templates”, which apparently allowed to type crazy Scalaz operators back in the days when crazy operators were in favor :) I have not tried it (have not tried anything on Mac/Linux either).

stanch commented 10 years ago

P.S. I once had as an alias for <~, but quickly realized that even I myself am too lazy to type that (and it’s not rendered very well in most fonts).

i-am-the-slime commented 10 years ago

Okay, I made some live templates such that =>+TAB for example expands to ⇒. You might want to reconsider to change these to something simpler ==> (?) because, sadly not everybody will be completely convinced by a Peep Show reference - unlike me.

stanch commented 10 years ago

is in fact a Scala keyword! It is absolutely the same as =>. Sorry if that confused you.

Although I’m a Peep Show fan, I can’t seem to get the reference, perhaps I made it unconsciously?

i-am-the-slime commented 10 years ago

Oh I was just talking about this: http://static.bips.channel4.com/bips/orig/videos/2776180868001.jpg from your talk. Thanks for clarifying about the => !

stanch commented 10 years ago

I see; that’s what you get when trying to reduce the code density in the presentation :)