Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Curryrs.Convert
Description
The Convert module contains various functions used for converting values to or from their FFI form. It also contains Error types in case conversions to not go as planned.
- fromBoolean :: Boolean -> Either ConversionError Bool
- data ConversionError
Documentation
fromBoolean :: Boolean -> Either ConversionError Bool Source #
This method tries to to turn a number returned by FFI into a Bool. It's wrapped in an either in case the underlying number representing the Boolean is not 0 or 1
>>>
fromBoolean 1
Right True
>>>
fromBoolean 0
Right False
>>>
fromBoolean 3
Left Failed to extract a boolean value in the use of fromBoolean. Number was not 0 or 1
data ConversionError Source #
Error data type for conversions that have failed going to or from their FFI form
Instances