You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice having a toString : List Block -> String function which is a "reverse" of the parser.
Of course some data as indentation could be lost, but I think this manageable.
My use case and wished workflow is the following:
an admin writes some article in a form. This content of the textarea is transformed to List Block
this List Block is stored as it in the persistence layer (I'm using Lamdera)
when a user wants to see the article, we just have to render it with a List Block -> Html renderer.
the next time an admin wants to edit the article, we could the string thanks to the toString function and we'd put this in a textarea.
We could just storing the string as it is entered by the admin but:
this asks an extra parsing step for the user to view it. It of course seems an inefficient process but what mostly bothers me is that we could have an Err during the process... What do we display to the user in this case?
directly storing the List Block value automatically provides a formater, so all the contents are eventually uniformly displayed to the admin.
this feature could be a good spot for property testing (the property being: forall blocks : List Block, blocks |> toString |> parse == Ok blocks. And it is always cool writing property tests :)
The text was updated successfully, but these errors were encountered:
I might integrate some of the things in that package there at some point, but in the meantime it would be great if you could try that out and just give feedback and we can use that package to get a better understanding of the ideal way to do have toString and whether it fits in the core package, etc..
It would be nice having a
toString : List Block -> String
function which is a "reverse" of the parser.Of course some data as indentation could be lost, but I think this manageable.
My use case and wished workflow is the following:
List Block
List Block
is stored as it in the persistence layer (I'm using Lamdera)List Block
->Html
renderer.toString
function and we'd put this in a textarea.We could just storing the string as it is entered by the admin but:
Err
during the process... What do we display to the user in this case?List Block
value automatically provides a formater, so all the contents are eventually uniformly displayed to the admin.forall blocks : List Block, blocks |> toString |> parse == Ok blocks
. And it is always cool writing property tests :)The text was updated successfully, but these errors were encountered: