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

Module documentation for 0.0.1

This version can be pinned in stack with:menshen-0.0.1@sha256:ab15a18032e308a9a93aee74c5bf57f9e864e6b9dc7ec25c11c68a3e9dcb94b0,1395

menshen

Hackage Build Status


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

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

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

main = do
  print $ makeBody "daniel" 15


Used by 2 packages in lts-13.11(full list with versions):