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.Product
20 } deriving (Show, Generic)
27 } deriving (Show, Generic)
30 = Animal' { name :: String, eats :: String, age :: Int }
31 | Human' { name :: String, age :: Int, address :: String, eats :: String }
32 deriving (Show, Generic)
35toby = Human { name = "Toby", age = 10, address = "London", eats = "Bread" }
37growUp :: Animal -> Animal
38growUp (Animal n a _) = Animal n (a + 10) "raw meat"
40data MyRecord = MyRecord { field1 :: Int, field2 :: String } deriving Generic
42--g :: Subtype s MyRecord => s -> String
43--g s = s ^. super @MyRecord . label @"field2"
45data Test a b = Test { fieldInt :: Int, fieldA :: a, fieldB :: b } deriving (Generic, Show)
47-- changedA :: Test Int String
49-- Test {fieldInt = 10, fieldA = 10, fieldB = "world"}
50changedA = set (field @"fieldA") (10 :: Int) (Test 10 "hello" "world")
52-- changedB :: Test String Int
54-- Test {fieldInt = 10, fieldA = "hello", fieldB = 10}
55changedB = set (field @"fieldB") (10 :: Int) (Test 10 "hello" "world")
57--changedInt = set (field @"fieldInt") ("hello") (Test 10 "hello" "world")
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