Skip to content

Instantly share code, notes, and snippets.

@cblp
Created September 26, 2019 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cblp/d7c1994cef093963337985558932bc69 to your computer and use it in GitHub Desktop.
Save cblp/d7c1994cef093963337985558932bc69 to your computer and use it in GitHub Desktop.
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLabels #-}
import Control.Lens
import Data.Generics.Labels
import GHC.Generics
import Prelude hiding (id)
import qualified Prelude
ı = Prelude.id
data A = A {id :: Int}
deriving (Generic)
data B = B {id :: Int}
deriving (Generic)
main = do
let a = A {id = 1}
print $ let A {id} = a in ı id
let b = B {id = 2}
print $ let B {id} = b & #id %~ negate in id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment