[GHC] #13757: Are you for or against writing "otherwise" as a keyword?
GHC
ghc-devs at haskell.org
Fri May 26 09:57:49 UTC 2017
#13757: Are you for or against writing "otherwise" as a keyword?
-------------------------------------+-------------------------------------
Reporter: vanto | Owner: (none)
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Poor/confusing
Unknown/Multiple | error message
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
{{{otherwise}}} is frequently used and therefore should have been written
as a keyword.\\
{{{otherwise}}} was coded in prelude like this {{{otherwise = True}}}\\
So what is the reason that {{{otherwise}}} was not coded as a keyword?\\
\\
To understand you have to go back. It seems that this has been done to
minimize the number of keywords.\\
Today it seems surprising. And I wonder why we wrote the conditional
expression with {{{if}}}{{{then}}}{{{else}}}?
That's three additional keywords.\\
\\
It would have been better to write the conditional expression as in Sasl
{{{condition -> exp1 ; exp22}}} (By adapting the operators of course.)\\
Let's go back to {{{otherwise}}} . And take a look at this code.\\
{{{
otherwise :: Bool
otherwise = Prelude.otherwise
sig :: Integer -> Integer
sig n | a = -1
| b = 0
| Main.otherwise = 1
where { a = n < 0;
b = n == 0 }
z :: Bool
z = if Main.otherwise == Prelude.otherwise then True else False
main :: IO ()
main = do {
print (sig 0);
print (z) }
}}}
This code works but the compiler result is different by adding or removing
the first two lines of code.\\
For me it is urgent that {{{otherwise}}} become a keyword as in Miranda.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13757>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list