Don't think the "Haskell's Overlooked Object System" paper has been posted
to this thread yet:
http://homepages.cwi.nl/~ralf/OOHaskell/paper.pdf
--s
On 12/18/07, Lutz Donnerhacke <[EMAIL PROTECTED]> wrote:
>
> * Tillmann Rendel wrote:
> > My conclusion: To make Haskell a better OO language
>
>
* Tillmann Rendel wrote:
> My conclusion: To make Haskell a better OO language
Haskell is not an OO language and never should be.
> (Since it's not the goal of Haskell to be any OO language at all this
> may not be a problem)
Ack.
___
Haskell-Cafe mail
Felipe Lessa wrote:
class Shape a where
whatever
class (Shape a, Shape b) => Intersectable a b where
intersect :: a -> b -> Bool
This looks nice at first sight, but is it usefull in practice? I can
somehow express the type "any shape wich is intersectable with a given
other shape
> If however, you *really* want to keep your shapes as being seperate
> types, then you'll want to invoke the class system (note, not the same
> as OO classes).
>
> class Shape a where
>area :: a -> Int
>
> newtype Circle = C Int
>
> instance Shape Circle where
>area (C r) = pi * r^2
>
> ne
Felipe Lessa wrote:
On Dec 18, 2007 7:51 AM, Jules Bean <[EMAIL PROTECTED]> wrote:
class Shape a where {
intersect :: Shape b => a -> b -> Bool
}
Shouldn't this be
class Shape a where
whatever
class (Shape a, Shape b) => Intersectable a b where
intersect :: a -> b -> Bool
Wit
On Dec 18, 2007 7:51 AM, Jules Bean <[EMAIL PROTECTED]> wrote:
> class Shape a where {
>intersect :: Shape b => a -> b -> Bool
> }
Shouldn't this be
class Shape a where
whatever
class (Shape a, Shape b) => Intersectable a b where
intersect :: a -> b -> Bool
With your definition
Miguel Mitrofanov wrote:
class Shape a where {
intersect :: Shape b => a -> b -> Bool
}
data Shape a = { intersect :: Shape b => a -> b -> Bool }
in fact, the syntax is rather similar, too! :)
Um, well, and how are you going to implement it?
Yes, exactly.
My only point is
> class Shape a where {
>intersect :: Shape b => a -> b -> Bool
> }
> data Shape a = { intersect :: Shape b => a -> b -> Bool }
> in fact, the syntax is rather similar, too! :)
Um, well, and how are you going to implement it?
___
Haskell-Cafe mailing
Miguel Mitrofanov wrote:
There's a third way, too, and I haven't seen anybody mention it yet
I've noticed it, but there are some problems with this representation,
so I decided not to mention it. It's OK as far as we don't want
functions working on two areas - I don't see, how we can implemen
Miguel Mitrofanov <[EMAIL PROTECTED]> writes:
> I've noticed it, but there are some problems with this
> representation, so I decided not to mention it. It's OK as far as we
> don't want functions working on two areas - I don't see, how we can
> implement, say, intersect :: Shape -> Shape -> Bool
On Mon, 2007-12-17 at 22:12 +0300, Miguel Mitrofanov wrote:
> > There's a third way, too, and I haven't seen anybody mention it yet
>
> I've noticed it, but there are some problems with this
> representation, so I decided not to mention it. It's OK as far as we
> don't want functions working o
> I interpreted Evan's question as "why can't you have newtypes with
> multiple fields?" -- i.e., newtype X = X A B C -- and that's the
> question I was answering. But maybe I misunderstood.
Well, the question was both, and "strictness" answers both. Thanks
for the clarification. I should have r
On 12/17/07, Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote:
> This is not a generalization of what you talked about. Why should the tuple
> type be unboxed? Tuple types are boxed, meaning there is a difference
> between _|_ and (_|_,…,_|_). If you write
>
> newtype X = X (A, B, C)
>
> then X do
There's a third way, too, and I haven't seen anybody mention it yet
I've noticed it, but there are some problems with this
representation, so I decided not to mention it. It's OK as far as we
don't want functions working on two areas - I don't see, how we can
implement, say, intersect :: S
Am Montag, 17. Dezember 2007 19:26 schrieb Tim Chevalier:
> On 12/17/07, Evan Laforge <[EMAIL PROTECTED]> wrote:
> > I'm sure there's a trivial explanation for this, but here's something
> > that I've always kind of wondered about: Given a single constructor
> > type like "data X = X A B C" can't
On 12/17/07, Evan Laforge <[EMAIL PROTECTED]> wrote:
> Oops, nevermind, I just saw the other thread and link to
> http://www.haskell.org/haskellwiki/Newtype. Ok, so that seems like a
> pretty subtle diffenence... I'm assuming the rationale behind
> differentiating between a single constructor data
On 12/17/07, Evan Laforge <[EMAIL PROTECTED]> wrote:
> I'm sure there's a trivial explanation for this, but here's something
> that I've always kind of wondered about: Given a single constructor
> type like "data X = X A B C" can't that be transformed into "newtype X
> = X (A, B, C)"? There must
> I'm sure there's a trivial explanation for this, but here's something
> that I've always kind of wondered about: Given a single constructor
> type like "data X = X A B C" can't that be transformed into "newtype X
> = X (A, B, C)"? There must be some difference, because if there
> weren't we cou
> A newtype can only have one constructor, with one argument, and is
> essentially a wrapper for that argument type.
>
> In the general case, you want to use "data" instead of "newtype":
>
> data Rectangle = R Int Int
I'm sure there's a trivial explanation for this, but here's something
that I'v
Peter Verswyvelen wrote:
Very interesting, I did not know that!
I thought newtype was an optimization of data, and that "newtype" was bad
terminology. But if newtype is just a wrapper around a type, then the name is choosen
well.
I'm a bit confused why then one needs a data-constructor-like t
Thomas Davie <[EMAIL PROTECTED]> writes:
> Yes, and you can indeed do a similar thing in Haskell. The natural
> thing to do here would be to define a type Shape...
> data Shape = Circle Int
> | Rectangle Int Int
> | Square Int
> If however, you *really* want to keep your
ssage-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wolfgang Jeltsch
Sent: Monday, December 17, 2007 5:39 PM
To: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.
Am Montag, 17. Dezember 2007 13:04 schrieb Jed Brown:
>
ECTED]
Sent: 17 December 2007 16:37
To: Nicholls, Mark
Cc: Henning Thielemann; haskell-cafe@haskell.org
Subject: Re[2]: [Haskell-cafe] OOP'er with (hopefully) trivial
questions.
Hello Mark,
Monday, December 17, 2007, 4:47:50 PM, you wrote:
> I'll give it a read.
> h
Am Montag, 17. Dezember 2007 13:04 schrieb Jed Brown:
> […]
> When your type only has one constructor, newtype is preferred over data, but
> they are semantically equivalent.
They are *not* semantically equivalent, as has already been said more or less.
data adds an extra level of indirection.
Hello Mark,
Monday, December 17, 2007, 4:47:50 PM, you wrote:
> I'll give it a read.
> http://www.haskell.org/haskellwiki/OOP_vs_type_classes
i recommend you to read two papers mentioned in References section
there. at least i'm one of this page authors and i don't think that i
had very good u
: [Haskell-cafe] OOP'er with (hopefully) trivial
questions.
On Dec 17, 2007 8:04 AM, Nicholls, Mark <[EMAIL PROTECTED]> wrote:
No that's fineits all as clear as mud!..but that's not your
fault.
To recap...
"type" introduces a synonym for another type,
On Dec 17, 2007 8:04 AM, Nicholls, Mark <[EMAIL PROTECTED]> wrote:
> No that's fineits all as clear as mud!..but that's not your
> fault.
>
> To recap...
>
> "type" introduces a synonym for another type, no new type is
> createdit's for readabilities sake.
>
> "Newtype" introduces an i
Ahhh
I'll give it a read.
thanks
-Original Message-
From: Henning Thielemann [mailto:[EMAIL PROTECTED]
Sent: 17 December 2007 13:05
To: Nicholls, Mark
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] OOP'er with (hopefully) trivial
questions.
On Mon, 17 Dec 2007
On Mon, 17 Dec 2007, Nicholls, Mark wrote:
> After many years of OOP though my brain is wired up to construct
> software in that 'pattern'a problem for me at the moment is I cannot
> see how to construct programs in an OO style in HaskellI know this
> is probably not the way to approach i
pes...I think are "singnatures" and what Haskell thinks is a type
"class" I think of as a type.it's not going to be easy.
-Original Message-
From: Thomas Davie [mailto:[EMAIL PROTECTED]
Sent: 17 December 2007 12:35
To: Nicholls, Mark
Cc: Haskell Cafe
Subject:
On 17 Dec 2007, at 12:22, Nicholls, Mark wrote:
Ok...
Thanks I need to revisit data and newtype to work out what the
difference is I think.
Beware in doing so -- type, and newtype are not the same either. type
creates a type synonim. That is, if I were to declare
type Jam = Int
then J
27;er with (hopefully) trivial
questions.
On 17 Dec 2007, [EMAIL PROTECTED] wrote:
> Ooo
>
> "The constructor of a newtype must have exactly one field but `R' has
> two In the newtype declaration for `Rectangle'"
>
> It doesn't like
>
> "
On 17 Dec 2007, [EMAIL PROTECTED] wrote:
> Ooo
>
> "The constructor of a newtype must have exactly one field but `R' has
> two In the newtype declaration for `Rectangle'"
>
> It doesn't like
>
> "newtype Rectangle = R Int Int"
You want
data Rectangle = R Int Int
A newtype declaration will be
On Dec 17, 2007 10:47 PM, Nicholls, Mark <[EMAIL PROTECTED]> wrote:
> "The constructor of a newtype must have exactly one field but `R' has
> two In the newtype declaration for `Rectangle'"
>
> It doesn't like
>
> "newtype Rectangle = R Int Int"
A newtype can only have one constructor, with one
ember 2007 11:04
To: Nicholls, Mark
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] OOP'er with (hopefully) trivial
questions.
On 17 Dec 2007, at 10:46, Nicholls, Mark wrote:
>
> I can obviously at a later date add a new class Triangle, and not
> have to touch any of
On 17 Dec 2007, at 11:14, Nicholls, Mark wrote:
OK I'll have to digest this and mess about a bitbut can I make an
observation at this point
If I define "Shape" like
data Shape = Circle Int
| Rectangle Int Int
| Square Int
Isn't this now "closed"...i.e. the sta
n?
-Original Message-
From: Thomas Davie [mailto:[EMAIL PROTECTED]
Sent: 17 December 2007 11:04
To: Nicholls, Mark
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] OOP'er with (hopefully) trivial
questions.
On 17 Dec 2007, at 10:46, Nicholls, Mark wrote:
>
> I can ob
"Nicholls, Mark" <[EMAIL PROTECTED]> writes:
> After many years of OOP though my brain is wired up to construct software in
> that ?pattern??.a problem for me at the moment is I cannot see how to
> construct
> programs in an OO style in Haskell?.I know this is probably not the way to
> approach i
On 17 Dec 2007, at 10:46, Nicholls, Mark wrote:
I can obviously at a later date add a new class Triangle, and not
have to touch any of the above code….
Yes, and you can indeed do a similar thing in Haskell. The natural
thing to do here would be to define a type Shape...
data Shape = Ci
I'm trying to teach myself HaskellI've spent a few hours going
through a few tutorialsand I sort of get the basics...
My interest in Haskell is specifically around the strength of the type
system.
After many years of OOP though my brain is wired up to construct
software in that 'pat
40 matches
Mail list logo