import { curry } from '@typed/lambda' ; import { Match } from '@typed/logic' ; import { unpack } from '@typed/maybe' ; import { Validation } from './Validation' ; export const validate = curry ( __validate ) as { < A , B , C > ( error , match , value ) : Validation < A , C > ; < A , B , C > ( error , match ) : ( value : B ) => Validation < A , C > ; < A > ( error ) : { < B , C > ( match , value ) : Validation < A , C > ; < B , C > ( match ) : ( value : B ) => Validation < A , C > ; } ; } ; function __validate < A , B , C > ( error , match , value ) { return unpack ( ( value ) => Validation . of ( value ) , ( ) => Validation . error ( error ) , match ( value ) ) ; }