package p4spectec

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file extract.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
open Error

(* Shorthand for extracting type arguments and values *)

let zero at = function [] -> () | _ -> error at "arity mismatch"
let one at = function [ a ] -> a | _ -> error at "arity mismatch"
let two at = function [ a; b ] -> (a, b) | _ -> error at "arity mismatch"

let three at = function
  | [ a; b; c ] -> (a, b, c)
  | _ -> error at "arity mismatch"

let four at = function
  | [ a; b; c; d ] -> (a, b, c, d)
  | _ -> error at "arity mismatch"