News for hackers. Stuff that matters.
Re:A Year of Functional Programming by dllthomas on Wednesday June 11, 2014 @10:24AM (#7878133)
I feel like the nearest thing to OO in Haskell in common use is the records-of-closures pattern. Still doesn't have persistent identity, of course.
Re:A Year of Functional Programming by tel on Thursday June 12, 2014 @12:41AM (#7881843)
Records-of-closures is pretty much what I'm talking about. There is a notion of identity when those records are recursive, though the state management is still manual (as you'd expect).

    data Complex = { rotate :: Degrees -> Complex }

    -- thus
    -- rotate :: Complex -> Degrees -> Complex
where `rotate` is a state transformer and thus produces a notion of identity.
Re:A Year of Functional Programming by dllthomas on Friday June 13, 2014 @08:29PM (#7891584)
I think it's a stretch to say this, itself, provides any notion of identity. You could certainly implement identity with any of the myriad ways of maintaining references with state, of course.
Re:A Year of Functional Programming by tel on Tuesday June 17, 2014 @04:31PM (#7906810)
Of course you're right, but I think a function like

    Complex -> Radian -> Complex
offers two points of view. You can see it as a function which transforms complex numbers or a function representing an update to the internal state of a Complex object. The second highlights the need to keep track of identity. Throwing an STRef into the mix just gives you a particular kind of history—one which only retains the "now".

Which is all sort of obvious and meaningless, but I still think it's interesting to think about. I think coalgebras tend to force thinking in terms of identity in this kind of way.