GithubHelp home page GithubHelp logo

spock-digestive's Introduction

Spock-digestive

Build Status Hackage

Intro

Hackage: Spock-digestive Stackage: Spock-digestive

Digestive functors support for Spock

Install

  • Using cabal: cabal install Spock-digestive
  • Using Stack: stack install Spock-digestive
  • From Source (cabal): git clone https://github.com/agrafix/Spock-digestive.git && cd Spock-digestive && cabal install
  • From Source (stack): git clone https://github.com/agrafix/Spock-digestive.git && cd Spock-digestive && stack build

Misc

Supported GHC Versions

  • 7.10.2

License

Released under the MIT license. (c) 2014 - 2016 Alexander Thiemann [email protected]

spock-digestive's People

Contributors

agrafix avatar

Stargazers

 avatar Patrick Cieplak avatar Daniel Kahlenberg avatar Second Datke avatar Tatsuya Hirose avatar Xe Iaso avatar

Watchers

James Cloos avatar  avatar Robert Pergl avatar  avatar  avatar

Forkers

eriklee roper79

spock-digestive's Issues

Not working in GHC 8.x, yet?

|| Failed to load interface for ‘Web.Spock.Digestive’
|| There are files missing in the ‘Spock-digestive-0.3.0.0’ package,

Validation is not working

I have a very simple form (digestive-bootstrap) with some validation:

newUserForm :: Monad m => F.Form H.Html m NewUserRequest
newUserForm = NewUserRequest
              <$> "username" F..: nonEmptyText
              <*> (fst <$> newPasswordForm)
              <*> "is_admin" F..: F.bool (Just False)
   where
    nonEmptyText =
      F.check "Cannot be empty" (not . T.null) $ F.text Nothing
    newPasswordForm = F.check "Passwords don't match" (Prelude.uncurry (==)) $ (,)
      <$> "password" F..: F.text Nothing
      <*> "password2" F..: F.text Nothing

newUserFormSpec :: F.FormMeta
newUserFormSpec =
  F.FormMeta
    { F.fm_method = POST
    , F.fm_target = "/newUser"
    , F.fm_elements =
        [ F.FormElement "username" (Just "Username") F.InputText
        , F.FormElement "password" (Just "Password") F.InputPassword
        , F.FormElement "password2" (Just "Confirm password") F.InputPassword
        , F.FormElement "is_admin" (Just "Admin?") F.InputCheckbox
        ]
    , F.fm_submitText = "New User"
    }

then I use Spock-digestive to run this form

do
  let formView = F.renderForm newUserFormSpec
  f <- F.runForm "newUserForm" newUserForm
  case f of
    (view, Nothing) -> site $ formView view
    (view, Just nuReq) -> ...

When I type different passwords, form is failed, but no errors shown. nonEmptyText validator works though.

Versions: Spock-digestive-0.2.0.0, digestive-bootstrap-0.1.0.1, digestive-functors-0.8.0.1

Travis build broken?

The main page says the Travis build is broken as of a month ago. Maybe restart it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.