| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Language.PureScript.Bridge.SumType
- data SumType = SumType TypeInfo [DataConstructor]
- toSumType :: forall t. (Generic t, Typeable t, GDataConstructor (Rep t)) => Proxy t -> SumType
- data DataConstructor = DataConstructor {
- sigConstructor :: !Text
- sigValues :: !(Either [TypeInfo] [RecordEntry])
- data RecordEntry = RecordEntry {}
- class GDataConstructor f where
- gToConstructors :: f a -> [DataConstructor]
- class GRecordEntry f where
- gToRecordEntries :: f a -> [RecordEntry]
- getUsedTypes :: SumType -> [TypeInfo]
- constructorToType :: DataConstructor -> [TypeInfo] -> [TypeInfo]
Documentation
Generic representation of your Haskell types, the contained (leaf) types can be modified to match
compatible PureScript types, by using TypeBridge functions like defaultBridge with writePSTypes.
Constructors
| SumType TypeInfo [DataConstructor] |
toSumType :: forall t. (Generic t, Typeable t, GDataConstructor (Rep t)) => Proxy t -> SumType 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).
data DataConstructor Source
Constructors
| DataConstructor | |
Fields
| |
Instances
class GDataConstructor f where Source
Methods
gToConstructors :: f a -> [DataConstructor] Source
Instances
| (GDataConstructor a, GDataConstructor b) => GDataConstructor ((:+:) a b) Source | |
| (Datatype a, GDataConstructor c) => GDataConstructor (D1 a c) Source | |
| (Constructor a, GRecordEntry b) => GDataConstructor (C1 a b) Source |
class GRecordEntry f where Source
Methods
gToRecordEntries :: f a -> [RecordEntry] Source
Instances
| GRecordEntry U1 Source | |
| (GRecordEntry a, GRecordEntry b) => GRecordEntry ((:*:) a b) Source | |
| (Selector a, Typeable * t) => GRecordEntry (S1 a (K1 R t)) Source |
getUsedTypes :: SumType -> [TypeInfo] Source
constructorToType :: DataConstructor -> [TypeInfo] -> [TypeInfo] Source