File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,12 @@ module Type.Data.Boolean
12
12
, or
13
13
, class Not
14
14
, not
15
+ , class If
16
+ , if_
15
17
) where
16
18
19
+ import Type.Proxy (Proxy (..))
20
+
17
21
foreign import kind Boolean
18
22
foreign import data True :: Boolean
19
23
foreign import data False :: Boolean
@@ -64,3 +68,15 @@ instance notFalse :: Not False True
64
68
65
69
not :: forall i o . Not i o => BProxy i -> BProxy o
66
70
not _ = BProxy
71
+
72
+ -- | If - dispatch based on a boolean
73
+ class If (bool :: Boolean )
74
+ (onTrue :: Type )
75
+ (onFalse :: Type )
76
+ (output :: Type ) |
77
+ bool -> onTrue onFalse output
78
+ instance ifTrue :: If True onTrue onFalse onTrue
79
+ instance ifFalse :: If False onTrue onFalse onFalse
80
+
81
+ if_ :: forall b t e o . If b t e o => BProxy b -> Proxy t -> Proxy e -> Proxy o
82
+ if_ _ _ _ = Proxy
You can’t perform that action at this time.
0 commit comments