News for hackers. Stuff that matters.
Re:Effective Programs: 10 Years of Clojure by tome on Wednesday November 01, 2017 @04:10AM (#15599529)
Does this meet your criteria of "first-class" property? It works on any entity that "has" and "age", at least according to my definition of those things!

    -- The class definition can often be entirely elided
    -- with Generics or Template Haskell.  Instance   
    -- definitions can generally require minimal or no
    -- implementation either
    class HasAge r age | r -> age where
        getAge :: r -> age
        setAge :: r -> age -> r
    
    isOld :: HasAge r => r -> Bool
    isOld r = getAge r > 30

There are no comments on this comment yet.