Skip to content
This repository was archived by the owner on Nov 26, 2020. It is now read-only.

Commit 19ac791

Browse files
joneshfpaf31
authored andcommitted
Add some instances (#4)
* Update npm dependencies to 0.11 * Implement instances for many type classes
1 parent 7ba679c commit 19ac791

File tree

3 files changed

+135
-3
lines changed

3 files changed

+135
-3
lines changed

bower.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
"test",
1616
"bower.json",
1717
"package.json"
18-
]
18+
],
19+
"dependencies": {
20+
"purescript-prelude": "^3.0.0"
21+
}
1922
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"build": "pulp build -- --censor-lib --strict"
66
},
77
"devDependencies": {
8-
"pulp": "^10.0.4",
9-
"purescript-psa": "^0.5.0-rc.1",
8+
"pulp": "^11.0.0",
9+
"purescript-psa": "^0.5.1",
1010
"rimraf": "^2.6.1"
1111
}
1212
}

src/Type/Proxy.purs

+129
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,140 @@
4848
-- | ```
4949
module Type.Proxy where
5050

51+
import Prelude
52+
5153
-- | Value proxy for kind `Type` types.
5254
data Proxy a = Proxy
5355

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+
54107
-- | Value proxy for kind `Type -> Type` types.
55108
data Proxy2 (a :: Type -> Type) = Proxy2
56109

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+
57148
-- | Value proxy for kind `Type -> Type -> Type` types.
58149
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

Comments
 (0)