From twanvl at gmail.com Fri Sep 7 15:20:08 2007 From: twanvl at gmail.com (Twan van Laarhoven) Date: Fri Sep 7 15:10:23 2007 Subject: Consistency of reserved operators and bang patterns Message-ID: <46E1A468.5000002@gmail.com> The bang pattern proposal [1] still allows (!) to be used as an operator. I think there should be no difference in this regard between ! and ~, since they are used in exactly the same location. In my opinion the best thing would be to allow (~) and (@) as operators. With the same restriction on definition as (!), i.e. they must be defined in function style, not as an operator. The change to the syntax would be to remove @ and ~ from the reserved operators list [2], reservedop -> .. | : | :: | = | \ | | | <- | -> | @ | ~ | => making it reservedop -> .. | : | :: | = | \ | | | <- | -> | => Oh, and while we are at it, I think (:) should also be removed as a reservedop, there is no reason for it to be on that list. Twan [1] Bang Patterns, Haskell-prime wiki http://hackage.haskell.org/trac/haskell-prime/wiki/BangPatterns [2] Haskell 98 report, lexical structure, identifiers and operators http://haskell.org/onlinereport/lexemes.html#sect2.4 From isaacdupree at charter.net Fri Sep 7 20:24:51 2007 From: isaacdupree at charter.net (Isaac Dupree) Date: Fri Sep 7 20:16:09 2007 Subject: Consistency of reserved operators and bang patterns In-Reply-To: <46E1A468.5000002@gmail.com> References: <46E1A468.5000002@gmail.com> Message-ID: <46E1EBD3.50309@charter.net> Twan van Laarhoven wrote: > The bang pattern proposal [1] still allows (!) to be used as an > operator. I think there should be no difference in this regard between ! > and ~, since they are used in exactly the same location. > > In my opinion the best thing would be to allow (~) and (@) as operators. > With the same restriction on definition as (!), i.e. they must be > defined in function style, not as an operator. > > The change to the syntax would be to remove @ and ~ from the reserved > operators list [2], > reservedop -> .. | : | :: | = | \ | | | <- | -> | @ | ~ | => > making it > reservedop -> .. | : | :: | = | \ | | | <- | -> | => I agree - it confused me in the past that I couldn't define (@) or (~) operators. Bang-pattern syntax being active will still change the meaning of x ! y = z of course. > Oh, and while we are at it, I think (:) should also be removed as a > reservedop, there is no reason for it to be on that list. Backwards compatibility requires that it be implicitly imported from Prelude even in a module that does "import Prelude ( )" (although Hugs is already broken in this regard). And that makes it fairly useless as a non-reserved symbol. If not for that issue, I agree. Isaac From isaacdupree at charter.net Fri Sep 7 20:29:35 2007 From: isaacdupree at charter.net (Isaac Dupree) Date: Fri Sep 7 20:20:48 2007 Subject: Consistency of reserved operators and bang patterns In-Reply-To: <46E1EBD3.50309@charter.net> References: <46E1A468.5000002@gmail.com> <46E1EBD3.50309@charter.net> Message-ID: <46E1ECEF.2060708@charter.net> Isaac Dupree wrote: > Twan van Laarhoven wrote: >> Oh, and while we are at it, I think (:) should also be removed as a >> reservedop, there is no reason for it to be on that list. > > Backwards compatibility requires that it be implicitly imported from > Prelude even in a module that does "import Prelude ( )" (although Hugs > is already broken in this regard). In particular, Haskell-98 bans import Prelude ( (:) ) From ndmitchell at gmail.com Sat Sep 8 04:12:01 2007 From: ndmitchell at gmail.com (Neil Mitchell) Date: Sat Sep 8 04:02:19 2007 Subject: Consistency of reserved operators and bang patterns In-Reply-To: <46E1ECEF.2060708@charter.net> References: <46E1A468.5000002@gmail.com> <46E1EBD3.50309@charter.net> <46E1ECEF.2060708@charter.net> Message-ID: <404396ef0709080112u3cc2c71bgb8f4e1a46d0b30de@mail.gmail.com> Hi Re ! as an operator: This caused a number of complexities in the parsing of stuff, including shift-reduce conflicts. Someone would need to look into this, and determine that the rules are completely unambiguous. > > Backwards compatibility requires that it be implicitly imported from > > Prelude even in a module that does "import Prelude ( )" (although Hugs > > is already broken in this regard). > > In particular, Haskell-98 bans > > import Prelude ( (:) ) Yhc does not meet this restriction either. Perhaps this is a change that is breaking but minor enough to be permitted for H', since everyone already does the reverse. Thanks Neil From bos at serpentine.com Tue Sep 11 14:49:10 2007 From: bos at serpentine.com (Bryan O'Sullivan) Date: Tue Sep 11 14:42:51 2007 Subject: Instances of Read on bounded integral types should detect overflow Message-ID: <46E6E326.8070002@serpentine.com> Here's a pet hobbyhorse of mine. Prelude> read "3333333333333333333333" :: Int -5527344008095509163 Other fixed-width integral types (those in Data.Int and Data.Word) behave similarly. I'd prefer to see the whole lot throw an overflow exception upon detecting a wraparound. I'll be happy to provide a sample implementation. References: <46E1A468.5000002@gmail.com> <46E1EBD3.50309@charter.net> Message-ID: <20070928004613.GA17616@momenergy.repetae.net> On Fri, Sep 07, 2007 at 09:24:51PM -0300, Isaac Dupree wrote: > >Oh, and while we are at it, I think (:) should also be removed as a > >reservedop, there is no reason for it to be on that list. > > Backwards compatibility requires that it be implicitly imported from > Prelude even in a module that does "import Prelude ( )" (although Hugs > is already broken in this regard). And that makes it fairly useless as > a non-reserved symbol. If not for that issue, I agree. jhc is also broken in this regard. (:) is treated like any other constructor. John -- John Meacham - ?repetae.net?john?