[Haskell-cafe] Object oriented haskell.

David Thomas davidleothomas at gmail.com
Thu May 15 18:14:56 UTC 2014


One thing that is likely to be surprising is that (.) is
right-associative, whereas in C it's left-associative.

object . action . action would try to parse as object . (action .
action) - which may or may not typecheck but is probably not what was
intended.

On Thu, May 15, 2014 at 11:11 AM, silvio <silvio.frischi at gmail.com> wrote:
>> relevantly: https://ghc.haskell.org/trac/ghc/wiki/Records/DeclaredOverloadedRecordFields/DotPostfix
>
> Ways in which I think my implementation is superior
>
> 1) in the proposal the thing behind the dot has to be a function.
> Therefore, you have to wrap everything in a function before you can use
> it. Something like this is not possible
>
>> [1,2,3] . 0
> 1
>
> 2) I'm not sure this proposal solves the name collision problem but that
> might just be that i don't understand it.
>
> 3) my library doesn't require any additional syntax only a few already
> existing extensions. And you can use a bit of template haskell to assist
> the creation of objects.
>
> 4) Also the proposal doesn't mention updates but if they have to be a
> function you cant use the same name as for the function to get a field.
> And you simply can't beat my syntax, in which you can use the same name
> for both.
> object . fieldName := value -- update
> object . fieldName          -- get
>
> Silvio
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list