purescript-webrow / webrow

Let's build a highly opinionated but fully-featured web framework in PureScript
BSD 3-Clause "New" or "Revised" License
23 stars 0 forks source link

Introduce a type parameter for the messages / errors + provide possible i18n and i10l infrastructure #11

Closed paluh closed 4 years ago

paluh commented 4 years ago

Unfortunately it seems that we won't be able to avoid another type (Variant based for sure ;-)) which should handle semantic representation of validation errors but also for form labels, help messages etc. This will allow customization of all predefined forms and validators. Additionally it would provide a layer for i18n machinery. The question remains how we are going to handle i10l in the context of automatic form prefill up. Do we really have to mess up the Polyform.Dual with yet another type variable for the serializer "monad / profunctor etc"....

paluh commented 4 years ago

Regarding i10l we can try to solve the issue by extending "UrlDecoded" values representation so they handle also "decoded" values and postpone localization till the rendering step. I mean provide closed sum type for values like:

data Value = String String | DateTime JsDatetime | Number Number | ...

In this way we can start validation from nearly the same layer but we can present values localized with the Intl tools.

paluh commented 4 years ago

I've introduced a Message effect into the stack. I'm going to provide specific L10n and I18n related tickets which should somewhat build on the top.