V      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safeyou can ( switches to control the code generation$General settings for code generation6use purescript-profunctor-lens for generated PS-types?Settings to generate Lenses Translate switches into settings3Default switches include code generation for lenses0Switch off the generatation of profunctor-lenses /Switch on the generatation of profunctor-lenses   None-;=FK Basic info about a data type:Hackage packageFull Module path:Types that have a lens for accessing a 'TypeInfo Haskell'.For convenience:For convenience:"1Put the TypeInfo in a list together with all its  (recursively)#Simple  instance: Get the   itself.  !"  !"  None -;<=FSTV%M &e.g. runState for State*e.g. / for ,LPurescript typeclass instances that can be generated for your Haskell types.1-Generic representation of your Haskell types.3TypInfo lens for 1.4DataConstructor lens for 1.5Create 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).6The Purescript typeclass .L might be derivable if the original Haskell type was a simple type wrapper.7Ensure that an % instance is generated for your type.8Ensure that both  and ' instances are generated for your type.9!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 itself$%&'()+*,/0-.123456789:IJKL12578()*+$%&',-./069:IJ34KL$%&'()*+,-./012None-F(cbeGiven a Purescript type, generate `derive instance` lines for typeclass instances it claims to have.*MNOPRQSTUXWVYZ[\]^_`abcdefghijklmnopqrstuv*TUVWXSOPQRNMYZ[\]^_`abcdefghijklmnopqrstuvOPQRTUVWXNone -;<=>?KQVZWThe Haskell type to translate.LReference to the bridge 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 ( y8 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 - 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 u 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 (z) 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 .Check parts of  for equality: textBridge :: BridgePart textBridge = do typeName ^== "Text" typeModule ^== "Data.Text.Internal" <|> typeModule ^== "Data.Text.Internal.Lazy" return psStringBridge   over to PureScript types.*To be used for bridging type constructors.By implementing the B lens in the HasHaskType class, we are able to use it for both y and a plain #, therefore you can use it with  and  for checks on the complete  value.Example: stringBridge :: BridgePart stringBridge = do -- Note: we are using the HaskellType instance here: haskType ^== mkTypeInfo (Proxy :: Proxy String) return psStringIAlternative 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.yz{|}~~}|{yzy|~4None-;<=^ Uses type parameters from  (bridged).Uses type parameters from  (bridged).Uses type parameters from  (bridged).Uses type parameters from  (bridged). None-^ None-<_)Dummy bridge, translates every type with  None- hYour entry point to this library and quite likely all you will need. Make sure all your types derive - and Typeable-. Typeable is not needed from ghc-7.10 on.@Then list all your types you want to use in PureScript and call : Idata Foo = Foo { ... } deriving (Eq, Generic) data Bar = A | B | C deriving (Eq, Ord, Generic) data Baz = ... deriving (Generic) -- | All types will have a `Generic` instance produced in Purescript. myTypes :: [SumType 'Haskell] myTypes = [ let p = (Proxy :: Proxy Foo) in equal p (mkSumType p) -- Also produce a `Eq` instance. , let p = (Proxy :: Proxy Bar) in order p (mkSumType p) -- Produce both `Eq` and `Ord`. , mkSumType (Proxy :: Proxy Baz) -- Just produce a `Generic` instance. ] 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   data, so make sure you set J 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! Works like V but you can add additional switches to control the generation of your PureScript codeSwitches/Settings: and   to control if the `purescript-profunctor-lenses` are generated for your typesWARNING:EThis function overwrites files - make backups or use version control!Translate all   values in a 1 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.  !"$%&'()+*,/0-.123456789:IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvyz{|}~ SafeUYou can use those if your type parameters are actually type constructors as well: $ st = mkSumType (Proxy :: Proxy (ReaderT R M1 A)) 44  !"#$%&'()*+,-.//01223456789::;<=>?@ABCDEFGHIJKLMNOPQRSTUVWWXYZ[Z\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                        89         1purescript-bridge-0.13.0.0-LfAuEipCSVG2c11XP7lrVn"Language.PureScript.Bridge.Builder*Language.PureScript.Bridge.CodeGenSwitches#Language.PureScript.Bridge.TypeInfo"Language.PureScript.Bridge.SumType"Language.PureScript.Bridge.Printer"Language.PureScript.Bridge.PSTypes Language.PureScript.Bridge.Tuple%Language.PureScript.Bridge.PrimitivesLanguage.PureScript.Bridge)Language.PureScript.Bridge.TypeParametersbaseGHC.Base<|>SwitchSettingsgenerateLensesdefaultSettings getSettings defaultSwitchnoLenses genLenses $fEqSettings$fShowSettingsTypeInfo _typePackage _typeModule _typeName_typeParametersLanguageHaskell PureScript $fEqTypeInfo $fOrdTypeInfo$fShowTypeInfo HasHaskTypehaskType HaskellTypePSType typeModuletypeName typePackagetypeParameters mkTypeInfo mkTypeInfo'flattenTypeInfo$fHasHaskTypeTypeInfo RecordEntry _recLabel _recValueDataConstructor_sigConstructor _sigValuesInstanceGenericNewtypeEqOrdSumType sumTypeInfosumTypeConstructors mkSumTypenootypeequalorder getUsedTypesconstructorToTypes$fGDataConstructor:+:$fGDataConstructorM1$fGRecordEntryM1$fGRecordEntryU1$fGRecordEntry:*:$fGDataConstructorM10 $fEqInstance$fShowInstance$fShowRecordEntry$fEqRecordEntry$fShowDataConstructor$fEqDataConstructor $fShowSumType $fEqSumTypesigConstructor sigValuesrecLabelrecValue ImportLinesModules ImportLine importModule importTypesPSModuleModule psModuleName psImportLinespsTypes printModulesumTypesToNeededPackagessumTypeToNeededPackages moduleToText _lensImports_noLensImportsimportLineToText sumTypeToTextsumTypeToTypeDecls instancessumTypeToOpticsconstructorOptics recordOpticsconstructorToTextspacestypeNameAndForall fromEntriesmkFnArgs mkTypeSigconstructorToOpticrecordEntryToLensrecordEntryToTexttypeInfoToTextsumTypesToModulessumTypeToModuletypesToImportLinestypeToImportLinesimportsFromListmergeImportLinesunlessM$fShowImportLine $fShowModule BridgeData FullBridge FixUpBridge FixUpBuilder BridgePart BridgeBuilder fullBridgeclearPackageFixUp errorFixUp buildBridgebuildBridgeWithCustomFixUpdoCheck^==psTypeParameters$fHasHaskTypeBridgeData$fMonadPlusBridgeBuilder$fAlternativeBridgeBuilder$fFunctorFixUpBuilder$fApplicativeFixUpBuilder$fMonadFixUpBuilder$fMonadReaderFixUpBuilder$fFunctorBridgeBuilder$fApplicativeBridgeBuilder$fMonadBridgeBuilder$fMonadReaderBridgeBuilderpsArraypsBoolpsEitherpsIntpsNumberpsMaybepsStringpsTuplepsUnitTupleParserStateStart OpenFound ColonFoundTupleNoTuple tupleBridgestepisTuple$fEqTupleParserState$fShowTupleParserState boolBridge eitherBridge dummyBridge intBridge doubleBridge listBridge maybeBridge stringBridge textBridge unitBridgenoContentBridge writePSTypeswritePSTypesWith bridgeSumType defaultBridgeZ1Y1X1W1V1U1T1S1R1Q1P1O1N1M1L1K1J1I1H1G1F1E1D1C1B1A1ZYXWVUTSRQPONMLKJIHGFEDCBAmappendid Data.EitherLeftRightEither Data.ProxyProxyghc-prim GHC.Classes GRecordEntrygToRecordEntriesGDataConstructorgToConstructors _haskType _fullBridgeNothing mtl-2.2.1-DscMMmDQUE6GBfOSl4qMUHControl.Monad.Reader.Class MonadReaderGHC.ErrerroremptyfixTypeParameters Data.Foldableor||bridgeConstructorbridgeRecordEntry