Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Denis Rosset
    @denisrosset
    Question: is there any error handling typeclass that Parser could implement? I'm looking at doing post-parse data validation, and would love to have helpers such as ensureOr.
    Peter Aaser
    @PeterAaser
    that talk you have on doobie is :fire:
    My brain is also on :fire: but I think it's the sort of pain you have after working out
    Rob Norris
    @tpolecat
    Oh, which one? The one with cofree?
    Peter Aaser
    @PeterAaser
    ye
    Rob Norris
    @tpolecat
    :-)
    Peter Aaser
    @PeterAaser
    gonna have to think more on it to see if it's applicable to my use case, but I really liked it for sure
    Rob Norris
    @tpolecat
    Cool, glad you liked it! Sorry about the headache
    Billzabob
    @Billzabob
    Mind dropping a link to the video?
    Peter Aaser
    @PeterAaser
    It's not really that crazy, it just takes a little digesting.
    And the polecat is good at explaining
    Peter Aaser
    @PeterAaser
    does atto have hexadecimal out of the box?
    didn't see it in Numeric
    I can do string("0x") ~> many1(hexDigit)
    Ryan Zeigler
    @rzeigler

    is there at atMost somewhere? I could not find it in combinators and implemented my own as

          def atMost[A](p: Parser[A], n: Int) = 
            opt(p).replicateA(n)
              .map(_.flattenOption)

    which I'm not certain is the best way

    Rob Norris
    @tpolecat
    That seems reasonable to me.
    Christopher Davenport
    @ChristopherDavenport
    How hard would it be to extend Atto or an atto derivative to work given a text encoding to operate both parsing at the byte level or at the text level? Scodec is binary, atto is text but http is generally both and I don’t know of a solution that has smooth interop at the parsing level.
    Billzabob
    @Billzabob
    @ChristopherDavenport I think everthing is built of Parser[Char] so you could add stuff that adds Parser[Byte] utilities couldn’t you?
    Rob Norris
    @tpolecat
    Scala stdlib parsers are parametric in the element type.
    Wojtek Pituła
    @Krever
    Hey, do you plan 2.13 release ? I see there are some artifacts for M5, right?
    Rob Norris
    @tpolecat
    Yeah waiting on upstream stuff.
    Wojtek Pituła
    @Krever
    @tpolecat seems its ready if milestone releases are fine tpolecat/atto#107
    felher
    @felher

    Is there a way to forcibly commit a branch at a certain point? e.g

    choice(
      discriminator1 *> commit *> valuePart1,
      discriminator2 *> commit *> valuePart2
    )

    should not try discriminator2 if it tried discriminator2 and succeeded because it reached commit. When discriminator1 fails, it should try the second branch though. Sometimes I know that as soon as I see something, I know the branch and if anything goes wrong after that, the error is definitively in that branch.

    Would be nice, if someone can help me
    nafg
    @nafg
    @bifunctor what does it have to do with atto, did you try asking on scala/scala?
    Peter Aaser
    @PeterAaser
    edit: moved to doobie gitter
    Billzabob
    @Billzabob
    @PeterAaser I think you meant to post this in the doobie channel?
    Peter Aaser
    @PeterAaser
    yep
    oops
    Raphael Mäder
    @randm-ch

    Hey, do you plan 2.13 release ? I see there are some artifacts for M5, right?

    Is there an update on this? I'm only waiting for atto to update my project ATM :) Thanks!

    Christopher Davenport
    @ChristopherDavenport
    I can take a look at some point, but I know Rob appreciates PRs if you have the time.
    Raphael Mäder
    @randm-ch
    There already is one: #107 :)
    Christopher Davenport
    @ChristopherDavenport
    I missed that and updated. :cry:
    Rob Norris
    @tpolecat
    I’m traveling but will try to get caught up next week.
    Raphael Mäder
    @randm-ch
    Thanks guys :thumbsup:
    Ryan Zeigler
    @rzeigler
    is there anything that might cause a stack overflow during parsing besides accidentally writing a left recursive grammar?
    Rob Norris
    @tpolecat
    Yes, if you’re constructing an infinite parser that’s not lazy enough. You may need to use the delay combinator somewhere.
    This is a frustrating thing to debug.
    Ryan Zeigler
    @rzeigler
    not as frustrating as trying to debug antlr...
    Rob Norris
    @tpolecat
    Haha choose your poison.
    Rob Norris
    @tpolecat
    0.7.0-M1 is on sonatype, for 2.13
    Rob Norris
    @tpolecat
    0.7.0-M2 is on sonatype
    Rob Norris
    @tpolecat
    0.7.0-RC1 is on sonatype
    Wojtek Pituła
    @Krever
    Hey, any advice on how to take text between markers? I think I cannot use takeText because its greedy and it doesn't left content for end marker to be satisfied
    Example:
    val result = (string("{{") ~> takeText <~ string("}}")).parse("{{has}}{{red}}").done
    Wojtek Pituła
    @Krever

    And a second question: how could I make the following not fall into infinite loop?

        val p      = takeWhile(_ => true)
        val result = many(p).parse("abcd").done

    manyUntil(p, endOfInput) seems to help, but maybe there is a better option?

    Rob Norris
    @tpolecat
    0.7.0-RC2 is on sonatype
    Wojtek Pituła
    @Krever
    Hey, I can't see anything as parser negation. I wanted not(whitespace) which I obviously can implemented by satisfy but I'm wondering if its possible to have it in generic way.
    Rob Norris
    @tpolecat
    0.7.0 final is out on sonatype