-
Notifications
You must be signed in to change notification settings - Fork 49
Allow plugging in custom generators for instances #60
Copy link
Copy link
Open
Description
AFAICT, currently the list of all the different kinds of instances that can be generated is hard-coded into the printer. I would like to be able to plug in some custom code to generate instances for my types, without needing to fork this library.
| data Instance = Encode | EncodeJson | Decode | DecodeJson | Generic | Newtype | Eq | Ord deriving (Eq, Show) |
purescript-bridge/src/Language/PureScript/Bridge/Printer.hs
Lines 174 to 179 in a65fd63
| instances :: Switches.Settings -> SumType 'PureScript -> [Text] | |
| instances settings st@(SumType t _ is) = map go is | |
| where | |
| go :: Instance -> Text | |
| go Encode = "instance encode" <> _typeName t <> " :: " <> extras <> "Encode " <> typeInfoToText False t <> " where\n" <> | |
| " encode = genericEncode $ defaultOptions" <> encodeOpts |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels