I said ( https://mail.haskell.org/pipermail/haskell-cafe/2024-December/136986.html)
On Wed, 25 Dec 2024 at 16:49, Anthony Clayden <anthony.d.clay...@gmail.com> wrote: > ... > > [**] I'm particularly keen on field names starting upper case, because > they're injective/part of the structure, like data constructors. > > > And previously with Hugs ( https://mail.haskell.org/pipermail/hugs-users/2020-May/000927.html) > * I've taught Trex to support field labels starting upper-case, because, > well for me they're more like constructors than variables. > > So can I combine that work? Yes, providing I use Upper-case labels only within `{ ... }`. These can combine lower with Upper field names within the same data type; can pun on the lower. > > data Upup a = MkUp{ down :: a, Up :: Int } deriving (Eq, Show) > > anUp = MkUp{ down = 'a', Up = 5 } -- build > recUp = anUp{ Up = 7 } -- field update by Up label, record syntax > > succUp (MkUp {down, Up = u} ) = MkUp{ down = succ down, Up = succ u } > You can't use a field selection function: 'ERROR - "Up" is not a data constructor'. (It looks like Hugs does generate such a function; this error is a syntax rejection in trying to use it.)
_______________________________________________ Hugs-Users mailing list Hugs-Users@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/hugs-users