grab-form: Applicative parsers for form parameter lists

[ library, mit, text ] [ Propose Tags ]

Grab is an Applicative for consuming lists of (name, value) parameters.

Example

Parser:

nameStateAndQAs :: Grab EnglishSentence (Text, Text, [QA])
nameStateAndQAs =
    (,,)
        <$> at "name" (only text)
        <*> at "state" (only text)
        <*> at "security" (only (natList (only qa)))

qa :: Grab EnglishSentence QA
qa =
    QA
        <$> at "Q" (only text)
        <*> at "A" (only text)

Input:

name:           Alonzo
state:          Montana
security[1].Q:  What is your favorite hobby?
security[1].A:  watching cars
security[2].Q:  What is your oldest sibling's name?
security[2].A:  melman
security[3].Q:  What was the make and model of your first car?
security[3].A:  bmw x5

Output:

( "Alonzo"
, "Montana"
, [ QA
      { qa_question = "What is your favorite hobby?"
      , qa_answer = "watching cars"
      }
  , QA
      { qa_question = "What is your oldest sibling's name?"
      , qa_answer = "melman"
      }
  , QA
      { qa_question = "What was the make and model of your first car?"
      , qa_answer = "bmw x5"
      }
  ]
)

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.0.1, 0.0.0.2, 0.0.0.4, 0.0.0.6, 0.0.0.7, 0.0.0.8 (info)
Change log changelog.md
Dependencies base (>=4.12 && <4.18), containers (>=0.6 && <0.7), grab, text (>=1.2 && <1.3 || >=2.0 && <2.1) [details]
License MIT
Copyright 2021 Mission Valley Software LLC
Author Chris Martin
Maintainer Chris Martin, Julie Moronuki
Revised Revision 1 made by chris_martin at 2023-05-31T21:22:54Z
Category Text
Home page https://github.com/typeclasses/grab
Bug tracker https://github.com/typeclasses/grab/issues
Uploaded by chris_martin at 2022-06-20T19:18:09Z
Distributions
Downloads 1073 total (20 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-06-20 [all 1 reports]