BSD-3-Clause licensed by Daniel YU
Maintained by leptonyu@gmail.com

Module documentation for 0.0.3

This version can be pinned in stack with:menshen-0.0.3@sha256:86b418e7ad4b385d6c38a36eb84b67af8f3b3489d36845ee81189ea9fdcd87ca,1401

menshen

Hackage stackage LTS package stackage Nightly package Build Status


{-# LANGUAGE RecordWildCards #-}
module Main where
import Data.Menshen
data Body = Body
  { name :: String
  , age  :: Int
  } deriving Show

verifyBody :: Validator Body
verifyBody = vcvt $ Body{..} -> Body
  <$> name ?: mark "name" . pattern "^[a-z]{3,6}$"
  <*> age  ?: mark "age"  . minInt 1 . maxInt 150

makeBody :: String -> Int -> Either String Body
makeBody name age = Body{..} ?: verifyBody

main = do
  print $ makeBody "daniel" 15


Used by 1 package in lts-14.0(full list with versions):
comments powered byDisqus