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
Feels like we probably already have a oneOf function that can make sure that not all branches are evaluated at once (to ensure efficient as-needed parsing), since using alt naively can lead to really really slow decoding, but I honestly don't know where it is. Is there something I'm missing that already implements this?:
oneOf::forallfa.Foldablef=>f (Foreign->Fa)
->Foreign->Fa
oneOf f js = go (fromFoldable f) js
where
go (read: xs) js =docase runExcept (read js) ofRight pv ->pure pv
Left e ->docase runExcept (go xs js) ofRight pv' ->pure pv'
Left e' -> throwError (e <> e')
go Nil _ =do
throwError $pure (ForeignError"No more parsers to attempt in oneOf")
If not, I could PR this, but feels like it probably exists as a simple combination of some operators.
The text was updated successfully, but these errors were encountered:
Feels like we probably already have a oneOf function that can make sure that not all branches are evaluated at once (to ensure efficient as-needed parsing), since using alt naively can lead to really really slow decoding, but I honestly don't know where it is. Is there something I'm missing that already implements this?:
If not, I could PR this, but feels like it probably exists as a simple combination of some operators.
The text was updated successfully, but these errors were encountered: