Lennart Augustsson wrote:
I think your first try looks good.
[snip]
...
addPoly1 p1@(p1h@(Nom p1c p1d):p1t) p2@(p2h@(Nom p2c p2d):p2t)
| p1d == p2d = Nom (p1c + p2c) p1d : addPoly1 p1t p2t
| p1d < p2d = p1h : addPoly1 p1t p2
| p1d > p2d = p2h : addPoly1 p1 p2t
...
The last comparison
On 09/10/06, Seth Gordon <[EMAIL PROTECTED]> wrote:
I finally (think I) understand monads well enough to make one up:
> module Secret (Secret, classify, declassify)
> where
>
> data Secret a = Secret a
>
> classify :: a -> Secret a
> classify x = Secret x
>
> declassify :: Secret a -> String ->
On 2006-10-01, Pete Kazmier <[EMAIL PROTECTED]> wrote:
> For those that know python, here is a very simple implementation that
> happens to be very fast compared to my Haskell version and very short:
>
> for line in sys.stdin:
> fields = line.split(',')
Of course, this doesn't handle q
I finally (think I) understand monads well enough to make one up:
module Secret (Secret, classify, declassify)
where
data Secret a = Secret a
classify :: a -> Secret a
classify x = Secret x
declassify :: Secret a -> String -> Maybe a
declassify (Secret x) "xyzzy" = Just x
declassify (Secret x
I forgot to add a couple of things.
First, you mentioned the unknown exception. If you were to replace the
"main =" line with "main = handleSqlError $ ", then you would find a
more useful error message. That will cause HDBC to automatically
transform any uncaught HDBC exception into a standard H
I think your first try looks good. The only thing to worry about
would be the + being too lazy. But that's easy to fix at the same
time as improving your code in another respect.
It's usually good to use real types instead of synonyms, so let's do
that.
data Nom = Nom Int Int
type PolyN
On Mon, Oct 09, 2006 at 04:01:02PM -0600, Tim Smith wrote:
> main =
>do
>dbh <- connectODBC "DSN=test"
>res <- DB.getTables dbh
>-- print (show ((concat . intersperse ", ") res))
>DB.disconnect dbh
>print (show ((concat . intersperse ", ") res))
>
> Am I just expecting the
Hello, Haskell Cafe.
I posted a question a while ago about this, but didn't receive any
responses. I'd like to try again. I've got a test case which uses
John Goerzen's HDBC.ODBC. The problem I have is that it appears too
lazy - using the results of a query after disconnecting causes an
"unkno
Mostly hysterical raisins, I think.
T.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Thanks Misha & Matthias.
I now get what's going on. The mention of the word "dictionary"
revealed it all. I've spent the last 7 years programming in C++, and
had dynamic_cast<> firmly fixed in my head. I totally forgot that
Fergus Henderson and I independently reinvented dictionary passing for
th
On 09/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Cale Gibbard wrote:
> I might also like to point out that by "small" and "large", we're
> actually referring to the number of ways in which components of the
> datastructure can be computed separately, which tends to correspond
> nicely to
Hi,
In the Haskell98 report at http://haskell.org/onlinereport/lexemes.html
section 2.2 has the rule:
whitechar -> newline | vertab | space | tab | uniWhite
Does anyone know what a vertical tab is supposed to do?
Is there any reason to allow them as whitespace? (Does anyone in the
universe
Yang wrote:
>> > But laziness will cause this to occupy Theta(n)-space of cons-ing
>> > thunks.
>>
>> No, it doesn't. Insisting on accumulator recursion does. Actually,
>> using reverse does. Think about it, a strict reverse cannot use less
>> than O(n) space, either.
>
> Well, in general, the
Cale Gibbard wrote:
> On 08/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> large -> largedepends on large input like above
>> but roughly same otherwise
>> small -> largeroughly same
>
> Actually, it's an important point that laziness is generally
> preferable in
Thomas Conway wrote:
> I'm having some difficulty with typeclasses.
>
> What I'm trying to do should be obvious, but it's still giving me
> trouble. I want to take a packaged item, and strengthen the
> constraints on its type. Rather than being just any type that is an
> instance of A, I want to d
On 10/9/06, I wrote:
So, can anyone suggest how I can achieve my goal?
And how many milliolegs of type hackery will it take? ;-)
Tom
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hi All
I'm having some difficulty with typeclasses.
What I'm trying to do should be obvious, but it's still giving me
trouble. I want to take a packaged item, and strengthen the
constraints on its type. Rather than being just any type that is an
instance of A, I want to do a runtime check and do
On 08/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
large -> largedepends on large input like above
but roughly same otherwise
small -> largeroughly same
Actually, it's an important point that laziness is generally
preferable in these cases as well, since the lar
An errata for my email:
On Mon, Oct 09, 2006 at 09:44:47AM +0200, Tomasz Zielonka wrote:
> No let's get to nitpicking ;-)
should be
Now let's get to nitpicking ;-)
> * page 8, at about 85%: you say "The state maintained in our example is
> a simple integer value, but it *can* be any data typ
I have not read this yet, but would you be willing to put this
tutorial directly on the Haskell wiki? You lose the niceness of latex,
but you gain collaborative editing (which is at least useful for
suggestions like the ones Tomasz made)
If you put it on the wiki, we might be interested in steali
On Fri, Oct 06, 2006 at 11:40:46AM +0200, Martin Grabmueller wrote:
> I hereby announce a small tutorial on using monad transformers. In contrast
> to others found on the web, it concentrates on using them, not on their
> implementation.
>
> I'd like to hear comments, suggestions, etc. about it!
21 matches
Mail list logo