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

Instances

HasHaskType HaskellType Source #

Simple id instance: Get the TypeInfo itself.

Eq (TypeInfo lang) Source # 

Methods

(==) :: TypeInfo lang -> TypeInfo lang -> Bool #

(/=) :: TypeInfo lang -> TypeInfo lang -> Bool #

Ord (TypeInfo lang) Source # 

Methods

compare :: TypeInfo lang -> TypeInfo lang -> Ordering #

(<) :: TypeInfo lang -> TypeInfo lang -> Bool #

(<=) :: TypeInfo lang -> TypeInfo lang -> Bool #

(>) :: TypeInfo lang -> TypeInfo lang -> Bool #

(>=) :: TypeInfo lang -> TypeInfo lang -> Bool #

max :: TypeInfo lang -> TypeInfo lang -> TypeInfo lang #

min :: TypeInfo lang -> TypeInfo lang -> TypeInfo lang #

Show (TypeInfo lang) Source # 

Methods

showsPrec :: Int -> TypeInfo lang -> ShowS #

show :: TypeInfo lang -> String #

showList :: [TypeInfo lang] -> ShowS #

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'.

Minimal complete definition

haskType

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)