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
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
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
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
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 ~ !
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
| 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.
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
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]
| | 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
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
/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
| 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
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
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
15 matches
Mail list logo