[] ->
[]
| x1::x2::xs when f x1 x2 ->
- let y::ys =
- group_by f @@ x2::xs in
- (x1::y)::ys
+ begin match group_by f @@ x2::xs with
+ y::ys ->
+ (x1::y)::ys
+ | _ ->
+ failwith "must not happen"
+ end
| x::xs ->
[x]::group_by f xs
let current =
Int32.to_int ((x &/ 0x7Fl) |/ 0x80l) in
Some (current,next)) x
- | _ ->
- invalid_arg "of_int_list"
(** encode label *)
encode_base @@ U30 (Int32.of_int @@ List.length ys) in
len @ ys
| xs ->
- encode_labeled @@ List.map (fun (Labeled x)->x) xs in
+ encode_labeled @@ List.map (function (Labeled x)->x | _ -> failwith "must not happen") xs in
let same x y =
match x,y with
| Labeled _,Labeled _ ->
[] ->
[z]
| x::xs ->
- let y::_ as yss =
- scanr f z xs in
- (f x y) :: yss
+ match scanr f z xs with
+ y::_ as yss ->
+ (f x y) :: yss
+ | _ ->
+ failwith "must not happen"
let scanr1 f =
function
let parse_number stream =
match stream with parser
[<Genlex.Int x = parse_int>] ->
- match stream with parser
+ begin match stream with parser
[<''.'; y = many digit >] ->
let v =
Printf.sprintf "%d.%s" x @@ ExtString.String.implode y in
Genlex.Float (float_of_string v)
| [<>] ->
Genlex.Int x
+ end
+ | [<>] ->
+ fail ()
type token = Genlex.token