Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.PureScript.Bridge.SumType
- data SumType lang = SumType (TypeInfo lang) [DataConstructor lang]
- mkSumType :: forall t. (Generic t, Typeable t, GDataConstructor (Rep t)) => Proxy t -> SumType Haskell
- data DataConstructor lang = DataConstructor {
- _sigConstructor :: !Text
- _sigValues :: !(Either [TypeInfo lang] [RecordEntry lang])
- data RecordEntry lang = RecordEntry {}
- getUsedTypes :: SumType lang -> Set (TypeInfo lang)
- constructorToTypes :: DataConstructor lang -> Set (TypeInfo lang) -> Set (TypeInfo lang)
- 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)
- sumTypeConstructors :: Functor f => ([DataConstructor lang] -> f [DataConstructor lang]) -> SumType lang -> f (SumType lang)
- recLabel :: forall lang. Lens' (RecordEntry lang) Text
- recValue :: forall lang lang. Lens (RecordEntry lang) (RecordEntry lang) (TypeInfo lang) (TypeInfo lang)
Documentation
Generic representation of your Haskell types.
Constructors
SumType (TypeInfo lang) [DataConstructor lang] |
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).
data DataConstructor lang #
Constructors
DataConstructor | |
Fields
|
Instances
Eq (DataConstructor lang) # | |
Show (DataConstructor lang) # | |
data RecordEntry lang #
Constructors
RecordEntry | |
Instances
Eq (RecordEntry lang) # | |
Show (RecordEntry lang) # | |
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
constructorToTypes :: DataConstructor lang -> Set (TypeInfo lang) -> Set (TypeInfo lang) #
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) #