purescript-bridge-0.6.0.1: 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

HasHaskType HaskellType Source

Simple id instance: Get the TypeInfo itself.

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

type PSType = TypeInfo PureScript Source

For convenience:

type HaskellType = TypeInfo Haskell Source

For convenience:

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 HaskellType Source

Simple id instance: Get the TypeInfo itself.

HasHaskType BridgeData Source

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

Example:

stringBridge :: BridgePart
stringBridge = do
  -- Note: we are using the HaskellType instance here:
  haskType ^== mkTypeInfo (Proxy :: Proxy String)
  return psString

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

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