Is there an implementation of a symbol type in Haskell i.e. a string which has a constant-time
comparison operation?
Mike
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Tue, Oct 09, 2007 at 11:28:08PM -0700, Michael Vanier wrote:
Is there an implementation of a symbol type in Haskell i.e. a string which
has a constant-time comparison operation?
Yes, I beleive GHC uses one (utils/FastString.lhs iirs)
Stefan
signature.asc
Description: Digital signature
I'm thinking of a symbol type that can be used for a compiler, so a simple algebraic data type
wouldn't work. Unfortunately the GHC datatype isn't part of the GHC haskell libraries AFAICT.
Mike
Yitzchak Gale wrote:
Michael Vanier wrote:
Is there an implementation of a symbol type in Haskell
Michael Vanier wrote:
Is there an implementation of a symbol type in Haskell i.e. a string which
has a constant-time comparison operation?
Stefan O'Rear wrote:
Yes, I beleive GHC uses one (utils/FastString.lhs iirs)
In some cases where you would need that in other languages,
you would use an
Dan Piponi wrote:
The reusability of Num varies inversely with how many
assumptions you make about it.
A default implementation of pi would only increase usability,
not decrease it.
If you need a specialized definition of pi in your instance,
you would provide it, just as you do now.
If pi
Michael Vanier wrote:
I'm thinking of a symbol type that can be used
for a compiler...
Ah. Perhaps Data.HashTable is what you are looking
for then?
-Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Yitzchak Gale writes:
Dan Piponi wrote:
The reusability of Num varies inversely with how many
assumptions you make about it.
A default implementation of pi would only increase usability,
not decrease it.
Suppose I believe you. (Actually, I am afraid, I have doubts.)
Can you provide some
Hmm, I was hoping for something that didn't involve side effects.
Mike
Yitzchak Gale wrote:
Michael Vanier wrote:
I'm thinking of a symbol type that can be used
for a compiler...
Ah. Perhaps Data.HashTable is what you are looking
for then?
-Yitz
Michael Vanier wrote:
Yitzchak Gale wrote:
Ah. Perhaps Data.HashTable is what you are looking
for then?
Hmm, I was hoping for something that didn't involve side effects.
There's always Data.Map
newtype Symbol = S { unS :: Integer } deriving (Eq, Ord)
type SymbolTable = Data.Map
Michael Vanier, before Yitzchak Gale and himself:
I'm thinking of a symbol type that can be used
for a compiler...
Ah. Perhaps Data.HashTable is what you are looking
for then?
Hmm, I was hoping for something that didn't involve side effects.
Some popular Haskell libraries suffer from
[EMAIL PROTECTED] wrote:
Yitzchak Gale writes:
Dan Piponi wrote:
The reusability of Num varies inversely with how many
assumptions you make about it.
A default implementation of pi would only increase usability,
not decrease it.
Suppose I believe you. (Actually, I am afraid, I have
On Wed, 10 Oct 2007, Yitzchak Gale wrote:
Dan Piponi wrote:
The reusability of Num varies inversely with how many
assumptions you make about it.
A default implementation of pi would only increase usability,
not decrease it.
As the others have shown, you can compute PI in many ways. Which
ChrisK writes:
Putting 'pi' in the same class as the trigonometric functions is good design.
If you wish so... But:
Look, this is just a numeric constant.
Would you like to have e, the Euler's constant, etc., as well, polluting
the name space? What for?
Moving smoothly from single to double
On 2007-10-10, [EMAIL PROTECTED] wrote:
ChrisK writes:
Putting 'pi' in the same class as the trigonometric functions is good design.
If you wish so... But:
Look, this is just a numeric constant.
Would you like to have e, the Euler's constant, etc., as well, polluting
the name space? What
I wrote:
Perhaps Data.HashTable is what you are looking
for then?
Jerzy Karczmarczuk wrote:
extract from Data.Hash what you need...
why not try tries?
apfelmus wrote:
There's always Data.Map
Those are log n. I would personally use those for
almost every application, but Mike says he wants
On Wed, 10 Oct 2007, Yitzchak Gale wrote:
I wrote:
Perhaps Data.HashTable is what you are looking
for then?
Jerzy Karczmarczuk wrote:
extract from Data.Hash what you need...
why not try tries?
apfelmus wrote:
There's always Data.Map
Those are log n. I would personally use
Jules Bean writes:
jerzy.karczmarczuk:
Somehow I do not only think that the default implementation would be good
for nothing, but that putting PI into Floating as a class member, serves
nobody.
Are you aware that it already is in the Floating class?
A very interesting question. What do you
[EMAIL PROTECTED] wrote:
Somehow I do not only think that the default implementation would be good
for nothing, but that putting PI into Floating as a class member, serves
nobody.
Are you aware that it already is in the Floating class?
This discussion is not about adding it, but about whether
[EMAIL PROTECTED] wrote:
This discussion is not about adding it, but about whether or not it
should have a default.
Are you suggesting pi should be removed from the Floating class?
Then, what type would you give pi?
First, I don't care whether it is there or not. When I use it, I define
a
Jules Bean said:
If it is true of many Floating instances that (atan 1 * 4) is an
accurate way to calculate pi (and it appears to be 'accurate enough' for
Float and Double, on my computer) then adding it as a default doesn't
appear to do any harm.
Maybe this is the wrong point of view, but I
I recently had reason to do some encoding-related coding and noticed
that Haskell was somewhat lacking (I could only find code for base64, on
the other hand there are two implementations of it :-).
I've almost reached a state where I wouldn't be ashamed of sharing the
code so I looked into my
On Wednesday 10 October 2007 11:05:28 Magnus Therning wrote:
I recently had reason to do some encoding-related coding and noticed
that Haskell was somewhat lacking (I could only find code for base64, on
the other hand there are two implementations of it :-).
I've almost reached a state where
Dan Piponi writes:
Jules Bean said:
If it is true of many Floating instances that (atan 1 * 4) is an
accurate way to calculate pi (and it appears to be 'accurate enough' for
Float and Double, on my computer) then adding it as a default doesn't
appear to do any harm.
... For the case of power
magnus:
I recently had reason to do some encoding-related coding and noticed
that Haskell was somewhat lacking (I could only find code for base64, on
the other hand there are two implementations of it :-).
I've almost reached a state where I wouldn't be ashamed of sharing the
code so I
The precompiled WinHugs Sep 2006 does not seem to come with the GLUT
package.
Although I'm able to add packages to GHC (using Cabal), I failed doing
the same for WinHugs.
How can I add the GLUT package to WinHugs?
I tried starting MSYS, typed configure, which worked fine, but then
make
Hi Peter,
Also typing runhugs Setup.hs configure fails with
runhugs: Error occurred
ERROR c:\program
files\winhugs\packages\base\Text\ParserCombinators\ReadP.hs:156
- Syntax error in type expression (unexpected `.')
This is because Cabal gets it wrong. You need to type runhugs -98
Setup
On 2007-10-10, [EMAIL PROTECTED] wrote:
Oh yes, everybody in the world uses in ONE program several overloaded
versions of pi, of the sine function, etc.
They don't have to be in the same program for overloaded versions to be
semantically useful. They're not strictly necessary, but so?
Having
On Wed, Oct 10, 2007 at 08:49:56AM -0700, Dan Piponi wrote:
Jules Bean said:
If it is true of many Floating instances that (atan 1 * 4) is an
accurate way to calculate pi (and it appears to be 'accurate enough'
for Float and Double, on my computer) then adding it as a default
doesn't
On Wed, Oct 10, 2007 at 12:29:07PM +0200, [EMAIL PROTECTED] wrote:
ChrisK writes:
There are two things in Floating, the power function (**) [ and sqrt ]
and the transcendental functions (trig functions,exp and log, and
constant pi).
Floating could be spit into two classes, one for the power
David Roundy wrote:
On Wed, Oct 10, 2007 at 12:29:07PM +0200, [EMAIL PROTECTED] wrote:
ChrisK writes:
There are two things in Floating, the power function (**) [ and sqrt ]
and the transcendental functions (trig functions,exp and log, and
constant pi).
Floating could be spit into two classes,
Haskell developers who want their own wiki with a simple issue tracker[1]
and email integration[2] are also welcome to set one up at
http://zwiki.org/FreeHosting .
Cheers - Simon
[1] http://zwiki.org/IssueTracker
[2] http://zwiki.org/Mail
___
On Wed, 10 Oct 2007, David Roundy wrote:
On Wed, Oct 10, 2007 at 12:29:07PM +0200, [EMAIL PROTECTED] wrote:
ChrisK writes:
There are two things in Floating, the power function (**) [ and sqrt ]
and the transcendental functions (trig functions,exp and log, and
constant pi).
Floating could be
On Tue, 9 Oct 2007, Seth Gordon wrote:
Henning Thielemann wrote:
In my experience only the other way round works: Let people use C, Perl and
Python until they find their programs unmaintainable. Then they will become
interested in style and discipline and programming languages which
On Wed, 10 Oct 2007, Henning Thielemann wrote:
(**) should not exist, because there is no sensible definition for many
operands for real numbers, and it becomes even worse for complex numbers. The
more general the exponent, the more restricted is the basis and vice versa in
order to get
Henning Thielemann wrote:
There are warrantedly no side effects. It's scientifically approved.
Available without prescription.
:)
Yes, but doctor, my space is leaking! ;-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Wed, Oct 10, 2007 at 08:53:22PM +0200, Henning Thielemann wrote:
On Wed, 10 Oct 2007, David Roundy wrote:
It seems that you're arguing that (**) is placed in the correct class,
since it's with the transcendental functions, and is implemented in terms
of those transcendental functions.
On 10/3/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:
I needed to type at least 3 times the amount of code, much
of which was boilerplate code, and the code is not elegant.
Reflection is your friend here.
Example. Code before reflection:
MyConfig
{
// some properties here
public
Henning Thielemann wrote:
It's scientifically approved. Available without prescription.
Doctor doctor, can you curry me?
Okay, I'm gonna stop now :-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Thanks for the C# advise, but I was actually just comparing my C# code
with similar Haskell code. Yes, I also like aspect oriented programming,
dynamic code generation, and LINQ to avoid boilerplate code in C#, but
this is a Haskell group, and I want to be curried ;-)
But, for my students I'm
Okay, I got one step further now, great!
But when doing runhugs -98 Setup.hs build it complains about not
having CPPHS, and the Windows binary link is broken :(
*404: Not Found*
*The file you have requested
(http://www.cs.york.ac.uk/fp/cpphs-1.5-win32.zip) could not be found on
this
Claus Reinke wrote:
since this doesn't seem to want to go away:-)
1. reverse psychology approach
...
2. mantra approach
...
3. secret cult approach
...
4. reach for the moon approach
...
5. The fun approach:
Haskell: we put the Fun in Functor.
I'm only half-joking, because for me
On Wed, 10 Oct 2007, David Roundy wrote:
On Wed, Oct 10, 2007 at 08:53:22PM +0200, Henning Thielemann wrote:
On Wed, 10 Oct 2007, David Roundy wrote:
It seems that you're arguing that (**) is placed in the correct class,
since it's with the transcendental functions, and is implemented in
Henning Thielemann wrote:
It would better to disallow negative bases completely for (**),
because integers should be explicitly typed as integers and then (^^)
can be used. I have already seen (x**2) and (e ** x) with (e = exp 1)
in a Haskell library. Even better would be support for
David Roundy:
jerzy.karczmarczuk:
The power is an abomination for a mathematician. With rational exponent it
may generate algebraic numbers, with any real - transcendental... The
splitting should be more aggressive. It would be good to have *integer*
powers, whose existence is subsumed by
Have you tried F#? I mean, I havent ;-) but maybe it's an interesting
half-way house? Presumably you can use all the standard .Net
libraries (maybe good enough for getting asp.net working etc?), and
you can still use FP constructs?
I understand F# is not pure (I think?), and doesnt have monads,
On Wed, Oct 10, 2007 at 10:32:55PM +0200, Henning Thielemann wrote:
On Wed, 10 Oct 2007, David Roundy wrote:
I think it's quite sensible, for instance, that passing a negative
number as the first argument of (**) with the second argument
non-integer leads to a NaN.
It would better to
Nervous? Anxious? You found an irreproducable bug in your program and
have to fix it until tomorrow? You feel that your code needs essential
cleanup, but you postponed it for long in order to not introduce new
bugs? You can hardly maintain the code as it grows and grows?
Pause a minute!
On Wed, Oct 10, 2007 at 10:52:36PM +0200, [EMAIL PROTECTED] wrote:
... Where is the abomination here?
Having THREE different power operators, one as a class member, others as
normal functions. Do you think this is methodologically sane?
It's a bit odd, but I prefer it to having one
Aha! Instead of the lambda surrounded by mathematical stuff as the
haskell.org logo, we need a picture of a medicine bottle.
Haskell. Fewer headaches. No side effects.
Alternatively, a picture of a red pill with an embossed lambda...
___
Seth Gordon wrote:
Aha! Instead of the lambda surrounded by mathematical stuff as the
haskell.org logo, we need a picture of a medicine bottle.
Haskell. Fewer headaches. No side effects.
Alternatively, a picture of a red pill with an embossed lambda...
I can hear millions of CS
Henning Thielemann wrote:
On Mon, 8 Oct 2007, Alistair Bayley wrote:
On 08/10/2007, Henning Thielemann [EMAIL PROTECTED] wrote:
You cannot turn any programmer into a disciplined programmer just by
giving him a well designed language. I you try so, they will not
like to
use that language,
Derek Elkins wrote:
On Mon, 2007-10-08 at 20:54 +1000, Thomas Conway wrote:
I must say, I get that! but at the same time, of course, the high
level abstraction is exactly what *we* love about Haskell.
Then they should teach assembly not Python. In fact, I'd recommend
assembly anyway.
How about we just steal the BBC's slogan? Where different works ;-)
Say what you like about Haskell, but it is undeniably very different to
mainstream programming languages. This in itself is a potential
advantage (and problem).
___
Haskell-Cafe
On 10/10/07, Peter Verswyvelen [EMAIL PROTECTED] wrote:
A noble goal and I wish you luck. I'd love to see if you get .NET working
with Haskell - I have tried to figure it out from that old build of Hugs and
never had any luck. Tantalizingly, the GHC source has some Dotnet stuff in
it but it
On 10 Oct 2007, at 12:49 pm, [EMAIL PROTECTED] wrote:
No, I am sorry, I know a little bit R. This is not a functional
language.
There is some laziness (which looks a bit like macro-processing),
sure.
There is no macro processing in R (or S).
The manual speaks about promises and about
On Wed, 10 Oct 2007, Andrew Coppin wrote:
(I'm less sold on whether you really need to learn a particular dialect
well enough to *program* in it...)
If you don't then you won't be able to see how complicated things actually
get done. It's also an important exercise in abstracting things
Let's be clear what we are talking about, because I for one am
getting very confused by talk about putting PI into FLoating as
a class member serves nobody when it already IS there.
From the report:
class (Fractional a) = Floating a where
pi :: a
exp, log, sqrt :: a - a
(**), logBase :: a
On Wed, 2007-10-10 at 23:48 +0100, Philippa Cowderoy wrote:
On Wed, 10 Oct 2007, Andrew Coppin wrote:
(I'm less sold on whether you really need to learn a particular dialect
well enough to *program* in it...)
If you don't then you won't be able to see how complicated things actually
Someone wrote about pi:
| But it is just a numerical constant, no need to put it into a
class, and
nothing to do with the type_classing of related functions. e is not
std. defined, and it doesn't kill people who use exponentials.
But it *isn't* A numerical constant.
It is a *different*
On 11 Oct 2007, at 4:49 am, Dan Piponi wrote:
Maybe this is the wrong point of view, but I think of defaults as
impementations that are meant to be correct, but not necessarily the
best way of doing things, leaving you the option to provide something
better.
The example of tanh in the report
On 2007-10-10, Andrew Coppin [EMAIL PROTECTED] wrote:
(Indeed, the number of times my Haskell programs have locked up due to
me accidentally writing let x = foo x...)
For me, that's small. I have seen useful program not lock up
that depend on let x = foo x though.
--
Aaron Denney
--
On Wed, 2007-10-10 at 10:40 +0200, [EMAIL PROTECTED]
wrote:
Yitzchak Gale writes:
Dan Piponi wrote:
The reusability of Num varies inversely with how many
assumptions you make about it.
A default implementation of pi would only increase usability,
not decrease it.
Suppose I
On Wed, 2007-10-10 at 12:29 +0200, [EMAIL PROTECTED]
wrote:
ChrisK writes:
Putting 'pi' in the same class as the trigonometric functions is good
design.
If you wish so... But:
Look, this is just a numeric constant.
Would you like to have e, the Euler's constant, etc., as well,
An anonymous called ok writes:
jerzy.karczmarczuk wrote [about R]:
... This is not a functional language.
There is some laziness (which looks a bit like macro-processing), sure.
There is no macro processing in R (or S).
I know I've been superficial, but, please, *try* to understand my
Jonathan Cast adds 'something' to a discussion about pi.
I commented the statement of Yitzchak Gale, who answered some point
of Dan Piponi:
A default implementation of pi would only increase usability,
not decrease it.
I said:
Can you provide some examples of this increased usability?
I haven't been following this discussion closely, but here's an idea: use
reverse psychology.
Haskell -- You're probably not smart enough to understand it.
Nothing like appealing to people's machismo to get them interested.
Mike
Seth Gordon wrote:
Aha! Instead of the lambda surrounded by
On Thu, 2007-10-11 at 02:11 +0200, [EMAIL PROTECTED]
wrote:
Jonathan Cast adds 'something' to a discussion about pi.
I commented the statement of Yitzchak Gale, who answered some point
of Dan Piponi:
A default implementation of pi would only increase usability,
not decrease it.
I
What we really need is a sort of stress-strain curve for each of the
major languages. Since Haskell is a typed language, we can have one
curve for types and one for values:
VARIABLE TYPEVALUE
---
David Benbennick wrote:
On 10/10/07, Dan Weston [EMAIL PROTECTED] wrote:
Actually, it is a constant: piDecimalExpansion :: String.
Where is this constant defined?
A translation from piDecimalExpansion :: String to pi :: Floating a = a
is already well defined via read :: Read a = String - a
On 10/10/07, Dan Weston [EMAIL PROTECTED] wrote:
Actually, it is a constant: piDecimalExpansion :: String.
Where is this constant defined?
A translation from piDecimalExpansion :: String to pi :: Floating a = a
is already well defined via read :: Read a = String - a
Any definition of pi in
On Oct 10, 2007, at 20:14 , Michael Vanier wrote:
I haven't been following this discussion closely, but here's an
idea: use reverse psychology.
Haskell -- You're probably not smart enough to understand it.
Nothing like appealing to people's machismo to get them interested.
Haskell
On 11 Oct 2007, at 1:34 pm, Dan Weston wrote:
Actually, [pi] is a constant: piDecimalExpansion :: String.
No, that's another constant.
A translation from piDecimalExpansion :: String to pi :: Floating a
= a is already well defined via read :: Read a = String - a
Wrong.
Come on people! This discussion is absurd. The numeric classes in Haskell
have a lot of choices that are somewhat arbitrary. Just live with it. If
pi has a default or not has no practical consequences.
-- Lennart
___
Haskell-Cafe mailing list
Newbie question:
I was wondering the other day if type synonyms might be more useful
if they were more restricted, that is, with the definitions:
type Foo = String
type Bar = String
foo :: Foo
foo = a foo
bar :: Bar
bar = a bar
x :: Foo - ...
x f b = ...only valid for Foo Strings...
both 'x
If you change your type declarations to 'newtype' declarations, I
believe you would get the effect that you want, depending on what you
mean by 'equivalent'. In that case, Foo and Bar would essentially be
strings, but you could not use either of them in a place where the
other is expected, nor
Andrew Wagner wagner.andrew at gmail.com writes:
If you change your type declarations to 'newtype' declarations, I
believe you would get the effect that you want, depending on what you
mean by 'equivalent'. In that case, Foo and Bar would essentially be
strings, but you could not use either
Hello,
When building the latest hdbc-odbc (1.1.2.0) on a linux box with
ghc6.6.1, I get the following warnings:
[7 of 7] Compiling Database.HDBC.ODBC ( Database/HDBC/ODBC.hs,
dist/build/Database/HDBC/ODBC.o )
hdbc-odbc-helper.c: In function รข:
hdbc-odbc-helper.c:131:0:
77 matches
Mail list logo