Use QuickCheck.
2009/5/29 Hemanth Kapila :
> 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
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
And I thought everyone was puzzling these type signatures out all by
themselves. ;-)
The Haskell learning curve is about the steepest I've ever seen for a computer
language, but I think I'm catching on.
Thanks for the info.
Michael
--- On Thu, 5/28/09, wren ng thornton wrote:
From: wren ng
Thanks! I just copied the code from the PDF file. Whatever that character was
it wasn't the correct one.
Michael
--- On Thu, 5/28/09, Andrew Wagner wrote:
From: Andrew Wagner
Subject: Re: [Haskell-cafe] Problem w/YAHT code example
To: "michael rice"
Cc: haskell-cafe@haskell.org
Date: Thursda
Claus Reinke wrote:
Still, I would really like a "just the facts, please" mode for GHC, with
less text and more type signatures (especially for the contexts of type
mismatches). Error messages simply not including the
information I need has become my main issue with GHC messages,
and seems to b
2009/05/28 Benjamin L.Russell :
> What makes you think that Haskell is likely eventually to "dig
> a smoking hole in the ground?"
This is more about unmet expectations than spectacular
failure.
--
Jason Dusek
___
Haskell-Cafe mailing list
Haskell-Ca
michael rice wrote:
Yeah, I went back and tried double again, though I'd swear I got the dang thing
to compile (and run) w/o errors.
I guess I meant Num. So Num is a class and Int and Integer are types? What are
the other classes? Docs?
Unification, for me, is pattern matching ala Prolog. Wh
On Thu, May 28, 2009 at 11:39 AM, John Van Enk wrote:
> Writing instances encode/decode that use either little endian or big endian
> (or mixed!) is trivial... see attached file.
>
> I don't see where your problem is...
>
Inexperience, lack of enough contiguous time to digest everything at once
I'm not sure what you're using at the end of the identifier "search'", but
it needs to be the single quote that's on the same key as the double quotes.
I suspect that's where it's blowing up.
On Thu, May 28, 2009 at 9:56 PM, michael rice wrote:
> This code, from YAHT (Section 8.4.2, PDF pg. 119
This code, from YAHT (Section 8.4.2, PDF pg. 119 of 192) seems to have a
problem. Code below.
Michael
=
[mich...@localhost ~]$ ghci
GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking .
Benjamin,
I would like to create a mailing list for Portuguese speaking
Haskell programmers. (...)
According to "Mailing lists - HaskellWiki" (see
http://haskell.org/haskellwiki/Mailing_lists),
Thanks for your comprehensive reports. However, I did
took all measures you sugested.
"Any prob
Achim Schneider wrote:
expected/encountered
Expected/actual ? Familiar to users of test frameworks.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Greetings,
I am very pleased to officially announce Hac phi, a Haskell
hackathon/get-together to be held July 24-26 at the University of
Pennsylvania in Philadelphia. The hackathon will officially kick off
at 2:30 Friday afternoon, and go until 5pm on Sunday (with breaks for
sleep, of course). T
is there any reason why float parses only positive numbers?
It is usual in parsing libraries to separate the recognition of a
leading sign from recognition of the number itself: the sign-only
parser can be reused in many contexts, e.g. in the Haskell'98 Numeric
library, there is
readSi
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
}
If floating was d
I am starting to get more involved with haskell programming and I'd like to
create a program where I can use the interactive loop in ghci to run a
haskell functions that create graphics in a separate openGL window. This
would be a separate interactive window from the terminal i am running ghci
in
On Thu, May 28, 2009 at 14:41, Bertram Felgenhauer
wrote:
> Krzysztof Skrzętnicki wrote:
>> 2009/5/27 Bertram Felgenhauer :
>> > I wrote:
>> >> Krzysztof Skrzętnicki wrote:
>> >>> The code for modifying the counter:
>> >>> (\ msg -> atomicModifyIORef ioref (\ cnt -> (cntMsg cnt msg,(
>> >>
>>
Writing instances encode/decode that use either little endian or big endian
(or mixed!) is trivial... see attached file.
I don't see where your problem is...
On Thu, May 28, 2009 at 12:35 PM, David Leimbach wrote:
>
>
> On Thu, May 28, 2009 at 9:17 AM, John Van Enk wrote:
>
>>
>>> Fair enoug
On Thu, May 28, 2009 at 6:34 PM, Duncan Coutts
wrote:
> If it's not available publicly perhaps you might share it privately. Don
> and I have discussed a few times writing a paper on the design and
> implementation of a binary library.
>
I would definitely like to read such a paper. Except for Do
The main change I would make is to rename the arguments to
client/server; they overload the same names (reqs/resps) as the top
level declarations above, so it's very easy to get confused while
reading it.
Partially, I think this is just a hard concept to understand;
struggling to figure it out def
leimy2k:
> encode/decode do Big Endian, and 9P does little endian.
>
> From the man page:
>
> "Each message consists of a sequence of bytes. Two , four , and eight byte
> fields hold unsigned integers represented in little endian order (least
> significant byte first)."
>
> encode/decode just w
On Thu, May 28, 2009 at 9:17 AM, John Van Enk wrote:
>
>> Fair enough. I am just new to the interface, wondering if I should
>> try matching responses by pulling apart via Get, or the bit syntax
>> package.
>>
>>
>
> I'm assming you have some 'data Foo = ...'? If this is the case, you're
> prob
On Thu, 2009-05-28 at 12:08 -0400, John Van Enk wrote:
>
> I'm trying to implement the protocol, so that I can implement
> other things on top of that.
>
> I'm also trying to figure out how bad/good Haskell Binary IO
> really is that it's been a
John Dorsey wrote:
> As another native English speaker, I found "expected/inferred" very
> intuitive when I was new to GHC, and to Haskell. I even think that
> "expected/inferred" helped me form my intuition about Haskell's type
> inference.
>
First off, me too, and I'm not a native speaker.
OT
>
>
> Fair enough. I am just new to the interface, wondering if I should
> try matching responses by pulling apart via Get, or the bit syntax
> package.
>
>
I'm assming you have some 'data Foo = ...'? If this is the case, you're
probably okay writing an instance of Binary for Foo and using encod
On Thu, 28 May 2009, Simon Marlow wrote:
Quite. I argued the "no orphan instances in libraries" position on the
libraries list last year, here's the start of the (longish) thread:
http://www.haskell.org/pipermail/libraries/2008-September/010618.html
I remember. What I propose additionally
On Thursday, May 28, 2009, Don Stewart wrote:
> leimy2k:
>> I'm also trying to figure out how bad/good Haskell Binary IO really is that
>> it's been addressed a few times differently :-)
>
> FWIW Binary IO as implemented in Data.Binary is widely used in our
> production systems at Galois. I'd be f
>
>
> I'm trying to implement the protocol, so that I can implement other things
> on top of that.
>
> I'm also trying to figure out how bad/good Haskell Binary IO really is that
> it's been addressed a few times differently :-)
>
>
FWIW, I've used Data.Binary extensively and have found it a joy t
On 27/05/2009 22:02, Henning Thielemann wrote:
My proposal is thus: Discourage orphan instances! If you encounter that
an instance is missing and it is a canonical one, it should be added to
the package that defines the type or the class. If there are several
choices for the implementation then
leimy2k:
> I'm also trying to figure out how bad/good Haskell Binary IO really is that
> it's been addressed a few times differently :-)
FWIW Binary IO as implemented in Data.Binary is widely used in our
production systems at Galois. I'd be fairly confident in it.
-- Don
_
As far as I can tell, there is not way to create CellRenderer that could
include icons with the text (I think it is because of incompatibilities of
Haskell type classes and Gtk inheritance hierarchy).
Is it a good way to use CellRendererPixbuf and render to pixbufs using Cairo? I
think my TreeV
Bulat Ziganshin wrote:
> Hello Achim,
>
> Thursday, May 28, 2009, 1:34:55 AM, you wrote:
>
> >> Error: type of x is Integer
> >> while type of read argument should be String
> >>
> > The problem with this is that the compiler can't know whether or not
> > the type of arguments to read should
On Thu, May 28, 2009 at 5:42 AM, Khudyakov Alexey wrote:
> On Thursday 28 of May 2009 07:52:56 David Leimbach wrote:
> > Sorry took so long to get back... Thank you for the response. Been
> really
> > busy lately :-)
> >
> > There are also a lot of 9P implementations in many languages that you c
Thanks Wren, that makes sense.
Ryan Ingram wrote:
> Think of classes like data declarations; an instance with no context
> is a constant, and one with context is a function. Here's a simple
> translation of your code into data; this is very similar to the
> implementation used by GHC for typeclas
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 -- ^Logical conjunction.
> (||) :: bool -> bool -> bool -- ^Logical disjunct
Krzysztof Skrzętnicki wrote:
> 2009/5/27 Bertram Felgenhauer :
> > I wrote:
> >> Krzysztof Skrzętnicki wrote:
> >>> The code for modifying the counter:
> >>> (\ msg -> atomicModifyIORef ioref (\ cnt -> (cntMsg cnt msg,(
> >>
> >> atomicModifyIORef does not force the new value of the IORef.
> >>
Or overloading the `whitespace operator' for several kinds of
application.
On May 28, 2009, at 9:50 AM, Augustsson, Lennart wrote:
And explicit desugaring of list syntax.
-Original Message-
From: Sittampalam, Ganesh [mailto:ganesh.sittampa...@credit-
suisse.com]
Sent: 28 May 2009 08
On Thursday 28 of May 2009 07:52:56 David Leimbach wrote:
> Sorry took so long to get back... Thank you for the response. Been really
> busy lately :-)
>
> There are also a lot of 9P implementations in many languages that you can
> interoperate with:
>
> http://9p.cat-v.org/implementations
>
Thank
2009/5/28 Petr Pudlak :
> Hi Ryan, thanks for a nice and thorough explanation. I had trouble
> understanding the section of the tutorial as well. Maybe it would deserve to
> rewrite to something a bit simpler?
>
> Anyhow, I'd like to ask: Is there a reason for which pattern matching for
> single-co
Hi Ryan, thanks for a nice and thorough explanation. I had trouble
understanding the section of the tutorial as well. Maybe it would deserve to
rewrite to something a bit simpler?
Anyhow, I'd like to ask: Is there a reason for which pattern matching for
single-constructor data types isn't lazy by
On Thu, May 28, 2009 at 5:59 AM, Conal Elliott wrote:
> Thanks for bringing in this angle, David.
>
> My preference is for honest and humble practice and documentation of
> negative design. Instead of saying that something "won't work", "can't
> work", "is impossible" etc (or rephrased via "must"
On Thu, May 28, 2009 at 5:19 PM, Gracjan Polak wrote:
> You don't have to guess then, Haskell compiler can do the guessing for you.
It isn't guess, Haskell compiler (like GHC) gets these types by (type)
inference, as you said :-)
lee
> It is called type inference.
__
Of course once you've got ifthenelse you find yourself wanting explicit
desugaring of pattern matching (could view patterns help here?),
Could you be more specific about what you want there, perhaps
with a small example? I recognize the other problems from my own
forays into EDSLs, but I'm not s
Thanks. GHC at one stage suggested I add (Num a) =>
to my Num instance (after I'd added (Eq a) => to my Eq
instance) and I didn't make the connection.
-Original Message-
From: Ryan Ingram [mailto:ryani.s...@gmail.com]
Sent: Thu 28/05/2009 01:18
To: Paul Keir
Cc: haskell-cafe@haskell.org
S
Henning Thielemann wrote:
> I don't think that it is in general possible to use the same parser
> for lazy and strict parsing, just because of the handling of parser
> failure.
Polyparse demonstrates that you can mix-and-match lazy parsers with
strict parsers in the different parts of a grammar
One user's view of error message history, perhaps helpful to reformers:-)
Once upon a time, Hugs tended to have "better" error messages than GHC.
They still weren't perfect, mostly when begginners where confronted with
messages referring to advanced concepts - eg, Simon Thompson had a list
of t
michael rice yahoo.com> writes:
> I've been digging into this stuff for months and it's still tripping me up.
For exploration use GHCi. It can tell you the type of thing you have written. It
has command to tell you type of thing, the ":t". See here:
Prelude> let double x = Just (x + x)
Prelude>
Here's what I usually use. As Simon points out, ambiguity is lurking
as soon as you use conditional. You can avoid it a fundep, but that's
not necessarily what you want either.
-- | Generalization of the 'Bool' type. Used by the generalized 'Eq' and 'Ord'.
class Boolean bool where
(&&) ::
There are multiple possible classes that you might want under different
circumstances (I think the most interesting issue is whether the class
(==), (>) etc is in has a fundep from the type of the thing being
compared to the type of the boolean), but if NoImplicitPrelude (or some
other extension) j
On Wed, 27 May 2009 11:31:07 -0700, Jason Dusek
wrote:
> What can we say to that? I'm well practiced in handling those
> who reject types outright (Python programmers), those who
> reject what is too different (C programmers), those who can
> not live without objects (Java programmers), those
You are absolutely right about the tantalising opportunity. I know that
Lennart has thought quite a bit about this very point when designing his
Paradise system. Likewise Conal for Pan.
One difficulty is, I think, that it's easy to get ambiguity. Eg
ifthenelse (a > b) e1 e2
The (a>b)
张旭 writes:
> Hi, I am really new to haskell. I am reading "A gentle instruction
> to haskell" now. And I just cannot understand the chapter below. Is
> there anybody who can gives me some hints about why the pattern
> matching for "client" is so early? How does the pattern matching
> works here?
You already have splicing for top level decls. Splicing for local decls is a
whole different ball game because it brings new *binders* into scope. For
example
f = ...g...
g = let $(foo) in ...f...
Is the 'f' inside 'g' the same 'f' as the one bound at top level? Not
necessarily, because $(fo
53 matches
Mail list logo