# Bool

{/* Generated from types/std.Rtypes by `just docs-std`. Do not edit this file. */}

A `Bool` is `TRUE` or `FALSE`, never `NA`. R's operators already cover most of this module;
its functions exist so that a boolean step can be passed by name, as in `List.walk(flags,
Bool.true, Bool.and)`, and so that code written against Roc's names reads the same.

| Function | Summary |
| --- | --- |
| [`Bool.true`](#booltrue) | `TRUE`, as Roc spells it. |
| [`Bool.false`](#boolfalse) | `FALSE`. |
| [`Bool.from_r`](#boolfrom_r) | Converts an R `logical` into a `Bool`, refusing `NA` and a length other than one. |
| [`Bool.and`](#booland) | Whether both are `TRUE`. |
| [`Bool.or`](#boolor) | Whether either is `TRUE`. |
| [`Bool.not`](#boolnot) | The opposite value. |
| [`Bool.is_eq`](#boolis_eq) | Whether two values are equal by `identical()`, the library's equality. |
| [`Bool.is_not_eq`](#boolis_not_eq) | Whether two values differ by `identical()`. |

## `Bool.true`

```r
#: Bool
Bool.true
```

`TRUE`, as Roc spells it. It is a value, not a function.

```r
Bool.true
#> TRUE
```

[Source](https://github.com/felix-andreas/ry/blob/main/types/std.Rtypes#L1751)

## `Bool.false`

```r
#: Bool
Bool.false
```

`FALSE`.

```r
Bool.false
#> FALSE
```

[Source](https://github.com/felix-andreas/ry/blob/main/types/std.Rtypes#L1759)

## `Bool.from_r`

### Inline

```r
Bool.from_r <- function(value: logical) -> Bool
```

### Comments

```r
#: fn(value: logical) -> Bool
Bool.from_r <- function(value)
```

Converts an R `logical` into a `Bool`, refusing `NA` and a length other than one.

[Source](https://github.com/felix-andreas/ry/blob/main/types/std.Rtypes#L1762)

## `Bool.and`

### Inline

```r
Bool.and <- function(first: Bool, second: Bool) -> Bool
```

### Comments

```r
#: fn(first: Bool, second: Bool) -> Bool
Bool.and <- function(first, second)
```

Whether both are `TRUE`. Both arguments are evaluated, unlike with `&&`.

```r
Bool.and(TRUE, FALSE)
#> FALSE
```

[Source](https://github.com/felix-andreas/ry/blob/main/types/std.Rtypes#L1770)

## `Bool.or`

### Inline

```r
Bool.or <- function(first: Bool, second: Bool) -> Bool
```

### Comments

```r
#: fn(first: Bool, second: Bool) -> Bool
Bool.or <- function(first, second)
```

Whether either is `TRUE`. Both arguments are evaluated, unlike with `||`.

```r
Bool.or(TRUE, FALSE)
#> TRUE
```

[Source](https://github.com/felix-andreas/ry/blob/main/types/std.Rtypes#L1778)

## `Bool.not`

### Inline

```r
Bool.not <- function(value: Bool) -> Bool
```

### Comments

```r
#: fn(value: Bool) -> Bool
Bool.not <- function(value)
```

The opposite value.

```r
List.keep_if([1, 2, 3], function(x) Bool.not(Num.is_even(x)))
#> [1i64, 3i64]
```

[Source](https://github.com/felix-andreas/ry/blob/main/types/std.Rtypes#L1786)

## `Bool.is_eq`

### Inline

```r
Bool.is_eq <- function<T: eq>(first: T, second: T) -> Bool
```

### Comments

```r
#: <T: eq> fn(first: T, second: T) -> Bool
Bool.is_eq <- function(first, second)
```

Whether two values are equal by `identical()`, the library's equality. An integer and a double
are never identical, so `Bool.is_eq(1L, 1)` is `FALSE`, and a dictionary or set compares without
regard to order.

```r
Bool.is_eq(Set.from_list([1, 2]), Set.from_list([2, 1]))
#> TRUE
```

[Source](https://github.com/felix-andreas/ry/blob/main/types/std.Rtypes#L1796)

## `Bool.is_not_eq`

### Inline

```r
Bool.is_not_eq <- function<T: eq>(first: T, second: T) -> Bool
```

### Comments

```r
#: <T: eq> fn(first: T, second: T) -> Bool
Bool.is_not_eq <- function(first, second)
```

Whether two values differ by `identical()`.

```r
Bool.is_not_eq([1], [2])
#> TRUE
```

[Source](https://github.com/felix-andreas/ry/blob/main/types/std.Rtypes#L1804)
