2|      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ SafeUYou can use those if your type parameters are actually type constructors as well: $ st = mkSumType (Proxy :: Proxy (ReaderT R M1 A)) 4  !"#$%&'()*+,-./012344  !"#$%&'()*+,-./01234443210/.-,+*)('&%$#"!  4  !"#$%&'()*+,-./01234None,9;DI5Basic info about a data type:7Hackage package8Full Module pathA:Types that have a lens for accessing a 'TypeInfo Haskell'.CFor convenience:DFor convenience:K1Put the TypeInfo in a list together with all its : (recursively)LSimple  instance: Get the 5 itself.56789:;<=ABCDEFGHIJKL56789:;<=ABCDEFGHIJK56789:DCIJ;<=GEFHABBK 56789:;<=ABCDEFGHIJKLNone ,9:;DQRTOe.g. runState for StateSe.g. / for U-Generic representation of your Haskell types.WTypInfo lens for U.XDataConstructor lens for U.YCreate 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  (YourType).Z!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 itselfMNOPQRSTUVWXYZ[\]^_`ahijkMNOPQRSTUVWXYZ[hijkUVYQRSTMNOPZ[hiWXjkMNOPQRSTUVWXYZ[\]^_`ahijkNone,D'lmnopqrstuvwxyz{|}~'lmnopqrstuvwxyz{|}~'stuvwrnopqmlxyz{|}~ lmnopqrstuvwxyz{|}~None ,9:;<=IOTThe Haskell type to translate.KReference to the bride itself, needed for translation of type constructors.Bridges to use when a  returns  (See ).sIt is similar to BridgeBuilder but does not offer choice or failure. It is used for constructing fallbacks if a  evaluates to .6For type definitions you should use the more generic ( 8 m) constraint. This way your code will work in both  and : {-# LANGUAGE FlexibleContexts #-} import Control.Monad.Reader.Class import Language.PureScript.Bridge.TypeInfoDLens for access to the complete bridge from within our Reader monad.*This is used for example for implementing .0Bridge to PureScript by simply clearing out the 7- field. This bridge is used by default as  by : :buildBridge = buildBridgeWithCustomFixUp clearPackageFixUpThus, if no bridge matches a type, it gets optimistically translated to a PureScript type which is idential to the Haskell type. Only the 7u field gets cleared, as it is very unlikely that the PureScript package is called the same as the Haskell package.^Alternatively, if you are not that optimistic, you can use errorFixUp - which simply calls  when used. 0buildBridgeWithCustomFixUp errorFixUp yourBridge&Of course you can also write your own . It works the same as for , but you can not have choice () or failure ().A  which calles  when used. Usage: 0buildBridgeWithCustomFixUp errorFixUp yourBridgeBuild a bridge."This is a convenience wrapper for # and should normally be sufficient. Definition: ,buildBridgeWithCustomFixUp clearPackageFixUp>Takes a constructed BridgePart and makes it a total function () by using the supplied  when  returns .0Translate types that come from any module named Something.TypeParameters to lower case:EAlso drop the 1 at the end if present. This method gets called by I and buildBridgeWithCustomFixUp for you - you should not need to call it.@It enables you to even bridge type constructor definitions, see )Language.PureScript.Bridge.TypeParameters for more details.Do some check on properties of B.Check parts of B for equality: textBridge :: BridgePart textBridge = do typeName ^== "Text" typeModule ^== "Data.Text.Internal" <|> typeModule ^== "Data.Text.Internal.Lazy" return psStringBridge B H over to PureScript types.*To be used for bridging type constructors.IAlternative instance for BridgeBuilder so you can construct bridges with ", which behaves like a logical  (). If the left-hand side results in Nothing the right-hand side is used, otherwise the left-hand side. For usage examples see %Language.PureScript.Bridge.Primitives.By implementing the BB lens in the HasHaskType class, we are able to use it for both  and a plain C#, therefore you can use it with  and  for checks on the complete C value.Example: stringBridge :: BridgePart stringBridge = do -- Note: we are using the HaskellType instance here: haskType ^== mkTypeInfo (Proxy :: Proxy String) return psString4None,9:;Uses type parameters from B (bridged).Uses type parameters from B (bridged).Uses type parameters from B (bridged).Uses type parameters from B (bridged). None,:)Dummy bridge, translates every type with  None,  None,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 list all your types you want to use in PureScript and call :  let myTypes = [ mkSumType (Proxy :: Proxy MyType1) , mkSumType (Proxy :: Proxy MyType2) ] writePSTypes "path/to/your/purescript/project" (buildBridge defaultBridge) myTypes.You can define your own type bridges based on : 1 myBridge = defaultBridge <|> mySpecialTypeBridgeand use it with : N writePSTypes "path/to/your/purescript/project" (buildBridge myBridge) myTypes4Find examples for implementing your own bridges in: %Language.PureScript.Bridge.Primitives.Result: will write out PureScript modules to the given path, mirroring the hierarchy of the Haskell modules the types came from. In addition a list of needed PS packages is printed to the console.:The list of needed packages is retrieved from the bridged 5 data, so make sure you set 7J correctly in your own bridges, in order for this feature to be useful.`Real world usage example (at time of this writing outdated, at time of reading hopefully fixed):3A real world use case of this library can be found  Dhttps://github.com/gonimo/gonimo-back/blob/master/app/PSGenerator.hshere.With custom bridges defined  Shttps://github.com/gonimo/gonimo-back/blob/master/src/Gonimo/CodeGen/TypeBridges.hshere and custom PS types defined  Ohttps://github.com/gonimo/gonimo-back/blob/master/src/Gonimo/CodeGen/PSTypes.hshere.+Parts of the generated output can be found  Hhttps://github.com/gonimo/gonimo-front/blob/master/src/Gonimo/Types.purshere. Note how Secret and Key get translated according to our custom rules, with correct imports and everything. Also the formatting is quite nice, would you have guessed that this code was generated?WARNING:EThis function overwrites files - make backups or use version control!Translate all 5 values in a U to PureScript types."Example usage, with defaultBridge: Mdata Foo = Foo | Bar Int | FooBar Int Text deriving (Generic, Typeable, Show) JbridgeSumType (buildBridge defaultBridge) (mkSumType (Proxy :: Proxy Foo))`Default bridge for mapping primitive/common types: You can append your own bridges like this: * defaultBridge <|> myBridge1 <|> myBridge2(Find examples for bridge definitions in %Language.PureScript.Bridge.Primitives and  Language.PureScript.Bridge.Tuple.!Translate types in a constructor."Translate types in a record entry.s56789:;<=ABCDEFGHIJKMNOPQRSTUVWXYZ[hijklmnopqrstuvwxyz{|}~   !"#$%&'()*+,-./0123456789:;<=>?@AABCDEFGHIJKLMNOPQRSTUVWXXYZ[[\]^^_`abcdefghijklmnopqrstuvvwxyzy{|}~        1purescript-bridge-0.10.0.0-7lBpIEEGaS66kRn2a1Z6bv"Language.PureScript.Bridge.Builder)Language.PureScript.Bridge.TypeParameters#Language.PureScript.Bridge.TypeInfo"Language.PureScript.Bridge.SumType"Language.PureScript.Bridge.Printer"Language.PureScript.Bridge.PSTypes%Language.PureScript.Bridge.Primitives Language.PureScript.Bridge.TupleLanguage.PureScript.BridgebaseGHC.Base<|>Z1Y1X1W1V1U1T1S1R1Q1P1O1N1M1L1K1J1I1H1G1F1E1D1C1B1A1ZYXWVUTSRQPONMLKJIHGFEDCBATypeInfo _typePackage _typeModule _typeName_typeParametersLanguageHaskell PureScript $fEqTypeInfo $fOrdTypeInfo$fShowTypeInfo HasHaskTypehaskType HaskellTypePSType typeModuletypeName typePackagetypeParameters mkTypeInfo mkTypeInfo'flattenTypeInfo$fHasHaskTypeTypeInfo RecordEntry _recLabel _recValueDataConstructor_sigConstructor _sigValuesSumType sumTypeInfosumTypeConstructors mkSumType getUsedTypesconstructorToTypes$fGRecordEntryM1$fGRecordEntryU1$fGRecordEntry:*:$fGDataConstructorM1$fGDataConstructor:+:$fGDataConstructorM10$fShowRecordEntry$fEqRecordEntry$fShowDataConstructor$fEqDataConstructor $fShowSumType $fEqSumTypesigConstructor sigValuesrecLabelrecValue ImportLinesModules ImportLine importModule importTypesPSModuleModule psModuleName psImportLinespsTypes printModulesumTypesToNeededPackagessumTypeToNeededPackages moduleToText _lensImportsimportLineToText sumTypeToTextsumTypeToPrismsAndLensessumTypeToPrismssumTypeToLensesconstructorToTextspacestypeNameAndForall fromEntriesmkFnArgs mkTypeSigconstructorToPrismrecordEntryToLensrecordEntryToTexttypeInfoToTextsumTypesToModulessumTypeToModuletypesToImportLinestypeToImportLinesimportsFromListmergeImportLinesunlessM$fShowImportLine $fShowModule BridgeData FullBridge FixUpBridge FixUpBuilder BridgePart BridgeBuilder fullBridgeclearPackageFixUp errorFixUp buildBridgebuildBridgeWithCustomFixUpdoCheck^==psTypeParameters$fMonadPlusBridgeBuilder$fAlternativeBridgeBuilder$fHasHaskTypeBridgeData$fFunctorFixUpBuilder$fApplicativeFixUpBuilder$fMonadFixUpBuilder$fMonadReaderFixUpBuilder$fFunctorBridgeBuilder$fApplicativeBridgeBuilder$fMonadBridgeBuilder$fMonadReaderBridgeBuilderpsArraypsBoolpsEitherpsIntpsNumberpsMaybepsStringpsTuplepsUnit boolBridge eitherBridge dummyBridge intBridge doubleBridge listBridge maybeBridge stringBridge textBridge unitBridgeTupleParserStateStart OpenFound ColonFoundTupleNoTuple tupleBridgestepisTuple$fEqTupleParserState$fShowTupleParserState writePSTypes bridgeSumType defaultBridgeid Data.EitherLeftRightEither Data.ProxyProxy GRecordEntrygToRecordEntriesGDataConstructorgToConstructors _haskType _fullBridgeNothing mtl-2.2.1-6qsR1PHUy5lL47Hpoa4jCMControl.Monad.Reader.Class MonadReaderGHC.ErrerroremptyfixTypeParameters Data.Foldableorghc-prim GHC.Classes||bridgeConstructorbridgeRecordEntry