Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The type R (Dual Bool)
is ike Bool
, but allows recursive definitions:
>>>
:{
let x = rTrue y = x &&& z z = y ||| rFalse in getRDual x :} True
This finds the greatest solution, i.e. prefers True
over False
:
>>>
:{
let x = x &&& y y = y &&& x in (getRDual x, getRDual y) :} (True,True)
Use R Bool
from Data.Recursive.Bool if you want the least solution.
Synopsis
- data R a
- getRDual :: HasPropagator (Dual a) => R (Dual a) -> a
- rTrue :: R (Dual Bool)
- rFalse :: R (Dual Bool)
- (|||) :: R (Dual Bool) -> R (Dual Bool) -> R (Dual Bool)
- (&&&) :: R (Dual Bool) -> R (Dual Bool) -> R (Dual Bool)
- ror :: [R (Dual Bool)] -> R (Dual Bool)
- rand :: [R (Dual Bool)] -> R (Dual Bool)
- rnot :: R Bool -> R (Dual Bool)
Documentation
A value of type R a
is a a
, but defined using only specific operations
(which you will find in the corresponding module, e.g.
Data.Recursive.Bool), which allow recursive definitions.
You can use getR
to extract the value.
Do not use the extracted value in the definition of that value, this will loop just like a recursive definition with plain values would.
getRDual :: HasPropagator (Dual a) => R (Dual a) -> a Source #
Convenience variant of getR
to also remove the Dual
newtype wrapper, mostly for use with Data.Recursive.DualBool.
(|||) :: R (Dual Bool) -> R (Dual Bool) -> R (Dual Bool) Source #
getRDual (r1 ||| r2) === (getRDual r1 || getRDual r2)