purescript-bridge-0.4.0.0: Generate PureScript data types from Haskell data types

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Bridge.TypeInfo

Synopsis

Documentation

data TypeInfo lang Source

Basic info about a data type:

Constructors

TypeInfo 

Fields

_typePackage :: !Text

Hackage package

_typeModule :: !Text

Full Module path

_typeName :: !Text
 
_typeParameters :: ![TypeInfo lang]
 

Instances

Eq (TypeInfo lang) Source 
Ord (TypeInfo lang) Source 
Show (TypeInfo lang) Source 
HasHaskType (TypeInfo Haskell) Source

Simple id instance: Get the TypeInfo itself.

data Language Source

Constructors

Haskell 
PureScript 

typePackage :: forall lang. Lens' (TypeInfo lang) Text Source

typeModule :: forall lang. Lens' (TypeInfo lang) Text Source

typeName :: forall lang. Lens' (TypeInfo lang) Text Source

typeParameters :: forall lang lang. Lens (TypeInfo lang) (TypeInfo lang) [TypeInfo lang] [TypeInfo lang] Source

class HasHaskType t where Source

Types that have a lens for accessing a 'TypeInfo Haskell'.

Instances

HasHaskType BridgeData Source

By implementing the haskType lens in the HasHaskType class, we are able to use it for both BridgeData and a plain 'TypeInfo Haskell', therefore you can use it with doCheck and ^== for checks on the complete 'TypeInfo Haskell' value.

Example:

stringBridge :: BridgePart
stringBridge = do
  -- Note: we are using the TypeInfo 'Haskell instance here:
  haskType ^== mkTypeInfo (Proxy :: Proxy String)
  return psString
HasHaskType (TypeInfo Haskell) Source

Simple id instance: Get the TypeInfo itself.

flattenTypeInfo :: TypeInfo lang -> [TypeInfo lang] Source

Put the TypeInfo in a list together with all its _typeParameters (recursively)