Re: Bang Patterns

2014-04-02 Thread wren romano
On Tue, Apr 1, 2014 at 3:02 PM, Dan Doel dan.d...@gmail.com wrote: Specifically, consider: case Nothing of !(~(Just x)) - 5 Nothing - 12 Now, the way I'd expect this to work, and how I think the spec says it works, is that my Nothing is evaluated, and then the irrefutable

Re: Bang Patterns

2014-04-02 Thread Dan Doel
Filed. Bug #8952. On Wed, Apr 2, 2014 at 3:41 PM, wren romano winterkonin...@gmail.comwrote: On Tue, Apr 1, 2014 at 3:02 PM, Dan Doel dan.d...@gmail.com wrote: Specifically, consider: case Nothing of !(~(Just x)) - 5 Nothing - 12 Now, the way I'd expect this to

Bang Patterns

2014-04-01 Thread Dan Doel
Greetings, I've been thinking about bang patterns as part of implementing our own Haskell-like compiler here, and have been testing out GHC's implementation to see how it works. I've come to one case that seems like it doesn't work how I think it should, or how it is described, and wanted to ask

RE: Suggestion for bang patterns documentation

2009-02-27 Thread Simon Peyton-Jones
good idea. done | -Original Message- | From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell-users- | boun...@haskell.org] On Behalf Of Brian Bloniarz | Sent: 27 February 2009 03:56 | To: glasgow-haskell-users@haskell.org | Subject: Suggestion for bang patterns

Re: Suggestion for bang patterns documentation

2009-02-27 Thread Christian Maeder
Brian Bloniarz wrote: I got confused by the GHC documentation recently, I was wondering how it could be improved. From: http://www.haskell.org/ghc/docs/latest/html/users_guide/bang-patterns.html Seeing the rule pat ::= !pat you'll probably want to avoid patterns like: !!pat, ! ! pat, or ~ !

Re: Suggestion for bang patterns documentation

2009-02-27 Thread Christian Maeder
Brian Bloniarz wrote: I got confused by the GHC documentation recently, I was wondering how it could be improved. From: http://www.haskell.org/ghc/docs/latest/html/users_guide/bang-patterns.html cite The let-binding can be recursive. However, it is much more common for the let-binding to be

RE: Suggestion for bang patterns documentation

2009-02-27 Thread Simon Peyton-Jones
| cite | The let-binding can be recursive. However, it is much more common for | the let-binding to be non-recursive, in which case the following law | holds: (let !p = rhs in body) is equivalent to (case rhs of !p - body) | /cite | | Shouldn't the bang be removed in the final case pattern? No.

Re: Suggestion for bang patterns documentation

2009-02-27 Thread Christian Maeder
Simon Peyton-Jones wrote: | cite | The let-binding can be recursive. However, it is much more common for | the let-binding to be non-recursive, in which case the following law | holds: (let !p = rhs in body) is equivalent to (case rhs of !p - body) | /cite | | Shouldn't the bang be removed

Suggestion for bang patterns documentation

2009-02-26 Thread Brian Bloniarz
I got confused by the GHC documentation recently, I was wondering how it could be improved. From: http://www.haskell.org/ghc/docs/latest/html/users_guide/bang-patterns.html A bang only really has an effect if it precedes a variable or wild-card pattern: f3 !(x,y) = [x,y] f4 (x,y) = [x,y]

RE: bang patterns give fundamentally new capabilities?

2006-12-08 Thread Simon Peyton-Jones
| | Also, is there a way to do something similar but for 'lazy' rather than | | 'seq'? I want something of type | | | | type World__ = State# RealWorld | | | | {-# NOINLINE newWorld__ #-} | | newWorld__ :: a - World__ | | newWorld__ x = realWord# -- ??? | | | | except that I need

Re: bang patterns give fundamentally new capabilities?

2006-12-04 Thread Kirsten Chevalier
On 12/3/06, John Meacham [EMAIL PROTECTED] wrote: On Sat, Dec 02, 2006 at 11:02:28PM +, Simon Peyton-Jones wrote: [snip] | Also, is there a way to do something similar but for 'lazy' rather than | 'seq'? I want something of type | | type World__ = State# RealWorld | | {-# NOINLINE

Re: bang patterns give fundamentally new capabilities?

2006-12-03 Thread John Meacham
/1031 I assumed it was because I was passing an unboxed value to seq because when I switched them all to bang patterns, it started to work. but I guess it was a different issue alltogether. GHC has a kinding system that looks quite similar to the one you described for jhc. Here's teh

RE: bang patterns give fundamentally new capabilities?

2006-12-02 Thread Simon Peyton-Jones
| I was recently presented with the problem of writing a function like so | | seqInt__ :: forall a . a - Int# - Int# | seqInt__ x y = x `seq` y | | which seems fine, except 'seq' of type forall a b . a - b - b cannot | be applied to an unboxed value. Actually it works fine. Did you try it? Seq

bang patterns give fundamentally new capabilities?

2006-11-30 Thread John Meacham
wanted until I remembered bang patterns. seqInt__ :: forall a . a - Int# - Int# seqInt__ !x y = y which seems to work! my question is, is this actually something fundamentally new that bang patterns allow or was I just not able to figure out the old way to do it? Also, is there a way to do

Re: bang patterns give fundamentally new capabilities?

2006-11-30 Thread Tomasz Zielonka
On Thu, Nov 30, 2006 at 08:13:13PM -0800, John Meacham wrote: I was recently presented with the problem of writing a function like so seqInt__ :: forall a . a - Int# - Int# seqInt__ x y = x `seq` y which seems fine, except 'seq' of type forall a b . a - b - b cannot be applied to an