ú΂ßye       !"#$%&'()*+,-./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(35>C5Basic info about a data type:7Hackage package8Full Module path>:Types that have a lens for accessing a 'TypeInfo Haskell'.F1Put the TypeInfo in a list together with all its : (recursively) Simple ¡ instance: Get the 5 itself.56789:;<=>?@ABCDEF 56789:;<=>?@ABCDEF56789:DE;<=B@AC>?F 56789:;<=>?@ABCDEF None (345>KLNO-Generic representation of your Haskell types.QTypInfo lens for O.RDataConstructor lens for O.SÏ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 ¢ (YourType).£¤¥¦GHIJKLMNOPQRSTU§¨©ª«¬VWXYGHIJKLMNOPQRSTUVWXYOPSKLMNGHIJTUVWQRXY£¤¥¦GHIJKLMNOPQRSTU§¨©ª«¬VWXYNone(>Z[\]^_`abcdefghijklmnopqrstuZ[\]^_`abcdefghijklmnopqrstuabcde`\]^_[ZfghijklmnopqrstuZ[\]^_`abcdefghijklmnopqrstuNone(357CIN ­The Haskell type to translate.®KReference to the bride itself, needed for translation of type constructors.yBridges to use when a v returns ¯.|0Bridge to PureScript by simply clearing out the 7- field. This bridge is used by default as y 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 yF. In this case it is highly recommended that you build your custom y from v with  too, with y being finally }I. This way you get all the builder convenience and proper bridging of C<. For an example have a look at the implementation of clearPackageFixup.}A y which calles ° when used. Usage: 0buildBridgeWithCustomFixUp errorFixUp yourBridge~Build a bridge."This is a convenience wrapper for . Definition: ,buildBridgeWithCustomFixUp clearPackageFixUp>Takes a constructed BridgePart and makes it a total function (z) by using the supplied y when v returns ¯. The supplied v also gets passed through €9 in order to support translation of type constructors.€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 ?.‚Check parts of ? for equality: £textBridge :: BridgePart textBridge = do typeName ^== "Text" typeModule ^== "Data.Text.Internal" <|> typeModule ^== "Data.Text.Internal.Lazy" return psStringƒBridge ? C 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 ?B lens in the HasHaskType class, we are able to use it for both xB and a plain 'TypeInfo Haskell', therefore you can use it with  and ‚8 for checks on the complete 'TypeInfo Haskell' value.Example: ­stringBridge :: BridgePart stringBridge = do -- Note: we are using the TypeInfo 'Haskell instance here: haskType ^== mkTypeInfo (Proxy :: Proxy String) return psStringvwµx¶­®yz{|}~€‚ƒ·±´vwxyz{|}~€‚ƒzyx{wv|}~‚ƒ€vwµx¶­®yz{|}~€‚ƒ·±´‚None(35„Uses type parameters from ? (bridged).†Uses type parameters from ? (bridged).ˆUses type parameters from ? (bridged).ŠUses type parameters from ? (bridged).„…†‡ˆ‰Š‹„…†‡ˆ‰Š‹„…†‡ˆ‰Š‹„…†‡ˆ‰Š‹NoneŒŽ‘’“ŒŽ‘’“ŒŽ‘’“ŒŽ‘’“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 (buildBridge defaultBridge) "path/to/your/purescript/project" myTypes.You can define your own type bridges based on Ÿ: 1 myBridge = defaultBridge <|> mySpecialTypeBridgeand use it with : N writePSTypes (buildBridge myBridge) "path/to/your/purescript/project" 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  Hhttps://github.com/gonimo/gonimo-back/blob/master/src/MkFrontendTypes.hshere.With custom bridges defined  Khttps://github.com/gonimo/gonimo-back/blob/master/src/Gonimo/TypeBridges.hshere and custom PS types defined  Ghttps://github.com/gonimo/gonimo-back/blob/master/src/Gonimo/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 O 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.žŸ¸¹d56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒŒŽ‘’“”•–—˜™š›œžŸžŸžŸ¸¹º   !"#$%&'()*+,-./0123456789:;<=>?@AABCDEFGHIJKLMNOPQRRSTUUVWXXYZ[\]^_`abcddefghgijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢ £ ¤ ¥¦ § ¨©ª«¬­®¯°±²³´µ ¶ ·¸¹ º»¼½¾¿}~À Á ÂÃpures_BYfRJ2m8Ei0Jgyjd0sTIuM"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 HasHaskTypehaskType typeModuletypeName typePackagetypeParameters mkTypeInfo mkTypeInfo'flattenTypeInfo RecordEntry _recLabel _recValueDataConstructor_sigConstructor _sigValuesSumType sumTypeInfosumTypeConstructors mkSumType getUsedTypesconstructorToTypesigConstructor sigValuesrecLabelrecValue ImportLinesModules ImportLine importModule importTypesPSModuleModule psModuleName psImportLinespsTypes printModulesumTypesToNeededPackagessumTypeToNeededPackages moduleToTextimportLineToText sumTypeToTextconstructorToTextrecordEntryToTexttypeInfoToTextsumTypesToModulessumTypeToModuletypesToImportLinestypeToImportLinesimportsFromListmergeImportLinesunlessM BridgePart BridgeBuilder BridgeData FixUpBridge FullBridge fullBridgeclearPackageFixUp errorFixUp buildBridgebuildBridgeWithCustomFixUpfixTypeParametersdoCheck^==psTypeParameterspsArraypsBoolpsEitherpsIntpsMaybepsStringpsTuplepsUnit boolBridge eitherBridge intBridge listBridge maybeBridge stringBridge textBridge unitBridgeTupleParserStateStart OpenFound ColonFoundTupleNoTuple tupleBridgestepisTuple writePSTypes bridgeSumType defaultBridge$fHasHaskTypeTypeInfoid Data.ProxyProxy GRecordEntrygToRecordEntriesGDataConstructorgToConstructors$fGRecordEntryM1$fGRecordEntryU1$fGRecordEntry:*:$fGDataConstructorM1$fGDataConstructor:+:$fGDataConstructorM10 _haskType _fullBridgeNothingGHC.Errerror$fAlternativeBridgeBuilder Data.Foldableorghc-prim GHC.Classes||$fHasHaskTypeBridgeData$fMonadPlusBridgeBuilderbridgeConstructorbridgeRecordEntry