Module

Foreign

This module defines types and functions for working with foreign data.

#Foreign

data Foreign :: Type

A type for foreign data.

Foreign data is data from any external unknown or unreliable source, for which it cannot be guaranteed that the runtime representation conforms to that of any particular type.

Suitable applications of Foreign are

  • To represent responses from web services
  • To integrate with external JavaScript libraries.

#isAttrs

isAttrs :: Foreign -> Boolean

Test whether a foreign value is an Attribute Set

#isBool

isBool :: Foreign -> Boolean

Test whether a foreign value is a boolean

#isPath

isPath :: Foreign -> Boolean

Test whether a foreign value is a path

#isFloat

isFloat :: Foreign -> Boolean

Test whether a foreign value is a float

#isFunction

isFunction :: Foreign -> Boolean

Test whether a foreign value is a function

#isInt

isInt :: Foreign -> Boolean

Test whether a foreign value is an integer

#isList

isList :: Foreign -> Boolean

Test whether a foreign value is a list

#isNull

isNull :: Foreign -> Boolean

TypeMismatch String String ErrorAtIndex Int ForeignError ErrorAtProperty String ForeignError tagOf value == tag = pure (unsafeFromForeign value) otherwise = fail $ TypeMismatch tag (tagOf value) Test whether a foreign value is null

#isString

isString :: Foreign -> Boolean

Test whether a foreign value is a string

Modules