[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    [Haskell-cafe] Looking for JavaScript(V8)-compilant parser
From:       Javran Cheng <javran.c () gmail ! com>
Date:       2019-02-19 1:00:16
Message-ID: CA+TfdNZcfYROmSss2rq0ggaTni+1qx=w5ijqV7baQwf70Yvc2A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Cafe,

tl;dr: I'm wondering if there are existing parsers for parsing any
dateString that can be accepted by `Date.parse` of JavaScript(V8).
The input looks like "Fri, 08 February 2019 12:34:56 +0900".

At first I checked [MDN](
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
and
turns out it's very close to [IETF-compliant RFC 2822 timestamps](
https://tools.ietf.org/html/rfc2822#page-14), but not quite:
as I then found [hsemail](
http://hackage.haskell.org/package/hsemail-2/docs/Text-Parsec-Rfc2822.html)
to be promising,
but it rejected "Fri, 08 February 2019 12:34:56 +0900" but accepted "Fri,
08 Feb 2019 12:34:56 +0900" (notice that RFC2822 does not accept full month
name).

Refering to language spec doesn't help (
http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.4.2), as it
doesn't mention RFC2822 at all.
So it seems `Data.parse` accepts a superset of RFC2822 and a version of
ISO8601 (as described in MDN above) but I'm not sure what exactly
is the accepting set of inputs.

Before I start working on a quick and dirty solution (it should work
patching hsemail to accept full month name)
I want to know if there are existing parsers for this purpose?

Thanks!
-- 
Javran (Fang) Cheng

[Attachment #5 (text/html)]

<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div \
dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi \
Cafe,<div><br></div><div>tl;dr: I&#39;m wondering if there are existing parsers for \
parsing any dateString that can be accepted by `Date.parse` of \
JavaScript(V8).</div><div>The input looks like &quot;Fri, 08 February 2019 12:34:56 \
+0900&quot;.</div><div><br></div><div>At first I checked [MDN](<a \
href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects \
/Date">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date</a>) \
and</div><div>turns out it&#39;s very close to [IETF-compliant RFC 2822 \
timestamps](<a href="https://tools.ietf.org/html/rfc2822#page-14">https://tools.ietf.org/html/rfc2822#page-14</a>), \
but not quite:</div><div>as I then found [hsemail](<a \
href="http://hackage.haskell.org/package/hsemail-2/docs/Text-Parsec-Rfc2822.html">http://hackage.haskell.org/package/hsemail-2/docs/Text-Parsec-Rfc2822.html</a>) \
to be promising,</div><div>but it rejected &quot;Fri, 08 February 2019 12:34:56 \
+0900&quot; but accepted  &quot;Fri, 08 Feb 2019 12:34:56 +0900&quot; (notice that \
RFC2822 does not accept full month name).</div><div><br></div><div>Refering to \
language spec doesn&#39;t help (<a \
href="http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.4.2">http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.4.2</a>), \
as it doesn&#39;t mention RFC2822 at all.</div><div>So it seems `Data.parse` accepts \
a superset of RFC2822 and a version of ISO8601 (as described in MDN above) but \
I&#39;m not sure what exactly</div><div>is the accepting set of \
inputs.</div><div><br></div><div>Before I start working on a quick and dirty solution \
(it should work patching hsemail to accept full month name)</div><div>I want to know \
if there are existing parsers for this \
purpose?</div><div><div><br></div><div>Thanks!</div>-- <br><div dir="ltr" \
class="gmail_signature"><div dir="ltr">Javran (Fang) \
Cheng<br></div></div></div></div></div></div></div></div></div></div></div></div></div>



[Attachment #6 (text/plain)]

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic