SHARE
TWEET

Dealing with conflicting variants of _id_

NLinker Sep 26th, 2019 134 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- krafted and shared by @cblp
  2.  
  3. {-# LANGUAGE DeriveGeneric #-}
  4. {-# LANGUAGE DuplicateRecordFields #-}
  5. {-# LANGUAGE NamedFieldPuns #-}
  6. {-# LANGUAGE OverloadedLabels #-}
  7.  
  8. import Control.Lens
  9. import Data.Generics.Labels
  10. import GHC.Generics
  11. import Prelude hiding (id)
  12. import qualified Prelude
  13.  
  14. ı = Prelude.id
  15.  
  16. data A = A {id :: Int}
  17.   deriving (Generic)
  18.  
  19. data B = B {id :: Int}
  20.   deriving (Generic)
  21.  
  22. main = do
  23.   let a = A {id = 1}
  24.   print $ let A {id} = a in ı id
  25.   let b = B {id = 2}
  26.   print $ let B {id} = b & #id %~ negate in id
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top