1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE DuplicateRecordFields #-}
4{-# LANGUAGE FlexibleContexts #-}
5{-# LANGUAGE TypeApplications #-}
6{-# LANGUAGE UndecidableInstances #-}
8{-# OPTIONS_GHC -fno-warn-unused-imports #-}
13import Data.Generics.Record
14import Data.Generics.Product
21 } deriving (Show, Generic)
28 } deriving (Show, Generic)
31 = Animal' { name :: String, eats :: String, age :: Int }
32 | Human' { name :: String, age :: Int, address :: String, eats :: String }
33 deriving (Show, Generic)
36toby = Human { name = "Toby", age = 10, address = "London", eats = "Bread" }
38growUp :: Animal -> Animal
39growUp (Animal n a _) = Animal n (a + 10) "raw meat"
41data MyRecord = MyRecord { field1 :: Int, field2 :: String } deriving Generic
43--g :: Subtype s MyRecord => s -> String
44--g s = s ^. super @MyRecord . label @"field2"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list