Sha256: c53c7c3248e8e2e5467c73f81833129405d1f676d08ec6d97938cb58f3f4b345

Contents?: true

Size: 821 Bytes

Versions: 159

Compression:

Stored size: 821 Bytes

Contents

open Core

open Model
open Yojson.Basic

let map_elements (to_str: json -> string) (parameters: (string * json) list): (string * string) list =
  List.map parameters ~f:(fun (k,j) -> (k,to_str j))

let optional_int ~(none: int) = function
| `Int n when n = none -> "Nothing"
| `Int n -> "(Just " ^ Int.to_string n ^ ")"
| x -> json_to_string x

let rec edit_expected ~(f: json -> string) (parameters: (string * json) list) = match parameters with
| [] -> []
| ("expected", v) :: rest -> ("expected", f v) :: edit_expected f rest
| (k, v) :: rest -> (k, json_to_string v) :: edit_expected f rest

let purescript_edit_parameters ~(slug: string) (parameters: (string * json) list) = match (slug, parameters) with
| ("hamming", ps) -> edit_expected ~f:(optional_int ~none:(-1)) ps
| (_, ps) -> map_elements json_to_string ps

Version data entries

159 entries across 159 versions & 1 rubygems

Version Path
trackler-2.2.1.98 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.97 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.96 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.95 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.94 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.93 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.92 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.91 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.90 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.89 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.88 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.87 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.86 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.85 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.84 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.83 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.82 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.81 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.80 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml
trackler-2.2.1.79 tracks/ocaml/tools/test-generator/src/purescript_special_cases.ml