purescript-bridge-0.15.0.0: Generate PureScript data types from Haskell data types
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.PureScript.Bridge.SumType

Synopsis

Documentation

data SumType (lang :: Language) Source #

Generic representation of your Haskell types.

Constructors

SumType (TypeInfo lang) [DataConstructor lang] [Instance] 

Instances

Instances details
Show (SumType lang) Source # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

show :: SumType lang -> String #

showList :: [SumType lang] -> ShowS #

Eq (SumType lang) Source # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

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

mkSumType :: forall t. (Generic t, Typeable t, GDataConstructor (Rep t)) => Proxy t -> SumType 'Haskell Source #

Create a representation of your sum (and product) types, for doing type translations and writing it out to your PureScript modules. In order to get the type information we use a dummy variable of type Proxy (YourType).

equal :: Eq a => Proxy a -> SumType t -> SumType t Source #

Ensure that an Instance instance is generated for your type.

order :: Ord a => Proxy a -> SumType t -> SumType t Source #

Ensure that both Instance and Instance instances are generated for your type.

data DataConstructor (lang :: Language) Source #

Constructors

DataConstructor 

Fields

Instances

Instances details
Show (DataConstructor lang) Source # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Eq (DataConstructor lang) Source # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

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

data RecordEntry (lang :: Language) Source #

Constructors

RecordEntry 

Fields

Instances

Instances details
Show (RecordEntry lang) Source # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

show :: RecordEntry lang -> String #

showList :: [RecordEntry lang] -> ShowS #

Eq (RecordEntry lang) Source # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

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

data Instance Source #

Purescript typeclass instances that can be generated for your Haskell types.

Instances

Instances details
Show Instance Source # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Eq Instance Source # 
Instance details

Defined in Language.PureScript.Bridge.SumType

nootype :: [DataConstructor lang] -> Maybe Instance Source #

The Purescript typeclass Newtype might be derivable if the original Haskell type was a simple type wrapper.

getUsedTypes :: SumType lang -> Set (TypeInfo lang) Source #

Get all used types in a sum type.

This includes all types found at the right hand side of a sum type definition, not the type parameters of the sum type itself

sigValues :: forall lang lang. Lens (DataConstructor lang) (DataConstructor lang) (Either [TypeInfo lang] [RecordEntry lang]) (Either [TypeInfo lang] [RecordEntry lang]) Source #

sumTypeInfo :: Functor f => (TypeInfo lang -> f (TypeInfo lang)) -> SumType lang -> f (SumType lang) Source #

TypInfo lens for SumType.

sumTypeConstructors :: Functor f => ([DataConstructor lang] -> f [DataConstructor lang]) -> SumType lang -> f (SumType lang) Source #

DataConstructor lens for SumType.

recLabel :: forall lang. Lens' (RecordEntry lang) Text Source #

recValue :: forall lang lang. Lens (RecordEntry lang) (RecordEntry lang) (TypeInfo lang) (TypeInfo lang) Source #