We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48af3f1 commit 2bf6ae6Copy full SHA for 2bf6ae6
1 file changed
src/Type/Data/Boolean.purs
@@ -12,8 +12,12 @@ module Type.Data.Boolean
12
, or
13
, class Not
14
, not
15
+ , class If
16
+ , if_
17
) where
18
19
+import Type.Proxy (Proxy(..))
20
+
21
foreign import kind Boolean
22
foreign import data True :: Boolean
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
0 commit comments