Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- bridgeSumType :: TypeBridge -> SumType -> SumType
- defaultBridge :: TypeBridge
- writePSTypes :: TypeBridge -> FilePath -> [SumType] -> IO ()
Documentation
bridgeSumType :: TypeBridge -> SumType -> SumType Source
writePSTypes :: TypeBridge -> FilePath -> [SumType] -> IO () Source
Your entry point to this library and quite likely all you will need.
| Make sure all your types derive Generic and Typeable.
| Typeable is not needed from ghc-7.10 on.
| Then call writePSTypes
like this:
|
| let myTypes = [
|
| You can add new type mappings, like this:
| toSumType
(Proxy
:: Proxy
MyType1)
| , toSumType
(Proxy
:: Proxy
MyType2)
| ]
| writePSTypes
defaultBridge
"pathtoyoupurescriptproject" myTypes
|
| myBridge =
| Find examples for implementing your own type bridges in: defaultBridge
| mySpecialTypeBridge
| Primitives
| A real world use case of this library can be found here.
| Last but not least:
| WARNING: This function overwrites files - make backups or use version control!