[Haskell-cafe] Object oriented haskell.
Magnus Therning
magnus at therning.org
Thu May 15 22:32:44 UTC 2014
On Thu, May 15, 2014 at 11:37:40PM +0200, silvio wrote:
>> In what languages is (.) cool, and in what way?
>
> Because depending on what is before it, what is behind it can have
> different meanings. For me this is one of the main points. I just
> don't like the name collision problem in Haskell. Take something
> like size for instance it is pretty clear what it means yet unless
> you have a type class that everybody knows about you can use it on
> only one thing. And even if you have a simple type class some object
> might want to return an Int and some other might want to return an
> Integer. With (.) being from a multiparameter typeclass you can
> define for each object what it means without any of them knowing
> about the others. And you are not even limited to, let's call them,
> 'labels' like size. You can also use any other Type you want like
> the key of a database object or as in my example a Map.
So, slightly simplified you want to:
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.
/M
--
Magnus Therning OpenPGP: 0xAB4DFBA4
email: magnus at therning.org jabber: magnus at therning.org
twitter: magthe http://therning.org/magnus
What gets measured, gets done.
-- Tom Peters
-------------- 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/7367170f/attachment.sig>
More information about the Haskell-Cafe
mailing list