Re: Polishing the boilerplate: a dis-unsafely safe cast

2003-03-24 Thread Hal Daume III
This is getting off-topic, but... I don't like this solution at all :). It is very dependent on read being a true inverse of show, which isn't always the case. Perhaps more importantly though, I don't like the fact that it will readily convert between Int and Float, etc. For instance, in almost

Arbitrary precision reals?

2003-03-24 Thread Tom Pledger
Niall Dalton writes: | Hi, | | Its been a while since I've been using Haskell seriously, so I might simply | have overlooked the answer.. | | Is there an arbitrary precision real number library available for Haskell? | IIRC, atleast GHC uses the GMP library, but only for integers? Hi. Th

Polishing the boilerplate: a dis-unsafely safe cast

2003-03-24 Thread oleg
Hello! The paper http://research.microsoft.com/~simonpj/papers/hmap/ by Ralf Laemmel and Simon Peyton Jones gave a reference implementation of a 'cast' function. Here's another implementation: cast:: (Show a, Read b) => a -> Maybe b cast = read_as . show where read_as s = ca

WRS 2003 - Deadline extended to April 3, 2003

2003-03-24 Thread Salvador Lucas
[- We apologize for multiple copies of this message -] Due to multiple requests, we are extending the deadline for submissions to WRS 2003. Please, send a message containing the title, authors and abstract of your submission before M a r c h 3 0, 2 0 0 3 to [EMAIL PROTECTED] The full

AW: AW: simulating dynamic dispatch

2003-03-24 Thread Markus . Schnell
Thanks! These examples and counterexamples help a lot in understanding. Markus > The reason is that sum only works on integer lists, whereas the given > type for fun requires that the first argument be a function that works > on lists of any type, such as length. > If sum were allowed as argumen

Re: AW: simulating dynamic dispatch

2003-03-24 Thread Janis Voigtlaender
[EMAIL PROTECTED] wrote: > > I think I get it. But to be sure: > The forall means: The type for a may not be the same > throughout the whole function. It just has to follow > the pattern specified inside the braces. Not exactly. In: > > fun::(forall a.[a]->Int)->[b]->[c]->Int > > fun f x y = f x

Arbitrary precision reals?

2003-03-24 Thread Niall Dalton
Hi, Its been a while since I've been using Haskell seriously, so I might simply have overlooked the answer.. Is there an arbitrary precision real number library available for Haskell? IIRC, atleast GHC uses the GMP library, but only for integers? Thanks, niall -- T

Re: AW: simulating dynamic dispatch

2003-03-24 Thread Steffen Mazanek
> Interestingly, when I want hugs to show me the type > of > > fun::(forall a.[a]->Int)->[b]->[c]->Int > it tells me: ERROR - Use of fun requires at least 1 argument > Why that? At least I have explicitely specified the type. Hmm, ghci behaves properly. But using hugs I get the same error :-(. N

AW: simulating dynamic dispatch

2003-03-24 Thread Markus . Schnell
I think I get it. But to be sure: The forall means: The type for a may not be the same throughout the whole function. It just has to follow the pattern specified inside the braces. Interestingly, when I want hugs to show me the type of > fun::(forall a.[a]->Int)->[b]->[c]->Int it tells me: ERROR -

Re: AW: simulating dynamic dispatch

2003-03-24 Thread Steffen Mazanek
> concrete: What is the difference between > (forall b. Term b => b -> b) -> a -> a > and > (Term b) => (b -> b) -> a -> a > ? One may want: fun f x y = f x + f y for instance: fun length [True, False] [1,2] Therefore, I would say, you need typing a la fun::(forall a.[a]->Int)->[b]->[c]->

AW: simulating dynamic dispatch

2003-03-24 Thread Markus . Schnell
> http://research.microsoft.com/~simonpj/papers/hmap/ The technique you describe in that paper is exactly what I was wanting for many times. I often stopped using algebraic data types because of the immense amount of boilerplate I had to introduce. Thanks! But now I have a question regarding th