Donald Bruce Stewart wrote:
So all this talk of locating head [] and fromJust failures got me
thinking:
Couldn't we just use rewrite rules to rewrite *transparently*
all uses of fromJust to safeFromJust, tagging the call site
with a location?
I'm sorry for shifting the topic:
oleg:
Donald Bruce Stewart wrote:
So all this talk of locating head [] and fromJust failures got me
thinking:
Couldn't we just use rewrite rules to rewrite *transparently*
all uses of fromJust to safeFromJust, tagging the call site
with a location?
I'm sorry for
| The fromJust and `head of empty list' errors are totally equivalent to
| the dereferencing of zero pointer in C++ or NullPointerException in
| Java. It pains me to see that exactly the same problem arises in
| Haskell -- keeping in mind that already in C++ and Java one may
| exterminate
Hi
I have always been wondering why error shouldn't always return a call
stack from the occurrance of fromJust up to the function I typed into
ghci (or up to main, for that matter).
yhi-stack (as yet unreleased) does exactly this, without requiring you
to recompile your code even.
hat-stack
Hi
Yes, these techniques are fairly well known now, and hopefully some of
the more experienced Haskellers are using them (I certainly use the
non-empty list tricks). Any anyone with more than 6 months Haskell knows
to avoid fromJust.
I'm not, I use fromJust all the time. Ditto for head, init,
| I have always been wondering why error shouldn't always return a call
| stack from the occurrance of fromJust up to the function I typed into
| ghci (or up to main, for that matter).
|
| I guess this is because the call tree is rewritten extensively before
| being evaluated, and the output
Should Haskell also provide unrestricted side effects, setjmp/
longjmp, missile launching functions, etc? After all, people who
don't want to use them can just avoid them. :)
On Nov 15, 2006, at 05:07 , Neil Mitchell wrote:
Hi
Yes, these techniques are fairly well known now, and
On Wed, Nov 15, 2006 at 09:04:01AM +, Simon Peyton-Jones wrote:
I don't agree. My programs have invariants that I can't always express
in a way that the type system can understand. E.g. I know that a
variable is in scope, so searching for it in an environment can't fail:
head [ v
Hi
Should Haskell also provide unrestricted side effects, setjmp/
longjmp, missile launching functions, etc? After all, people who
don't want to use them can just avoid them. :)
Fair point. But if you eliminate incomplete cases, and the error
function, you'd probably need to increase the
Hello Johannes,
Wednesday, November 15, 2006, 10:36:10 AM, you wrote:
What methods and tools are there for i18n of Haskell programs?
In Haskell, I see at least two problems:
a) reading the file is in IO
if you need utf8 and other encodings support, you can use Streams lib:
h - openFile
Donald Bruce Stewart wrote:
So how do we help out the beginners, other than warning about fromJust,
and providing a useful error message as we can, for when they just go
ahead and use head anyway?
Kill head and tail right now and provide a safe equivalent? Either
uncons :: [a] - Maybe
Hello Lennart,
Wednesday, November 15, 2006, 3:37:34 PM, you wrote:
Should Haskell also provide unrestricted side effects, setjmp/
longjmp, missile launching functions, etc? After all, people who
don't want to use them can just avoid them. :)
these are documented in tackling the awkward
By the way, Ihave developped the coreof asearch engine completely in Haskell.
It can index arbitrary objects (including files, of course)
has definitions for filters, with predefined filters for plain text, HTML/XML and ageneral filter for Haskell data types
It has basic search capabilities: it
On Tue, 14 Nov 2006, Seth Gordon wrote:
It took me a week to figure out the right algorithm for combining these
two procedures and write some almost-working code that implemented it.
It took a co-worker of mine another few days to find the bugs that had
eluded me.
Were these bugs of the
Simon Peyton-Jones [EMAIL PROTECTED] writes:
| The problem I see is that head/fromJust errors are usually
|caused by *beginner* Haskellers, who don't know the
|techniques for statically avoiding them.
I don't agree. My programs have invariants that I can't
always express in a way that the
Hi
Haskell is great for equational reasoning.
blah the_v_in_scope blah
where (the_v_in_scope:_) = [ v | (n,v) - env, n==target ]
This piece of code isn't. If you used head then you could trivially
inline the_v_in_scope, this way is a lot harder. You might spot a
pointfree pattern and lift
Lennart Augustsson [EMAIL PROTECTED] writes:
Should Haskell also provide unrestricted side effects, setjmp/
longjmp, missile launching functions, etc? After all, people who
don't want to use them can just avoid them. :)
Yes.
It is indeed a common problem that programs have unintended
On Nov 15, 2006, at 9:48 AM, Jón Fairbairn wrote:
Simon Peyton-Jones [EMAIL PROTECTED] writes:
| The problem I see is that head/fromJust errors are usually
|caused by *beginner* Haskellers, who don't know the
|techniques for statically avoiding them.
I don't agree. My programs have
Neil Mitchell [EMAIL PROTECTED] writes:
Hi
Haskell is great for equational reasoning.
blah the_v_in_scope blah
where (the_v_in_scope:_) = [ v | (n,v) - env, n==target ]
This piece of code isn't.
Strange. It's semantically the same, isn't it? Indeed, the
definition of head gets you
On 11/15/06, Donald Bruce Stewart [EMAIL PROTECTED] wrote:
Yes, these techniques are fairly well known now, and hopefully some ofthe more experienced Haskellers are using them (I certainly use thenon-empty list tricks). Any anyone with more than 6 months Haskell knows
to avoid fromJust.The problem
On Mon, Nov 13, 2006 at 04:32:34PM +0100, Valentin Gjorgjioski wrote:
import Hugs.Observe
ex8 :: [Float]
ex8 = (observe after reverse ) reverse [10.0,7.0,3.0,0.0,4.0]
gives me
ex8
[4.0,0.0,3.0,7.0,10.0]
Observations
after reverse
{ \ ($-990871 : $-990888 : $-990905 :
Robert Dockins [EMAIL PROTECTED] writes:
On Nov 15, 2006, at 9:48 AM, Jón Fairbairn wrote:
But instead of “blah (head [ v | (n,v) - env, n==target ])
blah”, you could write
blah the_v_in_scope blah
where (the_v_in_scope:_) = [ v | (n,v) - env, n==target ]
Or how about ??
On 15.11.2006 17:38 Ross Paterson wrote:
On Mon, Nov 13, 2006 at 04:32:34PM +0100, Valentin Gjorgjioski wrote:
import Hugs.Observe
ex8 :: [Float]
ex8 = (observe after reverse ) reverse [10.0,7.0,3.0,0.0,4.0]
gives me
ex8
[4.0,0.0,3.0,7.0,10.0]
Observations
Robert Dockins wrote:
Or how about ??
lookupVarible target env =
case [ v | (n,v) - env, n==target ] of
(x:_) - x
_ - assert False $ BUG: Unexpected variable out of scope
++(show target)++ in environment ++(show env)
Other have pointed out that, in the CURRENT Haskell
As Lily Tomlin would say, neVERmind.
Simon P-J asked me, in email, whether the deforestation was the thing
that actually made the program faster or whether it was just the thing
that made me think about how to solve the problem. I realized that my
fast program had *another* difference from the
From: Robert Dockins [EMAIL PROTECTED]
It seems to me that every possible use of a partial function has
some (possibly imagined) program invariant that prevents it from
failing. Otherwise it is downright wrong. 'head',
'fromJust' and friends don't do anything to put that invariant in
Hi,
I've been trying to compile the following function
(rounding to a desired degree):
roundDec :: (Num a, Typeable a) = Int - a - a
roundDec d a =
let t = show (typeOf a)
in case t of
Double - roundDDec d a
Complex Double - roundCDec d a
isto wrote:
] I've been trying to compile the following function
] (rounding to a desired degree):
]
] roundDec :: (Num a, Typeable a) = Int - a - a
] roundDec d a =
] let t = show (typeOf a)
] in case t of
] Double - roundDDec d a
] Complex Double -
John Hughes wrote:
From: Robert Dockins [EMAIL PROTECTED]
It seems to me that every possible use of a partial function has some
(possibly imagined) program invariant that prevents it from failing.
Otherwise it is downright wrong. 'head', 'fromJust' and friends
don't do anything to put that
On Wednesday 15 November 2006 15:53, John Hughes wrote:
From: Robert Dockins [EMAIL PROTECTED]
It seems to me that every possible use of a partial function has some
(possibly imagined) program invariant that prevents it from failing.
Otherwise it is downright wrong. 'head', 'fromJust'
Hi,
Let's transfer this to wxhaskell-users.
I've attached your example as a small .lhs file and makefile. For
Debian Linux, uncomment the -lwx_gtk2u_gl-2.6 line or otherwise,
modify to taste.
The following code doesn't seem to work properly. Either the main entry
(m1/mp1) or it's sub menu
On Nov 15, 2006, at 3:21 AM, [EMAIL PROTECTED] wrote:
Donald Bruce Stewart wrote:
So all this talk of locating head [] and fromJust failures got me
thinking:
Couldn't we just use rewrite rules to rewrite *transparently*
all uses of fromJust to safeFromJust, tagging the call site
On Wed, Nov 15, 2006 at 23:10:44 +0100, Eric Y. Kow wrote:
I've attached your example as a small .lhs file and makefile. For
Debian Linux, uncomment the -lwx_gtk2u_gl-2.6 line or otherwise,
modify to taste.
Here are the files, really attached this time.
--
Eric Kow
Probably unrelated, but this thread is what triggered it for me.
There is a minor bug in showing impredicative types without
-fglasgow-exts: *hope I got that right*
Prelude let x = [] :: [forall a. a]
interactive:1:23:
Warning: Accepting non-standard infix type constructor `.'
This isn't a trivial point. We know that error handling code is a major part of software cost--it
can even dominate the cost of the correct case code (by a large factor). Erlang's program for
the correct case strategy, coupled with good fault tolerance mechanisms, is one reason for its
Couldn't we just use rewrite rules to rewrite *transparently*
all uses of fromJust to safeFromJust, tagging the call site
with a location?
..
Looks good! But that is deceiving: the assert was expanded before the rule
fired, and refers to the rewrite rule source line (line 19), not the
| Looks good! But that is deceiving: the assert was expanded before the rule
| fired, and refers to the rewrite rule source line (line 19), not the fromJust
| call site (line 12). Now if we could just have the 'assert' token inserted
| into the AST before it was expanded, we'd be home and dry.
Hi,
I'm using GHC 6.6 (debian/etch) - and having some fun with
threadDelay. When compiled without the -threaded compiler argument it
behaves as documented - waits at least the interval - for example:
Tgt/Actual = 0.00/0.036174s, diff = 0.036174s
Tgt/Actual = 0.01/0.049385s, diff =
It must be stressed that the advocated technique for avoiding partial
function errors requires *NO* research advances, *NO* dependent types,
*NO* annotations, and *NO* tools. Everything is possible in Haskell as
it is -- actually, even in Haskell98. As a matter of fact, exactly the
same approach
Hi all,
I have been trying to install Hat for the last couple of days but GHC does
not recognize it as a package. I compiled 2.05 from source, but at the 'make
install' step I see this error message:
**Begin Output**
./configure --install
Configuring for hat... [ 2.05 ]
Starting with earlier
Jan-Willem Maessen wrote:
In addition, we have this rather nice assembly of functions which
work on ordinary lists. Sadly, rewriting them all to also work on
NonEmptyList or MySpecialInvariantList is a nontrivial task.
That's an excellent question. Indeed, let us assume we have a
41 matches
Mail list logo