Hi all,
Recently, I participated in a coding competition.
As part of it, I had to write a program wherein I had to make my data-type
an instance of Ord. An error in my implementation of compare resulted in me
losing quite a bit of valuable time.
As I wrote it, I had tested it out on the ghci and
Use QuickCheck.
2009/5/29 Hemanth Kapila saihema...@gmail.com:
Hi all,
Recently, I participated in a coding competition.
As part of it, I had to write a program wherein I had to make my data-type
an instance of Ord. An error in my implementation of compare resulted in me
losing quite a bit
What comes to my mind is that you could launch your program from
inside GHCi, instead of the other way round. Just write an IO ()
function that spawns a new thread for the window, graphics, input
handling and all that. Call this function from GHCi and your window
will appear. Then write some other
Eugene Kirpichov wrote:
Use QuickCheck.
Also use SmallCheck or lazy SmallCheck.
All of these are automatic tools that allow you to specify laws[1] and
automatically generate values for testing the law. QuickCheck generates
values randomly, which can be useful but is very often insufficient.
Excerpts from Bulat Ziganshin's message of Thu May 28 15:07:02 +0200 2009:
Hello Lennart,
Thursday, May 28, 2009, 11:57:09 AM, you wrote:
-- | Generalization of the 'Bool' type. Used by the generalized 'Eq' and
'Ord'.
class Boolean bool where
() :: bool - bool - bool --
Duncan Coutts duncan.cou...@worc.ox.ac.uk writes:
FWIW, I've used Data.Binary extensively and have found it a joy to
work with. I've used it to serialize/deserialize ethernet packets in
real time for a VPN implementation and have never had a problem. It's
quite fast and robust.
Is that code
Conal Elliott wrote:
Sittampalam, Ganesh wrote
In my experience [1], observable sharing using GHC's stable names is a
pretty effective solution to this problem.
Plus unsafePerformIO and weak references as in *Stretching the storage
manager: weak pointers and stable names in
I need to force a library to be searched for unresolved symbols after all
other libraries have been searched, and I would rather not resort to
constructing the linker command line directly. Is there a way to do this?
i.e. I want for example -lfoo to appear after all other haskell libraries
Lazy parsing has been the default for the last ten years in uulib, and
is now available in the simple uu-parsinglib (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uu-parsinglib
). The whole design of the latter in described in a technical report
to which references are given on
On Fri, May 29, 2009 at 2:17 AM, Simon Michael si...@joyful.com wrote:
Achim Schneider wrote:
expected/encountered
Expected/actual ? Familiar to users of test frameworks.
That does sound better than expected/inferred to me.
-- Johan
___
In the uu-parsinglib we actually have two versions of parsers: lazy
ones and strict ones, which have different types. So by giving a type
annotation you can select the one you want. Notice that in the left-
hand side of a monadic construct it does not make sense to use a lazy
parser, since
Bartosz Wójcik wrote:
Hi Everybody (especially Parsec Creator),
is there any reason why float parses only positive numbers?
I find following defition:
float = lexeme floating ? float
floating= do{ n - decimal
; fractExponent n
Hi all,
GHC is not happy with this:
f = [] == []
nor this:
f' = ([]::(Eq a) = [a]) == ([]::(Eq a) = [a])
but this is OK:
f'' = ([]::[Integer]) == ([]::[Integer])
GHCI is comfortable with [] == [], so why not GHC? 'Just curious.
Cheers,
Paul
___
2009/5/29 Paul Keir pk...@dcs.gla.ac.uk:
Hi all,
GHC is not happy with this:
f = [] == []
This fails because GHC doesn't know which 'a' you mean, and can't
choose an Eq instance.
nor this:
f' = ([]::(Eq a) = [a]) == ([]::(Eq a) = [a])
This fails for the same reason.
but this is OK:
* Paul Keir pk...@dcs.gla.ac.uk [2009-05-29 10:47:26+0100]
Hi all,
GHC is not happy with this:
f = [] == []
nor this:
f' = ([]::(Eq a) = [a]) == ([]::(Eq a) = [a])
Here, there's no guarantee that the answer will be the same independent
of what 'a' you choose. Potentially, you could
f''' = ([]::[()]) == ([]::[()])
(Very pretty.)
So why doesn't ghc have 'default' instances?
-Original Message-
From: Eugene Kirpichov [mailto:ekirpic...@gmail.com]
Sent: Fri 29/05/2009 10:51
To: Paul Keir
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] [] == [][MESSAGE NOT
On Fri, May 29, 2009 at 12:29 PM, Paul Keir pk...@dcs.gla.ac.uk wrote:
f''' = ([]::[()]) == ([]::[()])
(Very pretty.)
So why doesn't ghc have 'default' instances?
It does. I believe Num defaults to Integer and then to Double.
Generally, though, defaults are convenient in exploratory usage
Dear Doaitse,
In the days since my original post I had already come to favor the
uu-parsing package. I have printed the report and read it every day to
figure out how to use it. I cannot follow everything yet, and also hope
that won't be necessary in order to use it. :-)
My progress is a bit
Thanks Eugene and wren.
Serves me right, actually. The one chapter I skipped in RWH was the 11th one
called Testing and Quality Assurance thinking it is too boring.
On Fri, May 29, 2009 at 12:44 PM, wren ng thornton w...@freegeek.orgwrote:
Eugene Kirpichov wrote:
Use QuickCheck.
Also use
Hi,
I'd like to make my ADT an instance of the Floating class,
but I'm not sure what to put for pi, and GHC gives a warning
without it:
Warning: No explicit method nor default method for `GHC.Float.pi'
I tried setting it to undefined, but that gives an error:
`pi' is not a (visible) method of
Hi there,
i am currently working on the mapreduce framework
(http://darcs2.fh-wedel.de/repos/holumbus/) which can also be found in
hackage.
I was doing the simple WordFrequency example, which does nothing but
counting word frequencies and runs a few seconds.
When I run this program
Hi all,
Is it possible with Haskell to call a function whose name is contained
in a String?
Something like:
five = call_func add [2, 3]
If not, perhaps this is acheivable using FFI?
Thanks a lot,
Patrick Leboutillier
--
=
Patrick LeBoutillier
Rosemère, Québec, Canada
From: haskell-cafe-boun...@haskell.org
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of
Is it possible with Haskell to call a function whose name is contained
in a String?
Something like:
five = call_func add [2, 3]
If not, perhaps this is acheivable using FFI?
Dynamic loading
2009/5/29 Paul Keir pk...@dcs.gla.ac.uk:
Hi,
I'd like to make my ADT an instance of the Floating class,
but I'm not sure what to put for pi, and GHC gives a warning
without it:
Warning: No explicit method nor default method for `GHC.Float.pi'
I tried setting it to undefined, but that
Call for Papers
IFL 2009
Seton Hall University
SOUTH ORANGE, NJ, USA
http://tltc.shu.edu/blogs/projects/IFL2009/
** NEW **
Accomodations information available:
http://tltc.shu.edu/blogs/projects/IFL2009/accommodations.html
Jane Street Capital has joined IFL 2009 as a sponsor
*
The
Patrick LeBoutillier wrote:
Hi all,
Is it possible with Haskell to call a function whose name is contained
in a String?
Something like:
five = call_func add [2, 3]
You could use Data.Map:
call_func = (funcMap !)
where funcMap = fromList [ (add, add)
Oops, I was hiding the Prelude's pi. My apologies.
-Original Message-
From: Deniz Dogan [mailto:deniz.a.m.do...@gmail.com]
Sent: Fri 5/29/2009 5:01 PM
To: Paul Keir
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Floating instance and pi[MESSAGE NOT SCANNED]
2009/5/29 Paul Keir
On Friday 29 of May 2009 19:34:44 Patrick LeBoutillier wrote:
Hi all,
Is it possible with Haskell to call a function whose name is contained
in a String?
Something like:
five = call_func add [2, 3]
If not, perhaps this is acheivable using FFI?
Or maybe you are asking for template
Hi,
The following expression evaluates to 1 in GHCi, but results in an
error in Hugs:
let f x = let g y = [x,y] in (g 1, g []) in 1
What is the correct behavior?
Thanks
Vladimir
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Just pretend it was named Test Driven Development so it feels more
sexy while you read it :)
-- ryan
On Fri, May 29, 2009 at 5:05 AM, Hemanth Kapila saihema...@gmail.com wrote:
Thanks Eugene and wren.
Serves me right, actually. The one chapter I skipped in RWH was the 11th one
called
http://haskell.org/onlinereport/exps.html#sect3.12
Pattern bindings are matched lazily; an implicit ~ makes these patterns
irrefutable. For example,
let (x,y) = undefined in e
does not cause an execution-time error until x or y is evaluated.
So GHCi is correct.
Dan
Vladimir Reshetnikov
Am Freitag 29 Mai 2009 20:35:47 schrieb Dan Weston:
http://haskell.org/onlinereport/exps.html#sect3.12
Pattern bindings are matched lazily; an implicit ~ makes these patterns
irrefutable. For example,
let (x,y) = undefined in e
does not cause an execution-time error until x or y is
On Friday 29 May 2009 08:34:36 you wrote:
myfloat = try (do{ symbol -; n - float; return (negate n) }) |
try float |
do { i-integer; return(fromIntegral i) }
Thank you, this is an easy and nice solution. I've made it a bit prettier
optically:
myFloat = try (symbol -
On Fri, May 29, 2009 at 3:38 PM, Bartosz Wójcik bar...@sudety.it wrote:
Thank you, this is an easy and nice solution. I've made it a bit prettier
optically:
myFloat = try (symbol - float = return . negate)
| try float
| (integer = return . fromIntegral)
Any time you see =
On Friday 29 May 2009 22:10:51 Bryan O'Sullivan wrote:
myFloat = try (symbol - float = return . negate)
| try float
| (integer = return . fromIntegral)
Any time you see = return ., something is being missed. Use liftM or
$ instead, i.e. fromIntegral $ integer instead of integer
Am Samstag 30 Mai 2009 02:04:29 schrieb Bartosz Wójcik:
On Friday 29 May 2009 22:10:51 Bryan O'Sullivan wrote:
myFloat = try (symbol - float = return . negate)
| try float
| (integer = return . fromIntegral)
Any time you see = return ., something is being missed. Use liftM
On Fri, May 29, 2009 at 8:04 PM, Bartosz Wójcik bar...@sudety.it wrote:
On Friday 29 May 2009 22:10:51 Bryan O'Sullivan wrote:
myFloat = try (symbol - float = return . negate)
| try float
| (integer = return . fromIntegral)
Any time you see = return ., something is being
On Fri, May 29, 2009 at 4:02 AM, Tillmann Vogt
tillmann.v...@rwth-aachen.de wrote:
Bartosz Wójcik wrote:
Hi Everybody (especially Parsec Creator),
is there any reason why float parses only positive numbers?
I find following defition:
float = lexeme floating ? float
floating
On Fri, May 29, 2009 at 5:04 PM, Bartosz Wójcik bar...@sudety.it wrote:
I don't undersdand what is being missed.
Brevity.
liftM f m1 = do { x1 - m1; return (f x1) }
so
liftM fromIntegral integer
will result the same.
Yes, and there's less code to read if you use liftM or
I'm trying to use Database.HDBC.ODBC to connect to a MySQL server, and I cannot
figure out the docs. I want to establish a connection, and I know the server
url, username, and password. According to these docs...
Try this:
http://www.connectionstrings.com/
On Fri, May 29, 2009 at 8:01 PM, Michael P Mossey
m...@alumni.caltech.edu wrote:
I'm trying to use Database.HDBC.ODBC to connect to a MySQL server, and I
cannot figure out the docs. I want to establish a connection, and I know the
server url,
Usually you should pass only DSN name in the string, if you used InnoDB
database in MySQL.
For example, /etc/odbc.ini file:
;
; odbc.ini configuration for MyODBC and MyODBC 3.51 Drivers
;
[.]
[Default]
Driver = MySQL
Description = MySQL ODBC 3.51 Driver DSN
Server = localhost
42 matches
Mail list logo