rec-def-0.1: Recusively defined values
Safe HaskellSafe-Inferred



The type R Bool is ike Bool, but allows recursive definitions:

>>> :{
  let x = rTrue
      y = x &&& z
      z = y ||| rFalse
  in getR x

This finds the least solution, i.e. prefers False over True:

>>> :{
  let x = x &&& y
      y = y &&& x
  in (getR x, getR y)

Use R (Dual Bool) from Data.Recursive.DualBool if you want the greatest solution.



data R a Source #

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.

getR :: HasPropagator a => R a -> a Source #

Extract the value from a R a. This must not be used when _defining_ that value.

rTrue :: R Bool Source #

getR rTrue == True

rFalse :: R Bool Source #

getR rFalse == False

(&&&) :: R Bool -> R Bool -> R Bool Source #

getR (r1 &&& r2) === (getR r1 && getR r2)

(|||) :: R Bool -> R Bool -> R Bool Source #

getR (r1 ||| r2) === (getR r1 || getR r2)

rand :: [R Bool] -> R Bool Source #

getR (rand rs) === and (map getR rs)

ror :: [R Bool] -> R Bool Source #

getR (ror rs) === or (map getR rs)

rnot :: R (Dual Bool) -> R Bool Source #

getR (rnot r1) === not (getRDual r1)