2{-# LANGUAGE DeriveDataTypeable #-}
3{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE FlexibleInstances #-}
6{-# LANGUAGE GeneralizedNewtypeDeriving #-}
7{-# LANGUAGE StandaloneDeriving #-}
15import Data.Functor.Compose (Compose (..))
16import Data.Functor.Identity (Identity (..))
19import Test.QuickCheck (Property, counterexample)
20import qualified Data.Map as Map
23type Compose3 f g h = Compose (Compose f g) h
24type Compose3' f g h = Compose f (Compose g h)
29 , fooTuple :: (String, Text, Int)
30 -- This definition causes an infinite loop in genericTo and genericFrom!
31 -- , fooMap :: Map.Map String Foo
32 , fooMap :: Map.Map String (Text,Int)
33 } deriving (Show, Typeable, Data)
38 } deriving (Show, Eq, Data, Typeable)
40data OneConstructor = OneConstructor
41 deriving (Show, Eq, Typeable, Data)
43data Product2 a b = Product2 a b
44 deriving (Show, Eq, Typeable, Data)
46data Product6 a b c d e f = Product6 a b c d e f
47 deriving (Show, Eq, Typeable, Data)
49data Sum4 a b c d = Alt1 a | Alt2 b | Alt3 c | Alt4 d
50 deriving (Show, Eq, Typeable, Data)
53 (=~) :: a -> a -> Bool
55newtype Approx a = Approx { fromApprox :: a }
56 deriving (Show, Data, Typeable, ApproxEq, Num)
58instance (ApproxEq a) => Eq (Approx a) where
59 Approx a == Approx b = a =~ b
61data Nullary = C1 | C2 | C3 deriving (Eq, Show)
63data SomeType a = Nullary
65 | Product String (Maybe Char) a
66 | Record { testOne :: Double
67 , testTwo :: Maybe Bool
68 , testThree :: Maybe a
73-- Used for testing UntaggedValue SumEncoding
77 | BothTextInt Text Int
82 GADT :: { gadt :: String } -> GADT String
85deriving instance Data (GADT String)
86deriving instance Eq (GADT a)
87deriving instance Show (GADT a)
89deriving instance Generic Foo
90deriving instance Generic UFoo
91deriving instance Generic OneConstructor
92deriving instance Generic (Product2 a b)
93deriving instance Generic (Product6 a b c d e f)
94deriving instance Generic (Sum4 a b c d)
95deriving instance Generic (Approx a)
96deriving instance Generic Nullary
97deriving instance Generic (SomeType a)
98#if __GLASGOW_HASKELL__ >= 706
99deriving instance Generic1 SomeType
101deriving instance Generic EitherTextInt
103failure :: Show a => String -> String -> a -> Property
104failure func msg v = counterexample
105 (func ++ " failed: " ++ msg ++ ", " ++ show v) False
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