purescript-bridge-0.15.0.0: Generate PureScript data types from Haskell data types
Safe HaskellNone
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 :: (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 :: forall a (t :: Language). Eq a => Proxy a -> SumType t -> SumType t Source #

Ensure that an Eq instance is generated for your type.

order :: forall a (t :: Language). Ord a => Proxy a -> SumType t -> SumType t Source #

Ensure that both Eq and Ord 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 :: forall (lang :: Language). [DataConstructor lang] -> Maybe Instance Source #

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

getUsedTypes :: forall (lang :: Language). 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

constructorToTypes :: forall (lang :: Language). DataConstructor lang -> Set (TypeInfo lang) -> Set (TypeInfo lang) Source #

sigConstructor :: forall (lang :: Language) f. Functor f => (Text -> f Text) -> DataConstructor lang -> f (DataConstructor lang) Source #

sigValues :: forall (lang1 :: Language) (lang2 :: Language) f. Functor f => (Either [TypeInfo lang1] [RecordEntry lang1] -> f (Either [TypeInfo lang2] [RecordEntry lang2])) -> DataConstructor lang1 -> f (DataConstructor lang2) Source #

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

TypInfo lens for SumType.

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

DataConstructor lens for SumType.

recLabel :: forall (lang :: Language) f. Functor f => (Text -> f Text) -> RecordEntry lang -> f (RecordEntry lang) Source #

recValue :: forall (lang1 :: Language) (lang2 :: Language) f. Functor f => (TypeInfo lang1 -> f (TypeInfo lang2)) -> RecordEntry lang1 -> f (RecordEntry lang2) Source #