Skip to content

Instantly share code, notes, and snippets.

@nlinker
Forked from cblp/id.hs
Created September 26, 2019 12:17
Show Gist options
  • Save nlinker/b9d3412f51fd52f1f237ce27785776ff to your computer and use it in GitHub Desktop.
Save nlinker/b9d3412f51fd52f1f237ce27785776ff 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