Re: [Haskell-cafe] I miss OO

2009-12-03 Thread Peter Verswyvelen
Nice. It would be fantastic to have a little practical real-world challenge (like building a simple music system, or a simple multi-channel sound mixer), and work this out in an imperative language, an object-oriented language, a functional language, and maybe other languages too, like logic

Re: [Haskell-cafe] I miss OO

2009-12-03 Thread Luke Palmer
On Thu, Dec 3, 2009 at 4:09 AM, Peter Verswyvelen bugf...@gmail.com wrote: Also Luke Palmer talked a couple of times about co-algebraic approaches, but not being a computer scientist, I never really understood what that meant (just reverse all the arrows?) Disclaimer: I am not a category

Re: [Haskell-cafe] I miss OO

2009-12-03 Thread Matthias Görgens
It would be fantastic to have a little practical real-world challenge (like building a simple music system, or a simple multi-channel sound mixer), and work this out in an imperative language, an object-oriented language, a functional language, and maybe other languages too, like logic

Re: [Haskell-cafe] I miss OO

2009-12-03 Thread Matthias Görgens
When OO is about constructing a machine and talking about objects, and FP is about making little algebraic languages, what would C or Pascal be like? In these languages, you don't think about objects, but you don't think about an algebra either? It's been a very long time since I worked with

Re: [Haskell-cafe] I miss OO

2009-12-03 Thread Brandon S. Allbery KF8NH
On Dec 3, 2009, at 20:03 , Matthias Görgens wrote: When OO is about constructing a machine and talking about objects, and FP is about making little algebraic languages, what would C or Pascal be like? In these languages, you don't think about objects, but you don't think about an algebra

Re: [Haskell-cafe] I miss OO

2009-11-26 Thread Stephen Tetley
2009/11/26 Eugene Kirpichov ekirpic...@gmail.com: I think two concepts should be separated if one makes sense and is useful without the other. A note out of its time context is certainly useful, for example, it may probably be converted to a MIDI command or to a graphical glyph (which is

Re: [Haskell-cafe] I miss OO

2009-11-26 Thread Gregg Reynolds
On Thu, Nov 26, 2009 at 1:50 AM, Eugene Kirpichov ekirpic...@gmail.com wrote: I argue that in the situation you provided, the pitch, duration, timbre and instrument are essential attributes of the dot, whereas time is the position of the dot on paper and should be separated from its essence.

Re: [Haskell-cafe] I miss OO

2009-11-26 Thread Gregg Reynolds
On Wed, Nov 25, 2009 at 2:51 PM, Michael Mossey m...@alumni.caltech.edu wrote: So if I have objects/data note1, cursor1, and staff1, Python:  note1.time()  cursor1.time()  staff1.time() Haskell needs something like  note_time note1  cursor_time cursor1  staff_time staff1 Modeling

Re: [Haskell-cafe] I miss OO

2009-11-26 Thread Stephen Tetley
2009/11/26 Gregg Reynolds d...@mobileink.com: Modeling musical stuff could provide an excellent illustration of the difference between OO and the Haskell way; it's the difference between metaphysical engineering and constructive mathematics. Hmm, Stephen Travis Pope's SmOKe - a design that

Re: [Haskell-cafe] I miss OO

2009-11-26 Thread Gregg Reynolds
On Thu, Nov 26, 2009 at 6:44 AM, Stephen Tetley stephen.tet...@gmail.com wrote: 2009/11/26 Gregg Reynolds d...@mobileink.com: Modeling musical stuff could provide an excellent illustration of the difference between OO and the Haskell way; it's the difference between metaphysical engineering

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Derek Elkins
On Wed, Nov 25, 2009 at 2:51 PM, Michael Mossey m...@alumni.caltech.edu wrote: I'm fairly new to Haskell, and starting to write some big projects. Previously I used OO exclusively, mostly Python. I really miss the namespace capabilities... a class can have a lot of generic method names which

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Erik de Castro Lopo
Michael Mossey wrote: I'm fairly new to Haskell, and starting to write some big projects. Previously I used OO exclusively, mostly Python. I really miss the namespace capabilities... a class can have a lot of generic method names which may be identical for several different classes because

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Serguey Zefirov
2009/11/25 Michael Mossey m...@alumni.caltech.edu: I'm fairly new to Haskell, and starting to write some big projects. Previously I used OO exclusively, mostly Python. I really miss the namespace capabilities... a class can have a lot of generic method names which may be identical for several

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Luke Palmer
On Wed, Nov 25, 2009 at 2:08 PM, Erik de Castro Lopo mle...@mega-nerd.com wrote: Michael Mossey wrote: I'm fairly new to Haskell, and starting to write some big projects. Previously I used OO exclusively, mostly Python. I really miss the namespace capabilities... a class can have a lot of

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread pbrowne
Luke Palmer lrpal...@gmail.com wrote I feel like this should be qualified. Type classes are not for name punning ; you wouldn't use a type class for the method bark on types Tree and Dog. But if you have a well-defined *structure* that many types follow, then a type class is how you capture

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Lyndon Maydwell
You can define the methods with the same names in different modules, then when you are importing them into the same module for use, use a qualified import. import qualified Dog import qualified Tree This will allow you to use exactly the syntax you described. Dog.bark Tree.bark Plus if you

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Jason Dusek
2009/11/25 Michael Mossey m...@alumni.caltech.edu: I'm fairly new to Haskell, and starting to write some big projects. Previously I used OO exclusively, mostly Python. I really miss the namespace capabilities... a class can have a lot of generic method names which may be identical for several

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Arnaud Bailly
Hello, Coming also from an OO background, I had this same feeling as yours when I started learning haskell. It might help to think that type classes are like interfaces: They allow expressing a family of behaviors as a bunch of related functions. The fact that it allows using same name to act

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Eugene Kirpichov
Hi, Are you sure you need to store the time *inside* your objects instead of using, say, pairs (Time, YourObject) (and lists of them instead of lists of your objects)? It would seem strange to me that a note HAS-A time even in an OO design: more likely, a note is associated with a time, and this

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Luke Palmer
On Thu, Nov 26, 2009 at 12:03 AM, Eugene Kirpichov ekirpic...@gmail.com wrote: Hi, Are you sure you need to store the time *inside* your objects instead of using, say, pairs (Time, YourObject) (and lists of them instead of lists of your objects)? It would seem strange to me that a note HAS-A

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Michael Mossey
First of all, thanks for the ideas, everyone. I think I'm starting to get the usefulness of type classes. With regard to your question, Eugene, you are probably right. In fact my rough draft of this code from four months ago used a Map with time as the key (of type Rational). I was trying to

Re: [Haskell-cafe] I miss OO

2009-11-25 Thread Eugene Kirpichov
2009/11/26 Michael Mossey m...@alumni.caltech.edu: First of all, thanks for the ideas, everyone. I think I'm starting to get the usefulness of type classes. With regard to your question, Eugene, you are probably right. In fact my rough draft of this code from four months ago used a Map with