SHARE
TWEET

Untitled

a guest Apr 21st, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. type IResult<A, B, C> = Result<A, (B, C)>;
  2.  
  3. pub fn one_of<I, T, Error>(list: T) -> impl Fn(I) -> IResult<I, char, Error> {
  4.     Ok
  5. }
  6.  
  7. pub fn escaped<P1, P2, T, O, Input, Error>(normal: P1, control: T, escapable: P2)
  8.     -> impl FnOnce(Input) -> IResult<Input, Input, Error>
  9. where
  10.     P1: Fn(Input) -> IResult<Input, O, Error>,
  11.     P2: Fn(Input) -> IResult<Input, O, Error>,
  12. {
  13.     Ok
  14. }
  15.  
  16. fn main() {
  17.     let alpha = Ok::<_, (_, ())>;
  18.     escaped(alpha, '\\', one_of(""))("abcd");
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top