[Haskell-cafe] Object oriented haskell.

Magnus Therning magnus at therning.org
Thu May 15 22:57:49 UTC 2014


On Fri, May 16, 2014 at 12:47:40AM +0200, silvio wrote:
>> Firstly, a notation where you put the first argument before the
>> function/method?
>>
>>   [1,2,3] . length -> 3
>>
>> Secondly, mimic the multilayered namespaces that is commonly found
>> in mainstream imperative OO languages?
>>
>>   [1,2,3] . length -> 3::Int
>>   aPieceOfString . length -> 120.0::Double
>>
>> Just trying to understand what problem you are actually trying to
>> solve.  I've *never* thought of (.) being powerful in OO languages,
>> mostly because I don't really think the dot is what makes an OO
>> language.
> 
> That's essentially it. I see that people on this thread where
> thinking more along the lines of inheritance. So let me add that it
> shouldn't be difficult to add the instances you want for your child
> object and then make a default instance which reverts to the parent
> object. It's a bit of a problem for updating stuff in a functional
> way since you can never be sure if a method is ment to return an
> object or if this is supposed to be an update. But for things in
> IO/STM/... it should be fine.

Excellent, then at least understand what you are after.  I was
confused by the ensuing discussion, because it so quickly moved away
from what I thought you were really proposing.

To be honest I've more often missed Haskell's (.) when programming in
C/C++/C# than the other way around ;)

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus

I invented the term Object-Oriented, and I can tell you I did not have
C++ in mind.
     -- Alan Kay
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140516/6a802766/attachment.sig>


More information about the Haskell-Cafe mailing list