Advertisement
Guest User

Increased `lexp` precedence: Intro

a guest
Mar 14th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. == The problem ==
  2.  
  3. We do it all the time: Writing that one dollar sign just before our expressions, just because Haskell can't parse it:
  4.  
  5. {{{#!hs
  6. f x = g $ if x then {- ... -} else {- ... -}
  7. f x = g $ case x of {- ... -}
  8. f x = g $ do {- ... -}
  9. }}}
  10.  
  11. However, we programmers are lazy and want to type as few characters as possible. Think about the precious characters we would save if we could write code this way:
  12.  
  13. {{{#!hs
  14. f x = g if x then {- ... -} else {- ... -}
  15. f x = g case x of {- ... -}
  16. f x = g do {- ... -}
  17. }}}
  18.  
  19. Wow, our productivity just shot up by a whopping 6%!
  20.  
  21. However, this code looks ugly, noone would ever write this... Right?
  22. There has to be some way to catagorize this feature with others people would never use...
  23.  
  24. == Pragmas to the rescue! ==
  25.  
  26. The {{{LANGUAGE}}} pragma! Of course! We can add a syntactic extension to enable above syntax! But how should we name it...
  27.  
  28. {{{InlineStatements}}}? {{{InfixStatements}}}? {{{ParenthesizedStatements}}}? {{{IncreasedStatementPrecedence}}}? {{{StatementsWithoutParenthesis}}}?
  29.  
  30. I don't know. I am [1] not the parents who might one day give birth to this feature. I am merely the one who conceptualized it.
  31.  
  32. [1] (probably, unless this request remains unnoticed for another 20 years or so)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement