agentm / project-m36

Project: M36 Relational Algebra Engine
The Unlicense
894 stars 48 forks source link

make showing something implicit #271

Open YuMingLiao opened 3 years ago

YuMingLiao commented 3 years ago

In tutorial, a lot of example needs :showexpr to see results. But in ghci, there is no need to type show. You just type it and it will show what it is.

Sometimes, I just want to try some ideas to see if it is what I think. relations, atoms, relational expressions and function applications are something I want to see the results immediately.

It may help people trying things in tutd.

agentm commented 3 years ago

Indeed, this has annoyed me in the past as well, but this behavior is actually closer to ghci behavior than it may first appear. In ghci, without a ":" prefix, everything is basically run in a weird version of IO, so "3" is actually of type Num a=>IO a until one actually asks specifically for the type :t 3.

I do like that that the ":showexpr" makes the type of the expression completely unambiguous which can emphasize the various type of expressions, especially for beginners, so how about a compromise? Just like in ghci, we could trim the ":" commands to the minimum shortness. Would :s true=true work for you? Do others have opinions on this?

agentm commented 3 years ago

I put together a prototype of the shortened command version on the "271_shorten_colon_commands" branch in case you want to check it out.

YuMingLiao commented 3 years ago

I see your point. I guess I can write :s true:{a:=id(1)} to test a function. That's workable.

Or does a :showatom :a id(1) help newcomers to try atom functions while still recognizing it as an atom?