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

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Bridge.SumType

Synopsis

Documentation

data SumType (lang :: Language) #

Generic representation of your Haskell types.

Constructors

SumType (TypeInfo lang) [DataConstructor lang] [Instance] 
Instances
Eq (SumType lang) # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

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

Show (SumType lang) # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

show :: SumType lang -> String #

showList :: [SumType lang] -> ShowS #

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

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 #

Ensure that an Instance instance is generated for your type.

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

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

data DataConstructor (lang :: Language) #

Constructors

DataConstructor 

Fields

Instances
Eq (DataConstructor lang) # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

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

Show (DataConstructor lang) # 
Instance details

Defined in Language.PureScript.Bridge.SumType

data RecordEntry (lang :: Language) #

Constructors

RecordEntry 

Fields

Instances
Eq (RecordEntry lang) # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

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

Show (RecordEntry lang) # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Methods

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

show :: RecordEntry lang -> String #

showList :: [RecordEntry lang] -> ShowS #

data Instance #

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

Constructors

Generic 
Newtype 
Eq 
Ord 
Instances
Eq Instance # 
Instance details

Defined in Language.PureScript.Bridge.SumType

Show Instance # 
Instance details

Defined in Language.PureScript.Bridge.SumType

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

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

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

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

sigConstructor :: forall lang. Lens' (DataConstructor lang) Text #

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

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

TypInfo lens for SumType.

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

DataConstructor lens for SumType.

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

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