|
48 | 48 | -- | ```
|
49 | 49 | module Type.Proxy where
|
50 | 50 |
|
| 51 | +import Prelude |
| 52 | + |
51 | 53 | -- | Value proxy for kind `Type` types.
|
52 | 54 | data Proxy a = Proxy
|
53 | 55 |
|
| 56 | +derive instance eqProxy :: Eq (Proxy a) |
| 57 | + |
| 58 | +derive instance functorProxy :: Functor Proxy |
| 59 | + |
| 60 | +derive instance ordProxy :: Ord (Proxy a) |
| 61 | + |
| 62 | +instance applicativeProxy :: Applicative Proxy where |
| 63 | + pure _ = Proxy |
| 64 | + |
| 65 | +instance applyProxy :: Apply Proxy where |
| 66 | + apply _ _ = Proxy |
| 67 | + |
| 68 | +instance bindProxy :: Bind Proxy where |
| 69 | + bind _ _ = Proxy |
| 70 | + |
| 71 | +instance booleanAlgebraProxy :: BooleanAlgebra (Proxy a) |
| 72 | + |
| 73 | +instance boundedProxy :: Bounded (Proxy a) where |
| 74 | + bottom = Proxy |
| 75 | + top = Proxy |
| 76 | + |
| 77 | +instance commutativeRingProxy :: CommutativeRing (Proxy a) |
| 78 | + |
| 79 | +instance discardProxy :: Discard (Proxy a) where |
| 80 | + discard = bind |
| 81 | + |
| 82 | +instance heytingAlgebraProxy :: HeytingAlgebra (Proxy a) where |
| 83 | + conj _ _ = Proxy |
| 84 | + disj _ _ = Proxy |
| 85 | + implies _ _ = Proxy |
| 86 | + ff = Proxy |
| 87 | + not _ = Proxy |
| 88 | + tt = Proxy |
| 89 | + |
| 90 | +instance monadProxy :: Monad Proxy |
| 91 | + |
| 92 | +instance ringProxy :: Ring (Proxy a) where |
| 93 | + sub _ _ = Proxy |
| 94 | + |
| 95 | +instance semigroupProxy :: Semigroup (Proxy a) where |
| 96 | + append _ _ = Proxy |
| 97 | + |
| 98 | +instance semiringProxy :: Semiring (Proxy a) where |
| 99 | + add _ _ = Proxy |
| 100 | + mul _ _ = Proxy |
| 101 | + one = Proxy |
| 102 | + zero = Proxy |
| 103 | + |
| 104 | +instance showProxy :: Show (Proxy a) where |
| 105 | + show _ = "Proxy" |
| 106 | + |
54 | 107 | -- | Value proxy for kind `Type -> Type` types.
|
55 | 108 | data Proxy2 (a :: Type -> Type) = Proxy2
|
56 | 109 |
|
| 110 | +derive instance eqProxy2 :: Eq (Proxy2 a) |
| 111 | + |
| 112 | +derive instance ordProxy2 :: Ord (Proxy2 a) |
| 113 | + |
| 114 | +instance booleanAlgebraProxy2 :: BooleanAlgebra (Proxy2 a) |
| 115 | + |
| 116 | +instance boundedProxy2 :: Bounded (Proxy2 a) where |
| 117 | + bottom = Proxy2 |
| 118 | + top = Proxy2 |
| 119 | + |
| 120 | +instance commutativeRingProxy2 :: CommutativeRing (Proxy2 a) |
| 121 | + |
| 122 | +instance discardProxy2 :: Discard (Proxy2 a) where |
| 123 | + discard = bind |
| 124 | + |
| 125 | +instance heytingAlgebraProxy2 :: HeytingAlgebra (Proxy2 a) where |
| 126 | + conj _ _ = Proxy2 |
| 127 | + disj _ _ = Proxy2 |
| 128 | + implies _ _ = Proxy2 |
| 129 | + ff = Proxy2 |
| 130 | + not _ = Proxy2 |
| 131 | + tt = Proxy2 |
| 132 | + |
| 133 | +instance ringProxy2 :: Ring (Proxy2 a) where |
| 134 | + sub _ _ = Proxy2 |
| 135 | + |
| 136 | +instance semigroupProxy2 :: Semigroup (Proxy2 a) where |
| 137 | + append _ _ = Proxy2 |
| 138 | + |
| 139 | +instance semiringProxy2 :: Semiring (Proxy2 a) where |
| 140 | + add _ _ = Proxy2 |
| 141 | + mul _ _ = Proxy2 |
| 142 | + one = Proxy2 |
| 143 | + zero = Proxy2 |
| 144 | + |
| 145 | +instance showProxy2 :: Show (Proxy2 a) where |
| 146 | + show _ = "Proxy2" |
| 147 | + |
57 | 148 | -- | Value proxy for kind `Type -> Type -> Type` types.
|
58 | 149 | data Proxy3 (a :: Type -> Type -> Type) = Proxy3
|
| 150 | + |
| 151 | +derive instance eqProxy3 :: Eq (Proxy3 a) |
| 152 | + |
| 153 | +derive instance ordProxy3 :: Ord (Proxy3 a) |
| 154 | + |
| 155 | +instance booleanAlgebraProxy3 :: BooleanAlgebra (Proxy3 a) |
| 156 | + |
| 157 | +instance boundedProxy3 :: Bounded (Proxy3 a) where |
| 158 | + bottom = Proxy3 |
| 159 | + top = Proxy3 |
| 160 | + |
| 161 | +instance commutativeRingProxy3 :: CommutativeRing (Proxy3 a) |
| 162 | + |
| 163 | +instance discardProxy3 :: Discard (Proxy3 a) where |
| 164 | + discard = bind |
| 165 | + |
| 166 | +instance heytingAlgebraProxy3 :: HeytingAlgebra (Proxy3 a) where |
| 167 | + conj _ _ = Proxy3 |
| 168 | + disj _ _ = Proxy3 |
| 169 | + implies _ _ = Proxy3 |
| 170 | + ff = Proxy3 |
| 171 | + not _ = Proxy3 |
| 172 | + tt = Proxy3 |
| 173 | + |
| 174 | +instance ringProxy3 :: Ring (Proxy3 a) where |
| 175 | + sub _ _ = Proxy3 |
| 176 | + |
| 177 | +instance semigroupProxy3 :: Semigroup (Proxy3 a) where |
| 178 | + append _ _ = Proxy3 |
| 179 | + |
| 180 | +instance semiringProxy3 :: Semiring (Proxy3 a) where |
| 181 | + add _ _ = Proxy3 |
| 182 | + mul _ _ = Proxy3 |
| 183 | + one = Proxy3 |
| 184 | + zero = Proxy3 |
| 185 | + |
| 186 | +instance showProxy3 :: Show (Proxy3 a) where |
| 187 | + show _ = "Proxy3" |
0 commit comments