packages feed

purescript-bridge 0.3.0.2 → 0.3.0.3

raw patch · 2 files changed

+17/−12 lines, 2 files

Files

purescript-bridge.cabal view
@@ -10,7 +10,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.3.0.2+version:             0.3.0.3  -- A short (one-line) description of the package. synopsis:            Generate PureScript data types from Haskell data types
src/Language/PureScript/Bridge.hs view
@@ -25,26 +25,31 @@ --   Make sure all your types derive Generic and Typeable. --   Typeable is not needed from ghc-7.10 on. -----   Then call 'writePSTypes' like this:+--   Then list all your types you want to use in PureScript and call 'writePSTypes': -- --   >  let myTypes = [---   >      'toSumType' ('Proxy' :: 'Proxy' MyType1)---   >    , 'toSumType' ('Proxy' :: 'Proxy' MyType2)+--   >      toSumType (Proxy :: Proxy MyType1)+--   >    , toSumType (Proxy :: Proxy MyType2) --   >   ] --   >---   >  'writePSTypes' 'defaultBridge' "path\/to\/you\/purescript\/project" myTypes+--   >  writePSTypes defaultBridge "path/to/your/purescript/project" myTypes -----   You can add new type mappings, like this:---   +--   You can define your own type bridges based on 'defaultBridge': -----  >  myBridge = 'defaultBridge' \<|\> mySpecialTypeBridge---    -----   Find examples for implementing your own type bridges in: 'Language.PureScript.Bridge.Primitives'+--  >  myBridge = 'defaultBridge' <|> mySpecialTypeBridge+--+--  and use it with 'writePSTypes':+--+--  >  writePSTypes myBridge "path/to/your/purescript/project" myTypes+--+--   Find examples for implementing your own type bridges in: "Language.PureScript.Bridge.Primitives".+--+--  == Real world usage example: --   A real world use case of this library can be found <https://github.com/gonimo/gonimo-back/blob/master/src/MkFrontendTypes.hs here>.---   Last but not least: -----   /WARNING/: This function overwrites files - make backups or use version control!+--  == /WARNING/:+--   This function overwrites files - make backups or use version control! writePSTypes :: TypeBridge -> FilePath -> [SumType] -> IO () writePSTypes br root sts = do     let bridged = map (bridgeSumType br) sts