[Haskell-cafe] Using field accessors both ways in the same block of code?
Viktor Dukhovni
ietf-dane at dukhovni.org
Sun May 23 18:32:46 UTC 2021
On Sun, May 23, 2021 at 07:38:53AM -0700, David Banas wrote:
> Is it possible to use record field accessors both in their “normal”
> way and as values, via RecordWildCards and MyData{..}, in the same
> block of code?
{-# LANGUAGE RecordWildCards #-}
module M where
data X = X
{ a :: Int
, b :: String
}
doubleTrouble :: X -> (Int, String)
doubleTrouble rec at X{..} = (a + a, b <> M.b rec)
--
Viktor.
More information about the Haskell-Cafe
mailing list