Anybody can match a couple of simple rules to colour "return" and "where" and pair up parenthesis. Why do we not use the magic that is type inference to highlight each part of an expression depending on its type?
The means having say:
smallDivisors x = [y|y<-[1..(floor.sqrt.fromIntegral x)],(mod x y)==0]
^ ^ ^ ^ ^
red stripes red red stripes red blue
Where red means integer, blue a boolean and stripes a list.
Of course the actual aesthetic isn't important and colours could be hashed from the name of the type or similar. The rationale is that often when I'm looking at a more complex expression and want to figure out what's what I find myself wishing that I could get at the type checker while still in my IDE (geany as it happens).
What I'm really proposing is that the following be developed;
- an interface to as GHC (or hugs or YHC or whatever) to ask what type something is be provided
- a capability for making use of this be added to Yi or leksah or some other suitable vehicle
Please feel free to tell me I'm stupid and need more/less monads.
Want to add to the discussion?
Post a comment!