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
1212 , or
1313 , class Not
1414 , not
15+ , class If
16+ , if_
1517 ) where
1618
19+ import Type.Proxy (Proxy (..))
20+
1721foreign import kind Boolean
1822foreign import data True :: Boolean
1923foreign import data False :: Boolean
@@ -64,3 +68,15 @@ instance notFalse :: Not False True
6468
6569not :: forall i o . Not i o => BProxy i -> BProxy o
6670not _ = 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