Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
safeCast: formatting, fix unsigned-signed reversal
  • Loading branch information
mmilata committed May 10, 2019
commit d00af3c0ea78f89d721a8b69091ba43f4847cdb2
25 changes: 13 additions & 12 deletions book.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,18 +470,19 @@ but not vice-versa.
### `SafeCast`

SafeCast typeclass represents conversions that can be done safely
- from smaller (bitwise) integers to its larger counterparts
* `Uint8` to `Uint16` or larger
* `Sint8` to `Sint16` or larger
- from unsigned integers to signed integers
* `Sint8` to `Uint16`
* but not `Sint8` to `Uint8`
- from floats to doubles
* `IFloat` to `IDouble`
- from integers to floats or doubles
* `Uint16` to `IFloat` or `IDouble`
* `Sint32` to `IFloat` or `IDouble`
* with the exception of `Uint64`/`Sint64` that can only be converted to `IDouble`

* from smaller (bitwise) integers to its larger counterparts
* `Uint8` to `Uint16` or larger
* `Sint8` to `Sint16` or larger
* from unsigned integers to signed integers
* `Uint8` to `Sint16`
* but not `Uint8` to `Sint8`
* from floats to doubles
* `IFloat` to `IDouble`
* from integers to floats or doubles
* `Uint16` to `IFloat` or `IDouble`
* `Sint32` to `IFloat` or `IDouble`
* with the exception of `Uint64`/`Sint64` that can only be converted to `IDouble`

Example use:
```haskell
Expand Down